Version Description
Download this release
Release Info
Developer | mmuro |
Plugin | Visual Form Builder |
Version | 3.0.9 |
Comparing to | |
See all releases |
Code changes from version 3.0.8 to 3.0.9
- admin/assets/css/sass/partials/_accordions.scss +144 -144
- admin/assets/css/sass/partials/_buttons.scss +128 -128
- admin/assets/css/sass/partials/_confirmation.scss +20 -20
- admin/assets/css/sass/partials/_cta.scss +24 -24
- admin/assets/css/sass/partials/_entries.scss +29 -29
- admin/assets/css/sass/partials/_export.scss +17 -17
- admin/assets/css/sass/partials/_fields.scss +111 -111
- admin/assets/css/sass/partials/_form-edit.scss +155 -155
- admin/assets/css/sass/partials/_form-new.scss +10 -10
- admin/assets/css/sass/partials/_icons.scss +91 -91
- admin/assets/css/sass/partials/_notices.scss +19 -19
- admin/assets/css/sass/partials/_print.scss +181 -181
- admin/assets/css/sass/partials/_subnav.scss +25 -25
- admin/assets/css/sass/partials/_tooltips.scss +32 -32
- admin/assets/css/sass/partials/_upgrade.scss +27 -27
- admin/assets/css/sass/partials/_validation.scss +3 -3
- admin/assets/css/visual-form-builder-admin.css +68 -68
- admin/assets/js/jquery.ui.nestedSortable.js +390 -354
- admin/assets/js/vfb-admin.js +615 -525
- admin/assets/js/vfb-admin.min.js +1 -1
- admin/assets/js/vfb-validation.js +57 -41
- admin/class-admin-menu.php +163 -162
- admin/class-admin-notices.php +44 -19
- admin/class-ajax.php +81 -72
- admin/class-dashboard-widgets.php +32 -25
- admin/class-entries-detail.php +99 -90
- admin/class-entries-list.php +294 -323
- admin/class-export.php +196 -188
- admin/class-fields.php +381 -372
- admin/class-forms-edit.php +414 -421
- admin/class-forms-list.php +184 -244
- admin/class-forms-new.php +52 -53
- admin/class-load-css-js.php +4 -6
- admin/class-media-button.php +41 -41
- admin/class-page-settings.php +120 -120
- admin/class-save.php +220 -195
- admin/class-screen-options.php +32 -23
- admin/class-widget.php +51 -46
- inc/class-i18n.php +15 -18
- inc/class-install.php +69 -60
- inc/class-list-table.php +0 -1520
- inc/class-uninstall.php +9 -13
- inc/countries.php +199 -199
- public/assets/css/visual-form-builder.css +278 -278
- public/assets/js/i18n/datepicker/datepicker-cs_CS.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-de_DE.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-el_GR.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-en_AU.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-en_GB.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-en_US.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-es_ES.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-fr_FR.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-he_IL.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-hu_HU.js +6 -3
- public/assets/js/i18n/datepicker/datepicker-id_ID.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-it_IT.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-ja_JP.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-ko_KR.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-nl_NL.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-pl_PL.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-pt_BR.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-pt_PT.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-ro_RO.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-ru_RU.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-sv_SE.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-tr_TR.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-zh_CN.js +2 -2
- public/assets/js/i18n/datepicker/datepicker-zh_TW.js +2 -2
- public/assets/js/i18n/validate/messages-cs_CS.js +36 -33
- public/assets/js/i18n/validate/messages-de_DE.js +36 -33
- public/assets/js/i18n/validate/messages-el_GR.js +36 -33
- public/assets/js/i18n/validate/messages-en_AU.js +35 -32
- public/assets/js/i18n/validate/messages-en_GB.js +35 -32
- public/assets/js/i18n/validate/messages-en_US.js +35 -32
- public/assets/js/i18n/validate/messages-es_ES.js +36 -33
- public/assets/js/i18n/validate/messages-fr_FR.js +36 -33
- public/assets/js/i18n/validate/messages-he_IL.js +36 -33
- public/assets/js/i18n/validate/messages-hu_HU.js +36 -33
- public/assets/js/i18n/validate/messages-id_ID.js +36 -33
- public/assets/js/i18n/validate/messages-it_IT.js +36 -33
- public/assets/js/i18n/validate/messages-ja_JP.js +36 -33
- public/assets/js/i18n/validate/messages-ko_KR.js +36 -33
- public/assets/js/i18n/validate/messages-nl_NL.js +36 -33
- public/assets/js/i18n/validate/messages-pl_PL.js +36 -33
- public/assets/js/i18n/validate/messages-pt_BR.js +36 -33
- public/assets/js/i18n/validate/messages-pt_PT.js +36 -33
- public/assets/js/i18n/validate/messages-ro_RO.js +35 -32
- public/assets/js/i18n/validate/messages-ru_RU.js +36 -33
- public/assets/js/i18n/validate/messages-sv_SE.js +36 -33
- public/assets/js/i18n/validate/messages-tr_TR.js +36 -33
- public/assets/js/i18n/validate/messages-zh_CN.js +36 -33
- public/assets/js/i18n/validate/messages-zh_TW.js +35 -32
- public/assets/js/vfb-validation.js +57 -41
- public/class-confirmation.php +47 -40
- public/class-email.php +289 -289
- public/class-form-display.php +223 -226
- public/class-load-css-js.php +63 -63
- public/class-security.php +66 -36
- readme.txt +9 -9
- visual-form-builder.php +78 -74
admin/assets/css/sass/partials/_accordions.scss
CHANGED
@@ -1,166 +1,166 @@
|
|
1 |
.vfb-accordion-container {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
}
|
10 |
|
11 |
.vfb-accordion-section {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
}
|
25 |
|
26 |
.vfb-accordion-section-content {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
}
|
32 |
|
33 |
.vfb-accordion-section-title {
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
}
|
77 |
|
78 |
.metabox-holder h3.vfb-accordion-section-title {
|
79 |
-
|
80 |
}
|
81 |
|
82 |
.cannot-expand {
|
83 |
-
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
}
|
91 |
|
92 |
.vfb-control-section {
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
}
|
1 |
.vfb-accordion-container {
|
2 |
+
border: 1px solid #e5e5e5;
|
3 |
+
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
4 |
+
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
5 |
|
6 |
+
.outer-border {
|
7 |
+
margin: 0;
|
8 |
+
}
|
9 |
}
|
10 |
|
11 |
.vfb-accordion-section {
|
12 |
+
border-bottom: 1px solid #dfdfdf;
|
13 |
+
margin: 0;
|
14 |
+
|
15 |
+
&.open {
|
16 |
+
.vfb-accordion-section-content {
|
17 |
+
display: block;
|
18 |
+
}
|
19 |
+
|
20 |
+
&:hover {
|
21 |
+
border-bottom-color: #dfdfdf;
|
22 |
+
}
|
23 |
+
}
|
24 |
}
|
25 |
|
26 |
.vfb-accordion-section-content {
|
27 |
+
display: none;
|
28 |
+
padding: 10px 15px;
|
29 |
+
overflow: hidden;
|
30 |
+
background: #fff;
|
31 |
}
|
32 |
|
33 |
.vfb-accordion-section-title {
|
34 |
+
margin: 0;
|
35 |
+
padding: 12px 15px 15px;
|
36 |
+
position: relative;
|
37 |
+
border-left: 1px solid #dfdfdf;
|
38 |
+
border-right: 1px solid #dfdfdf;
|
39 |
+
-webkit-user-select: none;
|
40 |
+
-moz-user-select: none;
|
41 |
+
-ms-user-select: none;
|
42 |
+
user-select: none;
|
43 |
+
cursor: pointer;
|
44 |
+
|
45 |
+
&:after {
|
46 |
+
position: absolute;
|
47 |
+
top: 12px;
|
48 |
+
right: 10px;
|
49 |
+
z-index: 1;
|
50 |
+
|
51 |
+
content: '\f140';
|
52 |
+
border: none;
|
53 |
+
background: 0 0;
|
54 |
+
font: 400 20px/1 dashicons;
|
55 |
+
speak: none;
|
56 |
+
display: block;
|
57 |
+
padding: 0;
|
58 |
+
text-indent: 0;
|
59 |
+
text-align: center;
|
60 |
+
|
61 |
+
-webkit-font-smoothing: antialiased;
|
62 |
+
-moz-osx-font-smoothing: grayscale;
|
63 |
+
text-decoration: none !important;
|
64 |
+
color: #aaaaaa;
|
65 |
+
}
|
66 |
+
|
67 |
+
&:focus {
|
68 |
+
outline: none;
|
69 |
+
}
|
70 |
+
|
71 |
+
&:hover:after,
|
72 |
+
&:focus:after {
|
73 |
+
color: #777;
|
74 |
+
border-color: #aaa transparent;
|
75 |
+
}
|
76 |
}
|
77 |
|
78 |
.metabox-holder h3.vfb-accordion-section-title {
|
79 |
+
padding: 12px 15px 15px;
|
80 |
}
|
81 |
|
82 |
.cannot-expand {
|
83 |
+
.vfb-accordion-section-title {
|
84 |
+
cursor: auto;
|
85 |
|
86 |
+
&:after {
|
87 |
+
display: none;
|
88 |
+
}
|
89 |
+
}
|
90 |
}
|
91 |
|
92 |
.vfb-control-section {
|
93 |
+
.vfb-accordion-section-title {
|
94 |
+
border-left: none;
|
95 |
+
border-right: none;
|
96 |
+
padding: 10px 10px 11px 14px;
|
97 |
+
line-height: 21px;
|
98 |
+
background: #fff;
|
99 |
+
|
100 |
+
&:after {
|
101 |
+
top: 11px;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
&:hover .vfb-accordion-section-title,
|
106 |
+
&.open .vfb-accordion-section-title,
|
107 |
+
.vfb-accordion-section-title:hover,
|
108 |
+
.vfb-accordion-section-title:focus {
|
109 |
+
color: #222;
|
110 |
+
background: #f5f5f5;
|
111 |
+
}
|
112 |
+
|
113 |
+
&.open .vfb-accordion-section-title {
|
114 |
+
border-bottom: 1px solid #dfdfdf;
|
115 |
+
|
116 |
+
&:after {
|
117 |
+
content:'\f142';
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
.vfb-control-title {
|
122 |
+
display: block;
|
123 |
+
font-size: 14px;
|
124 |
+
line-height: 24px;
|
125 |
+
font-weight: 600;
|
126 |
+
margin-bottom: 5px;
|
127 |
+
}
|
128 |
+
|
129 |
+
select {
|
130 |
+
width: 95%;
|
131 |
+
height: 28px;
|
132 |
+
line-height: 28px;
|
133 |
+
}
|
134 |
+
|
135 |
+
input[type="radio"] {
|
136 |
+
line-height: 28px;
|
137 |
+
margin-right: 5px;
|
138 |
+
}
|
139 |
+
|
140 |
+
input[type="text"],
|
141 |
+
input[type="number"] {
|
142 |
+
width: 95%;
|
143 |
+
line-height: 18px;
|
144 |
+
margin: 0;
|
145 |
+
}
|
146 |
+
|
147 |
+
&.vfb-control-radio label {
|
148 |
+
line-height: 32px;
|
149 |
+
}
|
150 |
+
|
151 |
+
#vfb-forms-switcher {
|
152 |
+
width: 70%;
|
153 |
+
}
|
154 |
+
|
155 |
+
.wp-picker-container {
|
156 |
+
margin: 10px 0;
|
157 |
+
|
158 |
+
&.wp-picker-active .wp-picker-input-wrap {
|
159 |
+
display: block;
|
160 |
+
|
161 |
+
.wp-picker-default {
|
162 |
+
margin-left: 10px;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
}
|
admin/assets/css/sass/partials/_buttons.scss
CHANGED
@@ -1,206 +1,206 @@
|
|
1 |
.vfb-btn {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
|
45 |
.vfb-btn-primary {
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
}
|
73 |
|
74 |
.vfb-btn-inverse {
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
}
|
91 |
|
92 |
/* !Form Settings buttons */
|
93 |
.vfb-button {
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
}
|
110 |
|
111 |
.vfb-button:hover,
|
112 |
.vfb-button:active,
|
113 |
.vfb-button.current {
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
}
|
120 |
|
121 |
.vfb-button.current {
|
122 |
-
|
123 |
}
|
124 |
|
125 |
.vfb-button::-moz-focus-inner {
|
126 |
-
|
127 |
-
|
128 |
}
|
129 |
|
130 |
.vfb-button.vfb-settings:hover,
|
131 |
.vfb-button.vfb-settings:focus,
|
132 |
.vfb-button.vfb-settings:active {
|
133 |
-
|
134 |
}
|
135 |
|
136 |
.vfb-button.vfb-delete:hover,
|
137 |
.vfb-button.vfb-delete:focus,
|
138 |
.vfb-button.vfb-delete:active {
|
139 |
-
|
140 |
}
|
141 |
|
142 |
.vfb-button.vfb-duplicate:hover,
|
143 |
.vfb-button.vfb-duplicate:focus,
|
144 |
.vfb-button.vfb-duplicate:active {
|
145 |
-
|
146 |
}
|
147 |
|
148 |
|
149 |
|
150 |
.vfb-button-group {
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
}
|
155 |
|
156 |
.rtl .vfb-button-group {
|
157 |
-
|
158 |
}
|
159 |
|
160 |
.vfb-button-group .vfb-button {
|
161 |
-
|
162 |
-
|
163 |
}
|
164 |
|
165 |
.rtl .vfb-button-group .vfb-button {
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
}
|
170 |
|
171 |
.vfb-button-group .button-primary {
|
172 |
-
|
173 |
}
|
174 |
|
175 |
.vfb-item-actions {
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
}
|
180 |
|
181 |
.rtl .vfb-item-actions {
|
182 |
-
|
183 |
-
|
184 |
}
|
185 |
|
186 |
.vfb-item-actions .vfb-delete {
|
187 |
-
|
188 |
}
|
189 |
|
190 |
.rtl .vfb-item-actions .vfb-delete {
|
191 |
-
|
192 |
}
|
193 |
|
194 |
.vfb-item-actions .vfb-conditional-fields {
|
195 |
-
|
196 |
}
|
197 |
|
198 |
.rtl .vfb-item-actions .vfb-conditional-fields {
|
199 |
-
|
200 |
}
|
201 |
|
202 |
.vfb-item-actions .vfb-delete,
|
203 |
.vfb-item-actions .vfb-duplicate,
|
204 |
.vfb-item-actions .vfb-conditional-fields {
|
205 |
-
|
206 |
}
|
1 |
.vfb-btn {
|
2 |
+
font-size: 21px;
|
3 |
+
font-weight: 500;
|
4 |
+
line-height: 20px;
|
5 |
+
display: inline-block;
|
6 |
+
margin-bottom: 0;
|
7 |
+
padding: 15px 10px;
|
8 |
+
cursor: pointer;
|
9 |
+
text-align: center;
|
10 |
+
vertical-align: middle;
|
11 |
+
text-decoration: none;
|
12 |
+
color: #333333;
|
13 |
+
border: 1px solid #cccccc;
|
14 |
+
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
|
15 |
+
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
16 |
+
border-bottom-color: #b3b3b3;
|
17 |
+
border-radius: 6px;
|
18 |
+
background-color: #f5f5f5;
|
19 |
+
background-repeat: repeat-x;
|
20 |
+
box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.05);
|
21 |
+
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
|
22 |
+
|
23 |
+
&:hover,
|
24 |
+
&:focus {
|
25 |
+
transition: background-position 0.1s linear;
|
26 |
+
text-decoration: none;
|
27 |
+
color: #333333;
|
28 |
+
background-position: 0 -15px;
|
29 |
+
}
|
30 |
+
|
31 |
+
&:focus {
|
32 |
+
outline: thin dotted #333333;
|
33 |
+
outline: 5px auto -webkit-focus-ring-color;
|
34 |
+
outline-offset: -2px;
|
35 |
+
}
|
36 |
+
|
37 |
+
&.active,
|
38 |
+
&:active {
|
39 |
+
outline: 0;
|
40 |
+
background-image: none;
|
41 |
+
box-shadow: inset 0 2px 4px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.05);
|
42 |
+
}
|
43 |
}
|
44 |
|
45 |
.vfb-btn-primary {
|
46 |
+
color: #ffffff;
|
47 |
+
border-color: #0044cc #0044cc #002a80;
|
48 |
+
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
49 |
+
background-image: linear-gradient(to bottom, #0088cc, #0044cc);
|
50 |
+
background-color: #006dcc;
|
51 |
+
background-repeat: repeat-x;
|
52 |
+
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
53 |
+
|
54 |
+
&.active {
|
55 |
+
color: rgba(255, 255, 255, 0.75);
|
56 |
+
}
|
57 |
+
|
58 |
+
&:hover,
|
59 |
+
&:focus,
|
60 |
+
&:active,
|
61 |
+
&.active,
|
62 |
+
&.disabled,
|
63 |
+
&[disabled] {
|
64 |
+
color: #ffffff;
|
65 |
+
background-color: #0044cc;
|
66 |
+
}
|
67 |
+
|
68 |
+
&:active,
|
69 |
+
&.active {
|
70 |
+
background-color: #003399 \9;
|
71 |
+
}
|
72 |
}
|
73 |
|
74 |
.vfb-btn-inverse {
|
75 |
+
color: #ffffff;
|
76 |
+
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
77 |
+
background-color: #363636;
|
78 |
+
background-repeat: repeat-x;
|
79 |
+
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
80 |
+
|
81 |
+
&:hover,
|
82 |
+
&:focus,
|
83 |
+
&:active,
|
84 |
+
&.active,
|
85 |
+
&.disabled,
|
86 |
+
&[disabled] {
|
87 |
+
color: #ffffff;
|
88 |
+
background-color: #222222;
|
89 |
+
}
|
90 |
}
|
91 |
|
92 |
/* !Form Settings buttons */
|
93 |
.vfb-button {
|
94 |
+
font: 12px/normal sans-serif;
|
95 |
+
position: relative;
|
96 |
+
display: inline-block;
|
97 |
+
overflow: visible;
|
98 |
+
zoom: 1;
|
99 |
+
margin: 0;
|
100 |
+
padding: 0.5em 2.5em 0.5em 1em;
|
101 |
+
cursor: pointer;
|
102 |
+
white-space: nowrap;
|
103 |
+
text-decoration: none;
|
104 |
+
color: #333333;
|
105 |
+
border: 1px solid #d4d4d4;
|
106 |
+
border-radius: 0.2em;
|
107 |
+
outline: none;
|
108 |
+
background-color: #f5f5f5;
|
109 |
}
|
110 |
|
111 |
.vfb-button:hover,
|
112 |
.vfb-button:active,
|
113 |
.vfb-button.current {
|
114 |
+
color: #000000;
|
115 |
+
border-color: #929292;
|
116 |
+
border-bottom-color: #929292;
|
117 |
+
background-image: linear-gradient(#eeeeee, #cccccc);
|
118 |
+
background-color: #eeeeee;
|
119 |
}
|
120 |
|
121 |
.vfb-button.current {
|
122 |
+
font-weight: bold;
|
123 |
}
|
124 |
|
125 |
.vfb-button::-moz-focus-inner {
|
126 |
+
padding: 0;
|
127 |
+
border: 0;
|
128 |
}
|
129 |
|
130 |
.vfb-button.vfb-settings:hover,
|
131 |
.vfb-button.vfb-settings:focus,
|
132 |
.vfb-button.vfb-settings:active {
|
133 |
+
color: #3072b3;
|
134 |
}
|
135 |
|
136 |
.vfb-button.vfb-delete:hover,
|
137 |
.vfb-button.vfb-delete:focus,
|
138 |
.vfb-button.vfb-delete:active {
|
139 |
+
color: #990000;
|
140 |
}
|
141 |
|
142 |
.vfb-button.vfb-duplicate:hover,
|
143 |
.vfb-button.vfb-duplicate:focus,
|
144 |
.vfb-button.vfb-duplicate:active {
|
145 |
+
color: #008e0d;
|
146 |
}
|
147 |
|
148 |
|
149 |
|
150 |
.vfb-button-group {
|
151 |
+
display: inline-block;
|
152 |
+
margin: 10px 0;
|
153 |
+
list-style: none;
|
154 |
}
|
155 |
|
156 |
.rtl .vfb-button-group {
|
157 |
+
margin-left: -2px;
|
158 |
}
|
159 |
|
160 |
.vfb-button-group .vfb-button {
|
161 |
+
float: left;
|
162 |
+
margin-right: 5px;
|
163 |
}
|
164 |
|
165 |
.rtl .vfb-button-group .vfb-button {
|
166 |
+
float: right;
|
167 |
+
margin-right: 0;
|
168 |
+
margin-left: 5px;
|
169 |
}
|
170 |
|
171 |
.vfb-button-group .button-primary {
|
172 |
+
margin-top: 2px;
|
173 |
}
|
174 |
|
175 |
.vfb-item-actions {
|
176 |
+
margin-right: 10px;
|
177 |
+
margin-bottom: 10px;
|
178 |
+
text-align: center;
|
179 |
}
|
180 |
|
181 |
.rtl .vfb-item-actions {
|
182 |
+
margin-right: 0;
|
183 |
+
margin-left: 10px;
|
184 |
}
|
185 |
|
186 |
.vfb-item-actions .vfb-delete {
|
187 |
+
float: left;
|
188 |
}
|
189 |
|
190 |
.rtl .vfb-item-actions .vfb-delete {
|
191 |
+
float: right;
|
192 |
}
|
193 |
|
194 |
.vfb-item-actions .vfb-conditional-fields {
|
195 |
+
float: right;
|
196 |
}
|
197 |
|
198 |
.rtl .vfb-item-actions .vfb-conditional-fields {
|
199 |
+
float: left;
|
200 |
}
|
201 |
|
202 |
.vfb-item-actions .vfb-delete,
|
203 |
.vfb-item-actions .vfb-duplicate,
|
204 |
.vfb-item-actions .vfb-conditional-fields {
|
205 |
+
margin-top: 10px;
|
206 |
}
|
admin/assets/css/sass/partials/_confirmation.scss
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
#form-details-nav {
|
2 |
-
|
3 |
-
|
4 |
}
|
5 |
#form-details-nav a,
|
6 |
.charts-nav a {
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
}
|
11 |
|
12 |
#form-details-nav a.current,
|
13 |
.charts-nav a.current {
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
}
|
22 |
|
23 |
/* !Form Settings - Confirmation */
|
@@ -25,27 +25,27 @@
|
|
25 |
#form-success-message-text,
|
26 |
#form-success-message-page,
|
27 |
#form-success-message-redirect {
|
28 |
-
|
29 |
}
|
30 |
|
31 |
.form-details-current,
|
32 |
.active {
|
33 |
-
|
34 |
}
|
35 |
|
36 |
#confirmation-message textarea,
|
37 |
#notification textarea {
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
}
|
42 |
|
43 |
#form-success-message-page,
|
44 |
#form-success-message-redirect {
|
45 |
-
|
46 |
-
|
47 |
}
|
48 |
|
49 |
.post-body-plain ol li {
|
50 |
-
|
51 |
}
|
1 |
#form-details-nav {
|
2 |
+
font-size: 1.0em;
|
3 |
+
padding-top: 10px;
|
4 |
}
|
5 |
#form-details-nav a,
|
6 |
.charts-nav a {
|
7 |
+
font-weight: bold;
|
8 |
+
padding: 5px 10px;
|
9 |
+
text-decoration: none;
|
10 |
}
|
11 |
|
12 |
#form-details-nav a.current,
|
13 |
.charts-nav a.current {
|
14 |
+
height: 40px;
|
15 |
+
color: white;
|
16 |
+
border-color: #dfdfdf;
|
17 |
+
border-radius: 5px;
|
18 |
+
background-image: linear-gradient(bottom, #6d6d6d, #808080);
|
19 |
+
background-color: #777777;
|
20 |
+
text-shadow: 0 -1px 0 #333333;
|
21 |
}
|
22 |
|
23 |
/* !Form Settings - Confirmation */
|
25 |
#form-success-message-text,
|
26 |
#form-success-message-page,
|
27 |
#form-success-message-redirect {
|
28 |
+
display: none;
|
29 |
}
|
30 |
|
31 |
.form-details-current,
|
32 |
.active {
|
33 |
+
display: block;
|
34 |
}
|
35 |
|
36 |
#confirmation-message textarea,
|
37 |
#notification textarea {
|
38 |
+
font-family: Consolas,Monaco,monospace;
|
39 |
+
width: 100%;
|
40 |
+
height: 10em;
|
41 |
}
|
42 |
|
43 |
#form-success-message-page,
|
44 |
#form-success-message-redirect {
|
45 |
+
width: 100%;
|
46 |
+
margin-top: 10px;
|
47 |
}
|
48 |
|
49 |
.post-body-plain ol li {
|
50 |
+
list-style: decimal;
|
51 |
}
|
admin/assets/css/sass/partials/_cta.scss
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
.vfb-pro-call-to-action {
|
2 |
-
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
}
|
1 |
.vfb-pro-call-to-action {
|
2 |
+
padding: 5px 0;
|
3 |
+
text-align: center;
|
4 |
|
5 |
+
.cta-sign-up {
|
6 |
+
font-size: 24px;
|
7 |
+
font-weight: bold;
|
8 |
+
line-height: 22px;
|
9 |
+
display: block;
|
10 |
+
width: 100%;
|
11 |
+
text-align: center;
|
12 |
+
text-decoration: none;
|
13 |
+
color: #ffffff;
|
14 |
+
text-shadow: 1px 1px 1px #2b658c;
|
15 |
+
}
|
16 |
|
17 |
+
.cta-price {
|
18 |
+
font-size: 12px;
|
19 |
+
font-weight: normal;
|
20 |
+
line-height: 20px;
|
21 |
+
line-height: 20px;
|
22 |
+
display: block;
|
23 |
+
width: 100%;
|
24 |
+
text-align: center;
|
25 |
+
text-decoration: none;
|
26 |
+
color: #ace7ff;
|
27 |
+
}
|
28 |
}
|
admin/assets/css/sass/partials/_entries.scss
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
.vfb-meta-entries-total span,
|
2 |
.vfb-meta-entries-total-today span {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
}
|
15 |
|
16 |
.vfb-meta-entries-total:hover span,
|
17 |
.vfb-meta-entries-total-today:hover span {
|
18 |
-
|
19 |
}
|
20 |
.fixed .column-entries,
|
21 |
.fixed .column-form_id {
|
22 |
-
|
23 |
}
|
24 |
|
25 |
strong .vfb-meta-entries-total span {
|
26 |
-
|
27 |
}
|
28 |
|
29 |
.entries-count-wrapper {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
}
|
34 |
|
35 |
#vfb-poststuff {
|
36 |
-
|
37 |
-
|
38 |
}
|
39 |
|
40 |
.rtl #vfb-poststuff {
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
|
45 |
#vfb-entries-body-content {
|
46 |
-
|
47 |
-
|
48 |
}
|
49 |
|
50 |
.rtl #vfb-entries-body-content {
|
51 |
-
|
52 |
}
|
53 |
|
54 |
.metabox-holder #vfb-entries-body-content h3 {
|
55 |
-
|
56 |
-
|
57 |
}
|
58 |
|
59 |
#entry-edit #side-info-column {
|
60 |
-
|
61 |
}
|
62 |
|
63 |
.rtl #entry-edit #side-info-column {
|
64 |
-
|
65 |
-
|
66 |
}
|
1 |
.vfb-meta-entries-total span,
|
2 |
.vfb-meta-entries-total-today span {
|
3 |
+
font-size: 11px;
|
4 |
+
font-weight: bold;
|
5 |
+
line-height: 1.4em;
|
6 |
+
display: inline-block;
|
7 |
+
min-width: 0.7em;
|
8 |
+
height: 1.4em;
|
9 |
+
padding: 0 6px;
|
10 |
+
text-align: center;
|
11 |
+
color: white;
|
12 |
+
border-radius: 5px;
|
13 |
+
background-color: #bbbbbb;
|
14 |
}
|
15 |
|
16 |
.vfb-meta-entries-total:hover span,
|
17 |
.vfb-meta-entries-total-today:hover span {
|
18 |
+
background-color: #d54e21;
|
19 |
}
|
20 |
.fixed .column-entries,
|
21 |
.fixed .column-form_id {
|
22 |
+
width: 8em;
|
23 |
}
|
24 |
|
25 |
strong .vfb-meta-entries-total span {
|
26 |
+
background-color: #21759b;
|
27 |
}
|
28 |
|
29 |
.entries-count-wrapper {
|
30 |
+
font-family: sans-serif;
|
31 |
+
min-width: 22px;
|
32 |
+
padding-bottom: 1px;
|
33 |
}
|
34 |
|
35 |
#vfb-poststuff {
|
36 |
+
display: block;
|
37 |
+
margin-right: 300px;
|
38 |
}
|
39 |
|
40 |
.rtl #vfb-poststuff {
|
41 |
+
margin-right: 0;
|
42 |
+
margin-left: 300px;
|
43 |
}
|
44 |
|
45 |
#vfb-entries-body-content {
|
46 |
+
float: left;
|
47 |
+
width: 100%;
|
48 |
}
|
49 |
|
50 |
.rtl #vfb-entries-body-content {
|
51 |
+
float: right;
|
52 |
}
|
53 |
|
54 |
.metabox-holder #vfb-entries-body-content h3 {
|
55 |
+
font-family: sans-serif;
|
56 |
+
font-weight: bold;
|
57 |
}
|
58 |
|
59 |
#entry-edit #side-info-column {
|
60 |
+
margin-right: -300px;
|
61 |
}
|
62 |
|
63 |
.rtl #entry-edit #side-info-column {
|
64 |
+
margin-right: 0;
|
65 |
+
margin-left: -300px;
|
66 |
}
|
admin/assets/css/sass/partials/_export.scss
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
/* !Import/Export */
|
2 |
.vfb-export-label {
|
3 |
-
|
4 |
-
|
5 |
}
|
6 |
|
7 |
.rtl .vfb-export-label {
|
8 |
-
|
9 |
}
|
10 |
|
11 |
#vfb-export-entries-fields {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
}
|
22 |
|
23 |
#vfb-export-select-all,
|
24 |
#vfb-export-unselect-all {
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
}
|
29 |
|
30 |
#vfb-export-unselect-all {
|
31 |
-
|
32 |
-
|
33 |
}
|
1 |
/* !Import/Export */
|
2 |
.vfb-export-label {
|
3 |
+
float: left;
|
4 |
+
width: 10em;
|
5 |
}
|
6 |
|
7 |
.rtl .vfb-export-label {
|
8 |
+
float: right;
|
9 |
}
|
10 |
|
11 |
#vfb-export-entries-fields {
|
12 |
+
display: block;
|
13 |
+
overflow: auto;
|
14 |
+
width: 300px;
|
15 |
+
height: 275px;
|
16 |
+
margin-left: 10em;
|
17 |
+
padding: 5px;
|
18 |
+
border: 1px solid #e8e8e8;
|
19 |
+
border-radius: 3px;
|
20 |
+
background: white;
|
21 |
}
|
22 |
|
23 |
#vfb-export-select-all,
|
24 |
#vfb-export-unselect-all {
|
25 |
+
display: inline-block;
|
26 |
+
width: 150px;
|
27 |
+
text-align: left;
|
28 |
}
|
29 |
|
30 |
#vfb-export-unselect-all {
|
31 |
+
margin-left: 5px;
|
32 |
+
text-align: right;
|
33 |
}
|
admin/assets/css/sass/partials/_fields.scss
CHANGED
@@ -1,279 +1,279 @@
|
|
1 |
/* !Field Item arrows */
|
2 |
.item-edit {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
}
|
13 |
|
14 |
/* Blue Admin style */
|
15 |
.admin-color-classic .item-edit {
|
16 |
-
|
17 |
}
|
18 |
|
19 |
.rtl .item-edit {
|
20 |
-
|
21 |
-
|
22 |
}
|
23 |
|
24 |
.item-edit:hover {
|
25 |
-
|
26 |
}
|
27 |
|
28 |
/* Blue Admin style */
|
29 |
.admin-color-classic .item-edit:hover {
|
30 |
-
|
31 |
}
|
32 |
|
33 |
.item-edit.opened {
|
34 |
-
|
35 |
}
|
36 |
|
37 |
/* Blue Admin style */
|
38 |
.admin-color-classic .item-edit.opened {
|
39 |
-
|
40 |
}
|
41 |
|
42 |
.item-edit.opened:hover {
|
43 |
-
|
44 |
}
|
45 |
|
46 |
/* Blue Admin style */
|
47 |
.admin-color-classic .item-edit.opened:hover {
|
48 |
-
|
49 |
}
|
50 |
|
51 |
/* !Field Item attribute input styles */
|
52 |
.option .widefat,
|
53 |
.options-other-show .widefat,
|
54 |
.options-other-hide .widefat {
|
55 |
-
|
56 |
-
|
57 |
}
|
58 |
|
59 |
.rtl .option .widefat,
|
60 |
.rtl .options-other-show .widefat,
|
61 |
.rtl .options-other-hide .widefat {
|
62 |
-
|
63 |
}
|
64 |
|
65 |
#form-settings .description-thin {
|
66 |
-
|
67 |
}
|
68 |
|
69 |
.rtl #form-settings .description-thin {
|
70 |
-
|
71 |
}
|
72 |
|
73 |
.description-thin,
|
74 |
.description-wide {
|
75 |
-
|
76 |
-
|
77 |
}
|
78 |
|
79 |
.rtl .description-thin,
|
80 |
.rtl .description-wide {
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
}
|
85 |
|
86 |
.description-thin {
|
87 |
-
|
88 |
-
|
89 |
}
|
90 |
|
91 |
.description-wide {
|
92 |
-
|
93 |
}
|
94 |
|
95 |
#vfb-menu-to-edit .menu-item-settings {
|
96 |
-
|
97 |
}
|
98 |
|
99 |
.vfb-menu-item-handle {
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
}
|
113 |
|
114 |
.vfb-menu-item-handle:hover {
|
115 |
-
|
116 |
}
|
117 |
|
118 |
/* Blue Admin style */
|
119 |
.admin-color-classic .vfb-menu-item-handle {
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
}
|
124 |
|
125 |
.rtl .vfb-menu-item-handle {
|
126 |
-
|
127 |
-
|
128 |
}
|
129 |
|
130 |
.vfb-menu-item-type-fieldset,
|
131 |
.vfb-menu-item-type-verification,
|
132 |
#form-element-fieldset {
|
133 |
-
|
134 |
-
|
135 |
}
|
136 |
|
137 |
/* Blue Admin style */
|
138 |
.admin-color-classic .vfb-menu-item-type-fieldset,
|
139 |
.admin-color-classic .vfb-menu-item-type-verification,
|
140 |
.admin-color-classic #form-element-fieldset {
|
141 |
-
|
142 |
-
|
143 |
}
|
144 |
|
145 |
.vfb-menu-item-handle .item-title {
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
}
|
153 |
|
154 |
.rtl .vfb-menu-item-handle .item-title {
|
155 |
-
|
156 |
-
|
157 |
}
|
158 |
|
159 |
.vfb-menu-item-active .vfb-menu-item-handle {
|
160 |
-
|
161 |
-
|
162 |
}
|
163 |
|
164 |
.sender-labels {
|
165 |
-
|
166 |
}
|
167 |
|
168 |
.is-field-required {
|
169 |
-
|
170 |
}
|
171 |
|
172 |
.menu .ui-nestedSortable-error {
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
}
|
177 |
|
178 |
ul#vfb-menu-to-edit ul {
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
}
|
184 |
#vfb-menu-to-edit {
|
185 |
-
|
186 |
-
|
187 |
}
|
188 |
|
189 |
#vfb-fieldset-first-warning {
|
190 |
-
|
191 |
}
|
192 |
|
193 |
.ui-state-disabled,
|
194 |
.ui-state-disabled dl,
|
195 |
.ui-state-disabled dt,
|
196 |
.form-item.ui-state-disabled {
|
197 |
-
|
198 |
-
|
199 |
}
|
200 |
|
201 |
.ui-state-disabled .vfb-menu-item-handle,
|
202 |
.ui-state-disabled .menu-item-handle {
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
}
|
207 |
|
208 |
.vfb-details {
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
}
|
214 |
|
215 |
.vfb-details.section {
|
216 |
-
|
217 |
-
|
218 |
}
|
219 |
|
220 |
.vfb-details .postbox {
|
221 |
-
|
222 |
}
|
223 |
|
224 |
#poststuff .vfb-details h2 {
|
225 |
-
|
226 |
}
|
227 |
|
228 |
#poststuff h3.section-heading {
|
229 |
-
|
230 |
}
|
231 |
|
232 |
/* !Form Items */
|
233 |
#form-items .tabs-panel {
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
}
|
239 |
|
240 |
.rtl #form-items .tabs-panel {
|
241 |
-
|
242 |
}
|
243 |
|
244 |
ul.vfb-fields-col-1,
|
245 |
ul.vfb-fields-col-2 {
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
}
|
250 |
|
251 |
.rtl ul.vfb-fields-col-1,
|
252 |
.rtl ul.vfb-fields-col-2 {
|
253 |
-
|
254 |
}
|
255 |
|
256 |
#vfb-form-builder-frame.columns-1 #vfb-postbox-container-1 #form-items .tabs-panel {
|
257 |
-
|
258 |
}
|
259 |
|
260 |
.static-vars-inactive {
|
261 |
-
|
262 |
}
|
263 |
|
264 |
.static-vars-active {
|
265 |
-
|
266 |
}
|
267 |
|
268 |
/* !Bulk Add Options */
|
269 |
.vfb-add-options-group {
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
}
|
1 |
/* !Field Item arrows */
|
2 |
.item-edit {
|
3 |
+
position: absolute;
|
4 |
+
top: 3px;
|
5 |
+
right: -20px;
|
6 |
+
display: block;
|
7 |
+
overflow: hidden;
|
8 |
+
width: 30px;
|
9 |
+
height: 40px;
|
10 |
+
text-indent: -999em;
|
11 |
+
background: url('../img/arrows.png?d=20130703') no-repeat scroll 8px 10px transparent;
|
12 |
}
|
13 |
|
14 |
/* Blue Admin style */
|
15 |
.admin-color-classic .item-edit {
|
16 |
+
background: url('../img/arrows-vs.png?d=20130703') no-repeat scroll 8px 10px transparent;
|
17 |
}
|
18 |
|
19 |
.rtl .item-edit {
|
20 |
+
right: auto;
|
21 |
+
left: -20px;
|
22 |
}
|
23 |
|
24 |
.item-edit:hover {
|
25 |
+
background: url('../img/arrows-dark.png?d=20130703') no-repeat scroll 8px 10px transparent;
|
26 |
}
|
27 |
|
28 |
/* Blue Admin style */
|
29 |
.admin-color-classic .item-edit:hover {
|
30 |
+
background: url('../img/arrows-dark-vs.png?d=20130703') no-repeat scroll 8px 10px transparent;
|
31 |
}
|
32 |
|
33 |
.item-edit.opened {
|
34 |
+
background: url('../img/arrows.png?d=20130703') no-repeat scroll 8px -25px transparent;
|
35 |
}
|
36 |
|
37 |
/* Blue Admin style */
|
38 |
.admin-color-classic .item-edit.opened {
|
39 |
+
background: url('../img/arrows-vs.png?d=20130703') no-repeat scroll 8px -25px transparent;
|
40 |
}
|
41 |
|
42 |
.item-edit.opened:hover {
|
43 |
+
background: url('../img/arrows-dark.png?d=20130703') no-repeat scroll 8px -25px transparent;
|
44 |
}
|
45 |
|
46 |
/* Blue Admin style */
|
47 |
.admin-color-classic .item-edit.opened:hover {
|
48 |
+
background: url('../img/arrows-dark-vs.png?d=20130703') no-repeat scroll 8px -25px transparent;
|
49 |
}
|
50 |
|
51 |
/* !Field Item attribute input styles */
|
52 |
.option .widefat,
|
53 |
.options-other-show .widefat,
|
54 |
.options-other-hide .widefat {
|
55 |
+
width: 320px;
|
56 |
+
margin: 0 6px 7px 0;
|
57 |
}
|
58 |
|
59 |
.rtl .option .widefat,
|
60 |
.rtl .options-other-show .widefat,
|
61 |
.rtl .options-other-hide .widefat {
|
62 |
+
margin: 0 0 7px 6px;
|
63 |
}
|
64 |
|
65 |
#form-settings .description-thin {
|
66 |
+
margin: 12px 10px 12px 0;
|
67 |
}
|
68 |
|
69 |
.rtl #form-settings .description-thin {
|
70 |
+
margin: 12px 0 12px 10px;
|
71 |
}
|
72 |
|
73 |
.description-thin,
|
74 |
.description-wide {
|
75 |
+
float: left;
|
76 |
+
margin-right: 10px;
|
77 |
}
|
78 |
|
79 |
.rtl .description-thin,
|
80 |
.rtl .description-wide {
|
81 |
+
float: right;
|
82 |
+
margin-right: 0;
|
83 |
+
margin-left: 10px;
|
84 |
}
|
85 |
|
86 |
.description-thin {
|
87 |
+
width: 190px;
|
88 |
+
height: 40px;
|
89 |
}
|
90 |
|
91 |
.description-wide {
|
92 |
+
width: 390px;
|
93 |
}
|
94 |
|
95 |
#vfb-menu-to-edit .menu-item-settings {
|
96 |
+
width: 402px;
|
97 |
}
|
98 |
|
99 |
.vfb-menu-item-handle {
|
100 |
+
line-height: 35px;
|
101 |
+
position: relative;
|
102 |
+
overflow: hidden;
|
103 |
+
width: 382px;
|
104 |
+
height: auto;
|
105 |
+
padding: 10px 15px;
|
106 |
+
cursor: move;
|
107 |
+
word-wrap: break-word;
|
108 |
+
border: 1px solid #dfdfdf;
|
109 |
+
border-radius: 3px;
|
110 |
+
background: white;
|
111 |
+
text-shadow: 0 1px 0 #ffffff;
|
112 |
}
|
113 |
|
114 |
.vfb-menu-item-handle:hover {
|
115 |
+
border-color: #999999;
|
116 |
}
|
117 |
|
118 |
/* Blue Admin style */
|
119 |
.admin-color-classic .vfb-menu-item-handle {
|
120 |
+
border-color: #d0dfe9;
|
121 |
+
background: #f5fafd;
|
122 |
+
box-shadow: 0 1px 0 #ffffff inset;
|
123 |
}
|
124 |
|
125 |
.rtl .vfb-menu-item-handle {
|
126 |
+
padding-right: 10px;
|
127 |
+
padding-left: 0;
|
128 |
}
|
129 |
|
130 |
.vfb-menu-item-type-fieldset,
|
131 |
.vfb-menu-item-type-verification,
|
132 |
#form-element-fieldset {
|
133 |
+
background: #e3e3e3;
|
134 |
+
box-shadow: 0 1px 0 #e3e3e3 inset;
|
135 |
}
|
136 |
|
137 |
/* Blue Admin style */
|
138 |
.admin-color-classic .vfb-menu-item-type-fieldset,
|
139 |
.admin-color-classic .vfb-menu-item-type-verification,
|
140 |
.admin-color-classic #form-element-fieldset {
|
141 |
+
background: #e2f3ff;
|
142 |
+
box-shadow: 0 1px 0 #ffffff inset;
|
143 |
}
|
144 |
|
145 |
.vfb-menu-item-handle .item-title {
|
146 |
+
font-size: 12px;
|
147 |
+
font-weight: bold;
|
148 |
+
line-height: 20px;
|
149 |
+
display: block;
|
150 |
+
min-height: 20px;
|
151 |
+
margin-right: 13em;
|
152 |
}
|
153 |
|
154 |
.rtl .vfb-menu-item-handle .item-title {
|
155 |
+
margin-right: 0;
|
156 |
+
margin-left: 13em;
|
157 |
}
|
158 |
|
159 |
.vfb-menu-item-active .vfb-menu-item-handle {
|
160 |
+
border-bottom-right-radius: 0;
|
161 |
+
border-bottom-left-radius: 0;
|
162 |
}
|
163 |
|
164 |
.sender-labels {
|
165 |
+
width: 80px;
|
166 |
}
|
167 |
|
168 |
.is-field-required {
|
169 |
+
color: #bc1212;
|
170 |
}
|
171 |
|
172 |
.menu .ui-nestedSortable-error {
|
173 |
+
color: #8a1f11;
|
174 |
+
border-color: red;
|
175 |
+
background-color: #fbe3e4;
|
176 |
}
|
177 |
|
178 |
ul#vfb-menu-to-edit ul {
|
179 |
+
width: 98%;
|
180 |
+
margin: 0 0 0 25px;
|
181 |
+
padding: 0;
|
182 |
+
list-style-type: none;
|
183 |
}
|
184 |
#vfb-menu-to-edit {
|
185 |
+
margin-top: 0;
|
186 |
+
padding: 1em 0;
|
187 |
}
|
188 |
|
189 |
#vfb-fieldset-first-warning {
|
190 |
+
display: none;
|
191 |
}
|
192 |
|
193 |
.ui-state-disabled,
|
194 |
.ui-state-disabled dl,
|
195 |
.ui-state-disabled dt,
|
196 |
.form-item.ui-state-disabled {
|
197 |
+
opacity: 100;
|
198 |
+
background-image: none;
|
199 |
}
|
200 |
|
201 |
.ui-state-disabled .vfb-menu-item-handle,
|
202 |
.ui-state-disabled .menu-item-handle {
|
203 |
+
cursor: default;
|
204 |
+
background: #dfdfdf;
|
205 |
+
box-shadow: none;
|
206 |
}
|
207 |
|
208 |
.vfb-details {
|
209 |
+
margin-bottom: 10px;
|
210 |
+
padding: 0 10px;
|
211 |
+
border: 1px solid #cccccc;
|
212 |
+
border-radius: 3px;
|
213 |
}
|
214 |
|
215 |
.vfb-details.section {
|
216 |
+
width: 97.55%;
|
217 |
+
background-color: #efefef;
|
218 |
}
|
219 |
|
220 |
.vfb-details .postbox {
|
221 |
+
min-height: 60px;
|
222 |
}
|
223 |
|
224 |
#poststuff .vfb-details h2 {
|
225 |
+
margin-top: 0;
|
226 |
}
|
227 |
|
228 |
#poststuff h3.section-heading {
|
229 |
+
padding-left: 0;
|
230 |
}
|
231 |
|
232 |
/* !Form Items */
|
233 |
#form-items .tabs-panel {
|
234 |
+
overflow: visible;
|
235 |
+
height: auto;
|
236 |
+
min-height: 325px;
|
237 |
+
padding: 0.5em 0 0.5em 4px;
|
238 |
}
|
239 |
|
240 |
.rtl #form-items .tabs-panel {
|
241 |
+
padding: 0.5em 4px 0.5em 0;
|
242 |
}
|
243 |
|
244 |
ul.vfb-fields-col-1,
|
245 |
ul.vfb-fields-col-2 {
|
246 |
+
float: left;
|
247 |
+
width: 50%;
|
248 |
+
list-style: none;
|
249 |
}
|
250 |
|
251 |
.rtl ul.vfb-fields-col-1,
|
252 |
.rtl ul.vfb-fields-col-2 {
|
253 |
+
float: right;
|
254 |
}
|
255 |
|
256 |
#vfb-form-builder-frame.columns-1 #vfb-postbox-container-1 #form-items .tabs-panel {
|
257 |
+
height: auto;
|
258 |
}
|
259 |
|
260 |
.static-vars-inactive {
|
261 |
+
display: none;
|
262 |
}
|
263 |
|
264 |
.static-vars-active {
|
265 |
+
display: block;
|
266 |
}
|
267 |
|
268 |
/* !Bulk Add Options */
|
269 |
.vfb-add-options-group {
|
270 |
+
display: inline-block;
|
271 |
+
width: 95%;
|
272 |
+
margin: 10px 0;
|
273 |
+
list-style: none;
|
274 |
+
text-align: center;
|
275 |
+
|
276 |
+
.vfb-interface-plus {
|
277 |
+
top: 4px;
|
278 |
+
}
|
279 |
}
|
admin/assets/css/sass/partials/_form-edit.scss
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
/* !Form View framework */
|
2 |
#vfb-form-builder-frame {
|
3 |
-
|
4 |
-
|
5 |
}
|
6 |
|
7 |
.rtl #vfb-form-builder-frame {
|
8 |
-
|
9 |
}
|
10 |
|
11 |
#vfb-form-builder-frame:after,
|
@@ -14,352 +14,352 @@
|
|
14 |
#vfb-form-builder-frame .menu-item-settings:after,
|
15 |
#vfb-form-list:after,
|
16 |
.option:after {
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
}
|
23 |
|
24 |
#vfb-form-builder-sidebar {
|
25 |
-
|
26 |
-
|
27 |
}
|
28 |
|
29 |
#vfb-form-builder-management {
|
30 |
-
|
31 |
-
|
32 |
}
|
33 |
|
34 |
.rtl #vfb-form-builder-management {
|
35 |
-
|
36 |
-
|
37 |
}
|
38 |
|
39 |
#vfb-form-builder-management .form-edit {
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
}
|
44 |
|
45 |
/* Blue Admin style */
|
46 |
.admin-color-classic #vfb-form-builder-management .form-edit {
|
47 |
-
|
48 |
}
|
49 |
|
50 |
/* !Form Editor Header/Footer */
|
51 |
#form-editor-header,
|
52 |
#form-editor-footer {
|
53 |
-
|
54 |
-
|
55 |
}
|
56 |
|
57 |
#form-editor-footer {
|
58 |
-
|
59 |
}
|
60 |
|
61 |
/* Blue Admin style */
|
62 |
.admin-color-classic #form-editor-header,
|
63 |
.admin-color-classic #form-editor-footer {
|
64 |
-
|
65 |
}
|
66 |
|
67 |
.admin-color-class #form-editor-footer {
|
68 |
-
|
69 |
}
|
70 |
|
71 |
.vfb-major-publishing-actions {
|
72 |
-
|
73 |
-
|
74 |
}
|
75 |
|
76 |
.vfb-major-publishing-actions .publishing-action {
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
}
|
82 |
|
83 |
#form-editor-header .publishing-action {
|
84 |
-
|
85 |
}
|
86 |
|
87 |
/* Form Box view */
|
88 |
#vfb-sidebar,
|
89 |
#vfb-main {
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
}
|
94 |
|
95 |
.rtl #vfb-sidebar,
|
96 |
.rtl #vfb-main {
|
97 |
-
|
98 |
}
|
99 |
|
100 |
#vfb-main {
|
101 |
-
|
102 |
}
|
103 |
#vfb-main.vfb-order-type-list {
|
104 |
-
|
105 |
}
|
106 |
|
107 |
#vfb-main p a,
|
108 |
#vfb-main h3 a {
|
109 |
-
|
110 |
}
|
111 |
|
112 |
#vfb-main .submitdelete {
|
113 |
-
|
114 |
-
|
115 |
}
|
116 |
#vfb-main .submitdelete:hover {
|
117 |
-
|
118 |
}
|
119 |
|
120 |
#vfb-sidebar {
|
121 |
-
|
122 |
}
|
123 |
|
124 |
.rtl #vfb-sidebar {
|
125 |
-
|
126 |
-
|
127 |
}
|
128 |
|
129 |
#vfb-form-list {
|
130 |
-
|
131 |
-
|
132 |
}
|
133 |
|
134 |
.rtl #vfb-form-list {
|
135 |
-
|
136 |
-
|
137 |
}
|
138 |
|
139 |
/* !Form Boxes */
|
140 |
.vfb-box {
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
}
|
151 |
|
152 |
.vfb-form-alpha-list {
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
}
|
157 |
|
158 |
.rtl .vfb-form-alpha-list {
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
}
|
163 |
|
164 |
.vfb-form-alpha-list hr {
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
}
|
172 |
|
173 |
.vfb-form-alpha-group .letter,
|
174 |
.wrap h2.letter {
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
}
|
181 |
|
182 |
.vfb-form-alpha-form {
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
}
|
188 |
.vfb-form-alpha-form h3 {
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
}
|
195 |
|
196 |
.vfb-form-alpha-form .vfb-publishing-actions,
|
197 |
.vfb-form-alpha-form .vfb-form-meta {
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
}
|
202 |
|
203 |
.vfb-form-alpha-form .vfb-form-meta {
|
204 |
-
|
205 |
}
|
206 |
|
207 |
.vfb-form-alpha-form .vfb-publishing-actions p,
|
208 |
.vfb-form-alpha-form .vfb-form-meta p {
|
209 |
-
|
210 |
}
|
211 |
|
212 |
.vfb-form-alpha-form .vfb-form-meta,
|
213 |
.vfb-form-alpha-form .paypal {
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
}
|
218 |
|
219 |
.rtl .vfb-form-alpha-form .vfb-form-meta,
|
220 |
.rtl .vfb-form-alpha-form .paypal {
|
221 |
-
|
222 |
-
|
223 |
}
|
224 |
|
225 |
.vfb-sortable-placeholder {
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
}
|
233 |
|
234 |
#vfb-main .vfb-sortable-placeholder {
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
}
|
240 |
|
241 |
.rtl #vfb-main .vfb-sortable-placeholder {
|
242 |
-
|
243 |
}
|
244 |
|
245 |
#vfb-menu-to-edit .mjs-nestedSortable-error {
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
}
|
250 |
|
251 |
/* !Form Editor columns */
|
252 |
.vfb-postbox-container {
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
}
|
257 |
|
258 |
.rtl .vfb-postbox-container {
|
259 |
-
|
260 |
}
|
261 |
|
262 |
#vfb-postbox-container-1 .postbox {
|
263 |
-
|
264 |
}
|
265 |
|
266 |
#vfb-postbox-container-2 {
|
267 |
-
|
268 |
}
|
269 |
|
270 |
#vfb-form-builder-frame.columns-1 {
|
271 |
-
|
272 |
}
|
273 |
|
274 |
.rtl #vfb-form-builder-frame.columns-1 {
|
275 |
-
|
276 |
-
|
277 |
}
|
278 |
|
279 |
#vfb-form-builder-frame.columns-1 #vfb-postbox-container-1 {
|
280 |
-
|
281 |
}
|
282 |
|
283 |
#vfb-form-builder-frame.columns-1 #vfb-postbox-container-2 {
|
284 |
-
|
285 |
}
|
286 |
|
287 |
#vfb-form-builder-frame.columns-2 #vfb-postbox-container-3 {
|
288 |
-
|
289 |
}
|
290 |
|
291 |
#vfb-form-builder-frame.columns-2 #vfb-postbox-container-1,
|
292 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-1 {
|
293 |
-
|
294 |
-
|
295 |
}
|
296 |
|
297 |
.rtl #vfb-form-builder-frame.columns-2 #vfb-postbox-container-1,
|
298 |
.rtl #vfb-form-builder-frame.columns-3 #vfb-postbox-container-1 {
|
299 |
-
|
300 |
-
|
301 |
}
|
302 |
|
303 |
#vfb-form-builder-frame.columns-3 #vfb-form-builder-management {
|
304 |
-
|
305 |
}
|
306 |
|
307 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-2 {
|
308 |
-
|
309 |
}
|
310 |
|
311 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
}
|
316 |
|
317 |
.rtl #vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
318 |
-
|
319 |
-
|
320 |
}
|
321 |
|
322 |
#vfb-form-meta-preview iframe {
|
323 |
-
|
324 |
-
|
325 |
}
|
326 |
|
327 |
#vfb_form_media_button_tip input {
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
}
|
334 |
|
335 |
/* !Form Editor Columns - One Column */
|
336 |
@media only screen and (max-width: 799px) {
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
}
|
344 |
|
345 |
/* !Form Editor Columns - Two Columns */
|
346 |
@media only screen and (min-width: 800px) and (max-width: 1200px) {
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
}
|
360 |
/* !Form Editor Columns - Three Columns */
|
361 |
@media only screen and (min-width: 1600px) {
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
}
|
1 |
/* !Form View framework */
|
2 |
#vfb-form-builder-frame {
|
3 |
+
display: block;
|
4 |
+
margin: 0 -8px 0 290px;
|
5 |
}
|
6 |
|
7 |
.rtl #vfb-form-builder-frame {
|
8 |
+
margin: 0 290px 0 -8px;
|
9 |
}
|
10 |
|
11 |
#vfb-form-builder-frame:after,
|
14 |
#vfb-form-builder-frame .menu-item-settings:after,
|
15 |
#vfb-form-list:after,
|
16 |
.option:after {
|
17 |
+
display: block;
|
18 |
+
visibility: hidden;
|
19 |
+
clear: both;
|
20 |
+
height: 0;
|
21 |
+
content: '.';
|
22 |
}
|
23 |
|
24 |
#vfb-form-builder-sidebar {
|
25 |
+
clear: both;
|
26 |
+
width: 281px;
|
27 |
}
|
28 |
|
29 |
#vfb-form-builder-management {
|
30 |
+
position: relative;
|
31 |
+
margin-right: 10px;
|
32 |
}
|
33 |
|
34 |
.rtl #vfb-form-builder-management {
|
35 |
+
margin-right: 0;
|
36 |
+
margin-left: 10px;
|
37 |
}
|
38 |
|
39 |
#vfb-form-builder-management .form-edit {
|
40 |
+
margin-bottom: 20px;
|
41 |
+
border: 1px solid #dfdfdf;
|
42 |
+
border-radius: 3px;
|
43 |
}
|
44 |
|
45 |
/* Blue Admin style */
|
46 |
.admin-color-classic #vfb-form-builder-management .form-edit {
|
47 |
+
border-color: #d0dfe9;
|
48 |
}
|
49 |
|
50 |
/* !Form Editor Header/Footer */
|
51 |
#form-editor-header,
|
52 |
#form-editor-footer {
|
53 |
+
padding: 0 10px;
|
54 |
+
background-color: #f1f1f1;
|
55 |
}
|
56 |
|
57 |
#form-editor-footer {
|
58 |
+
border-top: 1px solid #dfdfdf;
|
59 |
}
|
60 |
|
61 |
/* Blue Admin style */
|
62 |
.admin-color-classic #form-editor-header,
|
63 |
.admin-color-classic #form-editor-footer {
|
64 |
+
background-color: #f5fafd;
|
65 |
}
|
66 |
|
67 |
.admin-color-class #form-editor-footer {
|
68 |
+
border-top-color: #d0dfe9;
|
69 |
}
|
70 |
|
71 |
.vfb-major-publishing-actions {
|
72 |
+
clear: both;
|
73 |
+
padding: 3px 0 5px;
|
74 |
}
|
75 |
|
76 |
.vfb-major-publishing-actions .publishing-action {
|
77 |
+
line-height: 23px;
|
78 |
+
float: right;
|
79 |
+
margin: 5px 0 1px;
|
80 |
+
text-align: right;
|
81 |
}
|
82 |
|
83 |
#form-editor-header .publishing-action {
|
84 |
+
margin-top: 12px;
|
85 |
}
|
86 |
|
87 |
/* Form Box view */
|
88 |
#vfb-sidebar,
|
89 |
#vfb-main {
|
90 |
+
float: left;
|
91 |
+
width: 280px;
|
92 |
+
margin: 10px 0;
|
93 |
}
|
94 |
|
95 |
.rtl #vfb-sidebar,
|
96 |
.rtl #vfb-main {
|
97 |
+
float: right;
|
98 |
}
|
99 |
|
100 |
#vfb-main {
|
101 |
+
width: auto;
|
102 |
}
|
103 |
#vfb-main.vfb-order-type-list {
|
104 |
+
width: 100%;
|
105 |
}
|
106 |
|
107 |
#vfb-main p a,
|
108 |
#vfb-main h3 a {
|
109 |
+
text-decoration: none;
|
110 |
}
|
111 |
|
112 |
#vfb-main .submitdelete {
|
113 |
+
text-decoration: none;
|
114 |
+
color: #bc0b0b;
|
115 |
}
|
116 |
#vfb-main .submitdelete:hover {
|
117 |
+
color: red;
|
118 |
}
|
119 |
|
120 |
#vfb-sidebar {
|
121 |
+
margin-left: -300px;
|
122 |
}
|
123 |
|
124 |
.rtl #vfb-sidebar {
|
125 |
+
margin-right: -300px;
|
126 |
+
margin-left: 0;
|
127 |
}
|
128 |
|
129 |
#vfb-form-list {
|
130 |
+
display: block;
|
131 |
+
margin-left: 300px;
|
132 |
}
|
133 |
|
134 |
.rtl #vfb-form-list {
|
135 |
+
margin-right: 300px;
|
136 |
+
margin-left: 0;
|
137 |
}
|
138 |
|
139 |
/* !Form Boxes */
|
140 |
.vfb-box {
|
141 |
+
line-height: 1.4em;
|
142 |
+
position: relative;
|
143 |
+
float: left;
|
144 |
+
padding: 0 10px;
|
145 |
+
border: 1px solid #dfdfdf;
|
146 |
+
border-radius: 3px 3px 3px 3px;
|
147 |
+
background: linear-gradient(to bottom, #ffffff 0%,#f5f5f5 100%);
|
148 |
+
background-color: #f5f5f5;
|
149 |
+
box-shadow: 0 1px 0 #ffffff inset;
|
150 |
}
|
151 |
|
152 |
.vfb-form-alpha-list {
|
153 |
+
float: left;
|
154 |
+
width: 70%;
|
155 |
+
padding-right: 20px;
|
156 |
}
|
157 |
|
158 |
.rtl .vfb-form-alpha-list {
|
159 |
+
float: right;
|
160 |
+
padding-right: 0;
|
161 |
+
padding-left: 20px;
|
162 |
}
|
163 |
|
164 |
.vfb-form-alpha-list hr {
|
165 |
+
display: block;
|
166 |
+
height: 1px;
|
167 |
+
margin: 1em 0;
|
168 |
+
padding: 0;
|
169 |
+
border: 0;
|
170 |
+
border-top: 1px solid #cccccc;
|
171 |
}
|
172 |
|
173 |
.vfb-form-alpha-group .letter,
|
174 |
.wrap h2.letter {
|
175 |
+
font-size: 14px;
|
176 |
+
line-height: 17px;
|
177 |
+
float: left;
|
178 |
+
padding: 0;
|
179 |
+
color: #666666;
|
180 |
}
|
181 |
|
182 |
.vfb-form-alpha-form {
|
183 |
+
display: block;
|
184 |
+
width: auto;
|
185 |
+
margin: 10px 0;
|
186 |
+
padding-left: 150px;
|
187 |
}
|
188 |
.vfb-form-alpha-form h3 {
|
189 |
+
font-size: 17px;
|
190 |
+
float: left;
|
191 |
+
width: 50%;
|
192 |
+
margin: 0;
|
193 |
+
word-wrap: break-word;
|
194 |
}
|
195 |
|
196 |
.vfb-form-alpha-form .vfb-publishing-actions,
|
197 |
.vfb-form-alpha-form .vfb-form-meta {
|
198 |
+
float: left;
|
199 |
+
width: 20%;
|
200 |
+
text-align: center;
|
201 |
}
|
202 |
|
203 |
.vfb-form-alpha-form .vfb-form-meta {
|
204 |
+
width: 30%;
|
205 |
}
|
206 |
|
207 |
.vfb-form-alpha-form .vfb-publishing-actions p,
|
208 |
.vfb-form-alpha-form .vfb-form-meta p {
|
209 |
+
margin: 0;
|
210 |
}
|
211 |
|
212 |
.vfb-form-alpha-form .vfb-form-meta,
|
213 |
.vfb-form-alpha-form .paypal {
|
214 |
+
float: left;
|
215 |
+
margin: 0;
|
216 |
+
text-align: left;
|
217 |
}
|
218 |
|
219 |
.rtl .vfb-form-alpha-form .vfb-form-meta,
|
220 |
.rtl .vfb-form-alpha-form .paypal {
|
221 |
+
float: right;
|
222 |
+
text-align: right;
|
223 |
}
|
224 |
|
225 |
.vfb-sortable-placeholder {
|
226 |
+
display: block;
|
227 |
+
width: 400px;
|
228 |
+
height: 35px;
|
229 |
+
margin: 8px;
|
230 |
+
border: 1px dashed #bbbbbb;
|
231 |
+
background-color: #f5f5f5;
|
232 |
}
|
233 |
|
234 |
#vfb-main .vfb-sortable-placeholder {
|
235 |
+
float: left;
|
236 |
+
width: 210px;
|
237 |
+
height: 200px;
|
238 |
+
margin: 8px;
|
239 |
}
|
240 |
|
241 |
.rtl #vfb-main .vfb-sortable-placeholder {
|
242 |
+
float: right;
|
243 |
}
|
244 |
|
245 |
#vfb-menu-to-edit .mjs-nestedSortable-error {
|
246 |
+
color: #8a1f11;
|
247 |
+
border-color: red;
|
248 |
+
background-color: #fbe3e4;
|
249 |
}
|
250 |
|
251 |
/* !Form Editor columns */
|
252 |
.vfb-postbox-container {
|
253 |
+
float: left;
|
254 |
+
width: 100%;
|
255 |
+
margin: 0 8px;
|
256 |
}
|
257 |
|
258 |
.rtl .vfb-postbox-container {
|
259 |
+
float: right;
|
260 |
}
|
261 |
|
262 |
#vfb-postbox-container-1 .postbox {
|
263 |
+
min-width: 281px;
|
264 |
}
|
265 |
|
266 |
#vfb-postbox-container-2 {
|
267 |
+
min-width: 485px;
|
268 |
}
|
269 |
|
270 |
#vfb-form-builder-frame.columns-1 {
|
271 |
+
margin-left: -8px;
|
272 |
}
|
273 |
|
274 |
.rtl #vfb-form-builder-frame.columns-1 {
|
275 |
+
margin-right: -8px;
|
276 |
+
margin-left: 0;
|
277 |
}
|
278 |
|
279 |
#vfb-form-builder-frame.columns-1 #vfb-postbox-container-1 {
|
280 |
+
float: none;
|
281 |
}
|
282 |
|
283 |
#vfb-form-builder-frame.columns-1 #vfb-postbox-container-2 {
|
284 |
+
width: 99%;
|
285 |
}
|
286 |
|
287 |
#vfb-form-builder-frame.columns-2 #vfb-postbox-container-3 {
|
288 |
+
display: none;
|
289 |
}
|
290 |
|
291 |
#vfb-form-builder-frame.columns-2 #vfb-postbox-container-1,
|
292 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-1 {
|
293 |
+
width: 281px;
|
294 |
+
margin-left: -290px;
|
295 |
}
|
296 |
|
297 |
.rtl #vfb-form-builder-frame.columns-2 #vfb-postbox-container-1,
|
298 |
.rtl #vfb-form-builder-frame.columns-3 #vfb-postbox-container-1 {
|
299 |
+
margin-right: -290px;
|
300 |
+
margin-left: 0;
|
301 |
}
|
302 |
|
303 |
#vfb-form-builder-frame.columns-3 #vfb-form-builder-management {
|
304 |
+
margin-right: 0;
|
305 |
}
|
306 |
|
307 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-2 {
|
308 |
+
width: 30%;
|
309 |
}
|
310 |
|
311 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
312 |
+
display: inline;
|
313 |
+
width: 46.5%;
|
314 |
+
margin-right: 0;
|
315 |
}
|
316 |
|
317 |
.rtl #vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
318 |
+
margin-right: 0;
|
319 |
+
margin-left: 0;
|
320 |
}
|
321 |
|
322 |
#vfb-form-meta-preview iframe {
|
323 |
+
width: 100%;
|
324 |
+
height: 100%;
|
325 |
}
|
326 |
|
327 |
#vfb_form_media_button_tip input {
|
328 |
+
font-family: Consolas, Monaco, monospace;
|
329 |
+
font-size: 12px;
|
330 |
+
width: 100%;
|
331 |
+
padding: 6px;
|
332 |
+
border: 0;
|
333 |
}
|
334 |
|
335 |
/* !Form Editor Columns - One Column */
|
336 |
@media only screen and (max-width: 799px) {
|
337 |
+
#vfb-form-builder-frame .vfb-postbox-container {
|
338 |
+
width: 100%;
|
339 |
+
}
|
340 |
+
.columns-prefs .columns-prefs-3 {
|
341 |
+
display: none;
|
342 |
+
}
|
343 |
}
|
344 |
|
345 |
/* !Form Editor Columns - Two Columns */
|
346 |
@media only screen and (min-width: 800px) and (max-width: 1200px) {
|
347 |
+
#vfb-form-builder-frame .vfb-postbox-container {
|
348 |
+
width: 49.5%;
|
349 |
+
}
|
350 |
|
351 |
+
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-2,
|
352 |
+
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
353 |
+
width: 50.5%;
|
354 |
+
}
|
355 |
|
356 |
+
#vfb-form-builder-frame.columns-1 .vfb-postbox-container {
|
357 |
+
width: 100%;
|
358 |
+
}
|
359 |
}
|
360 |
/* !Form Editor Columns - Three Columns */
|
361 |
@media only screen and (min-width: 1600px) {
|
362 |
+
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
363 |
+
width: 58%;
|
364 |
+
}
|
365 |
}
|
admin/assets/css/sass/partials/_form-new.scss
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
/* !New Form box */
|
2 |
#new-form {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
}
|
9 |
#new-form a {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
}
|
14 |
|
15 |
#post-body {
|
16 |
-
|
17 |
-
|
18 |
}
|
1 |
/* !New Form box */
|
2 |
#new-form {
|
3 |
+
width: 75px;
|
4 |
+
height: 105px;
|
5 |
+
margin: 8px 0;
|
6 |
+
padding-top: 10px;
|
7 |
+
text-align: center;
|
8 |
}
|
9 |
#new-form a {
|
10 |
+
display: block;
|
11 |
+
width: auto;
|
12 |
+
text-decoration: none;
|
13 |
}
|
14 |
|
15 |
#post-body {
|
16 |
+
padding: 10px;
|
17 |
+
background: white;
|
18 |
}
|
admin/assets/css/sass/partials/_icons.scss
CHANGED
@@ -1,68 +1,68 @@
|
|
1 |
/* Interface icons */
|
2 |
.vfb-interface-icon {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
}
|
14 |
|
15 |
.vfb-interface-settings {
|
16 |
-
|
17 |
}
|
18 |
.vfb-interface-duplicate {
|
19 |
-
|
20 |
}
|
21 |
.vfb-interface-trash {
|
22 |
-
|
23 |
}
|
24 |
.vfb-interface-conditional {
|
25 |
-
|
26 |
}
|
27 |
.vfb-interface-sort {
|
28 |
-
|
29 |
}
|
30 |
.vfb-interface-plus {
|
31 |
-
|
32 |
}
|
33 |
.vfb-interface-minus {
|
34 |
-
|
35 |
}
|
36 |
.vfb-interface-bulk-add {
|
37 |
-
|
38 |
}
|
39 |
|
40 |
.vfb-interface-plus,
|
41 |
.vfb-interface-minus {
|
42 |
-
|
43 |
}
|
44 |
|
45 |
/* Form Settings add/delete emails */
|
46 |
.addEmail,
|
47 |
.deleteEmail {
|
48 |
-
|
49 |
}
|
50 |
.addEmail {
|
51 |
-
|
52 |
}
|
53 |
|
54 |
.rtl .addEmail {
|
55 |
-
|
56 |
-
|
57 |
}
|
58 |
|
59 |
.deleteEmail {
|
60 |
-
|
61 |
}
|
62 |
|
63 |
.rtl .deleteEmail {
|
64 |
-
|
65 |
-
|
66 |
}
|
67 |
|
68 |
/* Form item delete/sort options */
|
@@ -70,164 +70,164 @@
|
|
70 |
.vfb-interface-sort,
|
71 |
.addCondition,
|
72 |
.deleteCondition {
|
73 |
-
|
74 |
}
|
75 |
|
76 |
.deleteOption,
|
77 |
.addCondition {
|
78 |
-
|
79 |
}
|
80 |
|
81 |
.rtl .deleteOption,
|
82 |
.rtl .addCondition {
|
83 |
-
|
84 |
-
|
85 |
}
|
86 |
|
87 |
.vfb-interface-sort,
|
88 |
.deleteCondition {
|
89 |
-
|
90 |
}
|
91 |
|
92 |
.rtl .vfb-interface-sort,
|
93 |
.rtl .deleteCondition {
|
94 |
-
|
95 |
-
|
96 |
}
|
97 |
|
98 |
.vfb-interface-sort:hover {
|
99 |
-
|
100 |
}
|
101 |
|
102 |
.option {
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
}
|
107 |
|
108 |
.rtl .option {
|
109 |
-
|
110 |
}
|
111 |
|
112 |
.vfb-draggable-form-items {
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
}
|
125 |
|
126 |
.rtl .vfb-draggable-form-items {
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
}
|
131 |
|
132 |
.vfb-draggable-form-items:hover {
|
133 |
-
|
134 |
}
|
135 |
|
136 |
.vfb-draggable-form-items b {
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
}
|
147 |
|
148 |
.rtl .vfb-draggable-form-items b {
|
149 |
-
|
150 |
-
|
151 |
}
|
152 |
|
153 |
#form-element-address b {
|
154 |
-
|
155 |
}
|
156 |
#form-element-autocomplete b {
|
157 |
-
|
158 |
}
|
159 |
#form-element-checkbox b {
|
160 |
-
|
161 |
}
|
162 |
#form-element-color b {
|
163 |
-
|
164 |
}
|
165 |
#form-element-currency b {
|
166 |
-
|
167 |
}
|
168 |
#form-element-datepicker b {
|
169 |
-
|
170 |
}
|
171 |
#form-element-digits b {
|
172 |
-
|
173 |
}
|
174 |
#form-element-email b {
|
175 |
-
|
176 |
}
|
177 |
#form-element-file b {
|
178 |
-
|
179 |
}
|
180 |
#form-element-hidden b {
|
181 |
-
|
182 |
}
|
183 |
#form-element-html b {
|
184 |
-
|
185 |
}
|
186 |
#form-element-instructions b {
|
187 |
-
|
188 |
}
|
189 |
#form-element-ip b {
|
190 |
-
|
191 |
}
|
192 |
#form-element-max b {
|
193 |
-
|
194 |
}
|
195 |
#form-element-min b {
|
196 |
-
|
197 |
}
|
198 |
#form-element-name b {
|
199 |
-
|
200 |
}
|
201 |
#form-element-pagebreak b {
|
202 |
-
|
203 |
}
|
204 |
#form-element-password b {
|
205 |
-
|
206 |
}
|
207 |
#form-element-phone b {
|
208 |
-
|
209 |
}
|
210 |
#form-element-radio b {
|
211 |
-
|
212 |
}
|
213 |
#form-element-range b {
|
214 |
-
|
215 |
}
|
216 |
#form-element-select b {
|
217 |
-
|
218 |
}
|
219 |
#form-element-text b {
|
220 |
-
|
221 |
}
|
222 |
#form-element-textarea b {
|
223 |
-
|
224 |
}
|
225 |
#form-element-time b {
|
226 |
-
|
227 |
}
|
228 |
#form-element-username b {
|
229 |
-
|
230 |
}
|
231 |
#form-element-url b {
|
232 |
-
|
233 |
}
|
1 |
/* Interface icons */
|
2 |
.vfb-interface-icon {
|
3 |
+
position: absolute;
|
4 |
+
top: 4px;
|
5 |
+
right: 4px;
|
6 |
+
display: inline-block;
|
7 |
+
width: 16px;
|
8 |
+
height: 16px;
|
9 |
+
text-indent: -9999px;
|
10 |
+
background-image: url('../img/vfb-interface-icons.png?d=20130713');
|
11 |
+
background-color: transparent;
|
12 |
+
background-repeat: no-repeat;
|
13 |
}
|
14 |
|
15 |
.vfb-interface-settings {
|
16 |
+
background-position: -32px 0;
|
17 |
}
|
18 |
.vfb-interface-duplicate {
|
19 |
+
background-position: 0 0;
|
20 |
}
|
21 |
.vfb-interface-trash {
|
22 |
+
background-position: -64px 0;
|
23 |
}
|
24 |
.vfb-interface-conditional {
|
25 |
+
background-position: -224px 0;
|
26 |
}
|
27 |
.vfb-interface-sort {
|
28 |
+
background-position: -128px 0;
|
29 |
}
|
30 |
.vfb-interface-plus {
|
31 |
+
background-position: -160px 0;
|
32 |
}
|
33 |
.vfb-interface-minus {
|
34 |
+
background-position: -192px 0;
|
35 |
}
|
36 |
.vfb-interface-bulk-add {
|
37 |
+
background-position: -96px 0;
|
38 |
}
|
39 |
|
40 |
.vfb-interface-plus,
|
41 |
.vfb-interface-minus {
|
42 |
+
top: 0;
|
43 |
}
|
44 |
|
45 |
/* Form Settings add/delete emails */
|
46 |
.addEmail,
|
47 |
.deleteEmail {
|
48 |
+
top: 28px;
|
49 |
}
|
50 |
.addEmail {
|
51 |
+
right: 55px;
|
52 |
}
|
53 |
|
54 |
.rtl .addEmail {
|
55 |
+
right: auto;
|
56 |
+
left: 55px;
|
57 |
}
|
58 |
|
59 |
.deleteEmail {
|
60 |
+
right: 30px;
|
61 |
}
|
62 |
|
63 |
.rtl .deleteEmail {
|
64 |
+
right: auto;
|
65 |
+
left: 30px;
|
66 |
}
|
67 |
|
68 |
/* Form item delete/sort options */
|
70 |
.vfb-interface-sort,
|
71 |
.addCondition,
|
72 |
.deleteCondition {
|
73 |
+
top: 3px;
|
74 |
}
|
75 |
|
76 |
.deleteOption,
|
77 |
.addCondition {
|
78 |
+
right: 25px;
|
79 |
}
|
80 |
|
81 |
.rtl .deleteOption,
|
82 |
.rtl .addCondition {
|
83 |
+
right: auto;
|
84 |
+
left: 25px;
|
85 |
}
|
86 |
|
87 |
.vfb-interface-sort,
|
88 |
.deleteCondition {
|
89 |
+
right: 0;
|
90 |
}
|
91 |
|
92 |
.rtl .vfb-interface-sort,
|
93 |
.rtl .deleteCondition {
|
94 |
+
right: auto;
|
95 |
+
left: 0;
|
96 |
}
|
97 |
|
98 |
.vfb-interface-sort:hover {
|
99 |
+
cursor: pointer;
|
100 |
}
|
101 |
|
102 |
.option {
|
103 |
+
position: relative;
|
104 |
+
float: left;
|
105 |
+
width: 97%;
|
106 |
}
|
107 |
|
108 |
.rtl .option {
|
109 |
+
float: right;
|
110 |
}
|
111 |
|
112 |
.vfb-draggable-form-items {
|
113 |
+
font-size: 12px;
|
114 |
+
position: relative;
|
115 |
+
position: relative;
|
116 |
+
display: block;
|
117 |
+
margin-right: 8px;
|
118 |
+
padding: 4px 0 4px 34px;
|
119 |
+
text-align: left;
|
120 |
+
text-decoration: none;
|
121 |
+
color: #464646;
|
122 |
+
border: 1px solid #bbbbbb;
|
123 |
+
border-radius: 3px;
|
124 |
}
|
125 |
|
126 |
.rtl .vfb-draggable-form-items {
|
127 |
+
margin-right: 0;
|
128 |
+
margin-left: 8px;
|
129 |
+
padding: 4px 34px 4px 10px;
|
130 |
}
|
131 |
|
132 |
.vfb-draggable-form-items:hover {
|
133 |
+
border-color: #aaaaaa;
|
134 |
}
|
135 |
|
136 |
.vfb-draggable-form-items b {
|
137 |
+
line-height: 16px;
|
138 |
+
position: absolute;
|
139 |
+
left: 8px;
|
140 |
+
display: inline-block;
|
141 |
+
width: 16px;
|
142 |
+
height: 16px;
|
143 |
+
background-image: url('../img/vfb-form-items.png?d=20130712');
|
144 |
+
background-color: transparent;
|
145 |
+
background-repeat: no-repeat;
|
146 |
}
|
147 |
|
148 |
.rtl .vfb-draggable-form-items b {
|
149 |
+
right: 8px;
|
150 |
+
left: auto;
|
151 |
}
|
152 |
|
153 |
#form-element-address b {
|
154 |
+
background-position: -128px 0;
|
155 |
}
|
156 |
#form-element-autocomplete b {
|
157 |
+
background-position: -384px 0;
|
158 |
}
|
159 |
#form-element-checkbox b {
|
160 |
+
background-position: -672px 0;
|
161 |
}
|
162 |
#form-element-color b {
|
163 |
+
background-position: 0 0;
|
164 |
}
|
165 |
#form-element-currency b {
|
166 |
+
background-position: -64px 0;
|
167 |
}
|
168 |
#form-element-datepicker b {
|
169 |
+
background-position: -224px 0;
|
170 |
}
|
171 |
#form-element-digits b {
|
172 |
+
background-position: -832px 0;
|
173 |
}
|
174 |
#form-element-email b {
|
175 |
+
background-position: -160px 0;
|
176 |
}
|
177 |
#form-element-file b {
|
178 |
+
background-position: -512px 0;
|
179 |
}
|
180 |
#form-element-hidden b {
|
181 |
+
background-position: -544px 0;
|
182 |
}
|
183 |
#form-element-html b {
|
184 |
+
background-position: -800px 0;
|
185 |
}
|
186 |
#form-element-instructions b {
|
187 |
+
background-position: -256px 0;
|
188 |
}
|
189 |
#form-element-ip b {
|
190 |
+
background-position: -448px 0;
|
191 |
}
|
192 |
#form-element-max b {
|
193 |
+
background-position: -576px 0;
|
194 |
}
|
195 |
#form-element-min b {
|
196 |
+
background-position: -608px 0;
|
197 |
}
|
198 |
#form-element-name b {
|
199 |
+
background-position: -320px 0;
|
200 |
}
|
201 |
#form-element-pagebreak b {
|
202 |
+
background-position: -768px 0;
|
203 |
}
|
204 |
#form-element-password b {
|
205 |
+
background-position: -352px 0;
|
206 |
}
|
207 |
#form-element-phone b {
|
208 |
+
background-position: -96px 0;
|
209 |
}
|
210 |
#form-element-radio b {
|
211 |
+
background-position: -704px 0;
|
212 |
}
|
213 |
#form-element-range b {
|
214 |
+
background-position: -640px 0;
|
215 |
}
|
216 |
#form-element-select b {
|
217 |
+
background-position: -416px 0;
|
218 |
}
|
219 |
#form-element-text b {
|
220 |
+
background-position: -736px 0;
|
221 |
}
|
222 |
#form-element-textarea b {
|
223 |
+
background-position: -32px 0;
|
224 |
}
|
225 |
#form-element-time b {
|
226 |
+
background-position: -192px 0;
|
227 |
}
|
228 |
#form-element-username b {
|
229 |
+
background-position: -288px 0;
|
230 |
}
|
231 |
#form-element-url b {
|
232 |
+
background-position: -480px 0;
|
233 |
}
|
admin/assets/css/sass/partials/_notices.scss
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
.vfb-notices {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
}
|
8 |
.vfb-notices.vfb-notice-success {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
}
|
13 |
|
14 |
.vfb-notices.vfb-notice-info {
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
}
|
19 |
|
20 |
.vfb-notices.vfb-notice-warning {
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
}
|
25 |
|
26 |
.vfb-notices.vfb-notice-danger {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
|
32 |
.vfb-notices h3 {
|
33 |
-
|
34 |
-
|
35 |
}
|
1 |
.vfb-notices {
|
2 |
+
margin-top: 10px;
|
3 |
+
margin-bottom: 20px;
|
4 |
+
padding: 15px;
|
5 |
+
border: 1px solid transparent;
|
6 |
+
border-radius: 4px;
|
7 |
}
|
8 |
.vfb-notices.vfb-notice-success {
|
9 |
+
color: #3c763d;
|
10 |
+
border-color: #d6e9c6;
|
11 |
+
background-color: #dff0d8;
|
12 |
}
|
13 |
|
14 |
.vfb-notices.vfb-notice-info {
|
15 |
+
color: #31708f;
|
16 |
+
border-color: #bce8f1;
|
17 |
+
background-color: #d9edf7;
|
18 |
}
|
19 |
|
20 |
.vfb-notices.vfb-notice-warning {
|
21 |
+
color: #8a6d3b;
|
22 |
+
border-color: #faebcc;
|
23 |
+
background-color: #fcf8e3;
|
24 |
}
|
25 |
|
26 |
.vfb-notices.vfb-notice-danger {
|
27 |
+
color: #a94442;
|
28 |
+
border-color: #ebccd1;
|
29 |
+
background-color: #f2dede;
|
30 |
}
|
31 |
|
32 |
.vfb-notices h3 {
|
33 |
+
margin-top: 0;
|
34 |
+
color: inherit;
|
35 |
}
|
admin/assets/css/sass/partials/_print.scss
CHANGED
@@ -1,96 +1,96 @@
|
|
1 |
@media print {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
}
|
95 |
|
96 |
/* !HiDPI Displays */
|
@@ -98,93 +98,93 @@
|
|
98 |
(-o-min-device-pixel-ratio: 5/4),
|
99 |
(-webkit-min-device-pixel-ratio: 1.25),
|
100 |
(min-resolution: 120dpi) {
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
}
|
1 |
@media print {
|
2 |
+
body * {
|
3 |
+
float: none;
|
4 |
+
}
|
5 |
+
|
6 |
+
html,
|
7 |
+
.wrap,
|
8 |
+
#wpbody-content,
|
9 |
+
#vfb-poststuff {
|
10 |
+
height: auto;
|
11 |
+
margin: 0;
|
12 |
+
padding: 0;
|
13 |
+
background: none !important;
|
14 |
+
}
|
15 |
+
|
16 |
+
#wpadminbar,
|
17 |
+
#adminmenuwrap,
|
18 |
+
#adminmenushadow,
|
19 |
+
#adminmenuback,
|
20 |
+
.screen-reader-shortcut,
|
21 |
+
#screen-meta,
|
22 |
+
#screen-meta-links,
|
23 |
+
#wpfooter,
|
24 |
+
#icon-options-general,
|
25 |
+
.wrap h2,
|
26 |
+
.view-entry,
|
27 |
+
#major-publishing-actions,
|
28 |
+
.clear {
|
29 |
+
display: none;
|
30 |
+
}
|
31 |
+
|
32 |
+
#wpcontent,
|
33 |
+
body #wpcontent {
|
34 |
+
width: auto;
|
35 |
+
height: auto;
|
36 |
+
margin-left: 0;
|
37 |
+
}
|
38 |
+
|
39 |
+
#entry-edit h3 span {
|
40 |
+
font-size: 23px;
|
41 |
+
font-weight: normal;
|
42 |
+
}
|
43 |
+
|
44 |
+
#vfb-poststuff {
|
45 |
+
page-break-after: auto;
|
46 |
+
}
|
47 |
+
|
48 |
+
#vfb-entries-body-content {
|
49 |
+
width: 100%;
|
50 |
+
height: auto;
|
51 |
+
margin: 0 0 50px 0;
|
52 |
+
padding: 0;
|
53 |
+
}
|
54 |
+
|
55 |
+
#side-info-column {
|
56 |
+
float: none;
|
57 |
+
width: 100%;
|
58 |
+
height: auto;
|
59 |
+
}
|
60 |
+
|
61 |
+
#side-info-column .postbox .inside {
|
62 |
+
margin: 0;
|
63 |
+
padding: 0;
|
64 |
+
}
|
65 |
+
|
66 |
+
#minor-publishing,
|
67 |
+
.misc-pub-section,
|
68 |
+
#submitdiv,
|
69 |
+
#submitdiv h3 {
|
70 |
+
margin: 0;
|
71 |
+
border: none;
|
72 |
+
background: none !important;
|
73 |
+
}
|
74 |
+
|
75 |
+
#submitdiv h3 span {
|
76 |
+
font-family: sans-serif;
|
77 |
+
font-size: 16px;
|
78 |
+
}
|
79 |
+
|
80 |
+
.inner-sidebar #side-sortables,
|
81 |
+
.columns-2 .inner-sidebar #side-sortables {
|
82 |
+
width: auto;
|
83 |
+
margin: 0;
|
84 |
+
padding: 0;
|
85 |
+
}
|
86 |
+
|
87 |
+
table {
|
88 |
+
page-break-inside: auto;
|
89 |
+
}
|
90 |
+
|
91 |
+
tr textarea {
|
92 |
+
overflow: visible;
|
93 |
+
}
|
94 |
}
|
95 |
|
96 |
/* !HiDPI Displays */
|
98 |
(-o-min-device-pixel-ratio: 5/4),
|
99 |
(-webkit-min-device-pixel-ratio: 1.25),
|
100 |
(min-resolution: 120dpi) {
|
101 |
+
/* Interface icons */
|
102 |
+
.vfb-interface-icon {
|
103 |
+
top: 5px;
|
104 |
+
background-image: url( '../img/vfb-interface-icons-2x.png?d=20130712' );
|
105 |
+
background-size: cover;
|
106 |
+
}
|
107 |
+
|
108 |
+
/* Form items */
|
109 |
+
.vfb-draggable-form-items b {
|
110 |
+
background-image: url( '../img/vfb-form-items-2x.png?d=20130712' );
|
111 |
+
background-size: cover;
|
112 |
+
}
|
113 |
+
|
114 |
+
.vfb-add-options-group .vfb-interface-plus {
|
115 |
+
top: 5px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.addEmail,
|
119 |
+
.deleteEmail {
|
120 |
+
top: 28px;
|
121 |
+
}
|
122 |
+
|
123 |
+
/* Field Item arrows */
|
124 |
+
.item-edit {
|
125 |
+
background-image: url('../img/arrows-2x.png?d=20130611');
|
126 |
+
background-size: 15px 123px;
|
127 |
+
}
|
128 |
+
|
129 |
+
/* Blue Admin style */
|
130 |
+
.admin-color-classic .item-edit {
|
131 |
+
background-image: url('../img/arrows-vs-2x.png?d=20130611');
|
132 |
+
background-size: 15px 123px;
|
133 |
+
}
|
134 |
+
|
135 |
+
.item-edit:hover {
|
136 |
+
background-image: url('../img/arrows-dark-2x.png?d=20130611');
|
137 |
+
background-size: 15px 123px;
|
138 |
+
}
|
139 |
+
|
140 |
+
/* Blue Admin style */
|
141 |
+
.admin-color-classic .item-edit:hover {
|
142 |
+
background-image: url('../img/arrows-dark-vs-2x.png?d=20130611');
|
143 |
+
background-size: 15px 123px;
|
144 |
+
}
|
145 |
+
|
146 |
+
.item-edit.opened {
|
147 |
+
background-image: url('../img/arrows-2x.png?d=20130611');
|
148 |
+
background-size: 15px 123px;
|
149 |
+
}
|
150 |
+
|
151 |
+
/* Blue Admin style */
|
152 |
+
.admin-color-classic .item-edit.opened {
|
153 |
+
background-image: url('../img/arrows-vs-2x.png?d=20130611');
|
154 |
+
background-size: 15px 123px;
|
155 |
+
}
|
156 |
+
|
157 |
+
.item-edit.opened:hover {
|
158 |
+
background-image: url('../img/arrows-dark-2x.png?d=20130611');
|
159 |
+
background-size: 15px 123px;
|
160 |
+
}
|
161 |
+
|
162 |
+
/* Blue Admin style */
|
163 |
+
.admin-color-classic .item-edit.opened:hover {
|
164 |
+
background-image: url('../img/arrows-dark-vs-2x.png?d=20130611');
|
165 |
+
background-size: 15px 123px;
|
166 |
+
}
|
167 |
+
|
168 |
+
/* Form Settings arrow */
|
169 |
+
.button-icon.vfb-small-arrow {
|
170 |
+
background-image: url('../img/arrows-2x.png?d=20130611');
|
171 |
+
background-size: 15px 123px;
|
172 |
+
}
|
173 |
+
|
174 |
+
/* Blue Admin style */
|
175 |
+
.admin-color-classic .button-icon.vfb-small-arrow {
|
176 |
+
background-image: url('../img/arrows-vs-2x.png?d=20130611');
|
177 |
+
background-size: 15px 123px;
|
178 |
+
}
|
179 |
+
|
180 |
+
.current .button-icon.vfb-small-arrow {
|
181 |
+
background-image: url('../img/arrows-2x.png?d=20130611');
|
182 |
+
background-size: 15px 123px;
|
183 |
+
}
|
184 |
+
|
185 |
+
/* Blue Admin style */
|
186 |
+
.admin-color-classic .current .button-icon.vfb-small-arrow {
|
187 |
+
background-image: url('../img/arrows-vs.png?d=20130611');
|
188 |
+
background-size: 15px 123px;
|
189 |
+
}
|
190 |
}
|
admin/assets/css/sass/partials/_subnav.scss
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
/* !Subnavigation links */
|
2 |
.sub-navigation {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
}
|
1 |
/* !Subnavigation links */
|
2 |
.sub-navigation {
|
3 |
+
font-size: 12px;
|
4 |
+
float: none;
|
5 |
+
margin: 8px 0 5px;
|
6 |
+
padding: 0;
|
7 |
+
list-style: none;
|
8 |
+
white-space: nowrap;
|
9 |
|
10 |
+
li {
|
11 |
+
display: inline;
|
12 |
+
margin: 0;
|
13 |
+
padding: 0;
|
14 |
+
}
|
15 |
|
16 |
+
a {
|
17 |
+
line-height: 2;
|
18 |
+
padding: 0.2em;
|
19 |
+
text-decoration: none;
|
20 |
|
21 |
+
&:hover {
|
22 |
+
color: rgb(213,78,33);
|
23 |
+
}
|
24 |
|
25 |
+
&.current {
|
26 |
+
font-weight: bold;
|
27 |
+
color: black;
|
28 |
+
border: medium none;
|
29 |
+
background: none;
|
30 |
+
}
|
31 |
+
}
|
32 |
}
|
admin/assets/css/sass/partials/_tooltips.scss
CHANGED
@@ -1,48 +1,48 @@
|
|
1 |
/* !Help tooltip popups */
|
2 |
.vfb-tooltip {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
}
|
10 |
|
11 |
.rtl .vfb-tooltip {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
}
|
16 |
|
17 |
.vfb-tooltip-popup {
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
}
|
32 |
|
33 |
.vfb-tooltip-popup h3,
|
34 |
.vfb-tooltip .vfb-tooltip-popup h3 {
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
}
|
43 |
|
44 |
.vfb-tooltip-popup p {
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
}
|
1 |
/* !Help tooltip popups */
|
2 |
.vfb-tooltip {
|
3 |
+
position: relative;
|
4 |
+
float: right;
|
5 |
+
width: 16px;
|
6 |
+
height: 16px;
|
7 |
+
margin-right: 2px;
|
8 |
+
cursor: pointer;
|
9 |
}
|
10 |
|
11 |
.rtl .vfb-tooltip {
|
12 |
+
float: left;
|
13 |
+
margin-right: 0;
|
14 |
+
margin-left: 2px;
|
15 |
}
|
16 |
|
17 |
.vfb-tooltip-popup {
|
18 |
+
font-style: normal;
|
19 |
+
position: absolute;
|
20 |
+
z-index: 200;
|
21 |
+
top: -40px;
|
22 |
+
display: none;
|
23 |
+
width: 250px;
|
24 |
+
padding: 5px 20px;
|
25 |
+
text-indent: 0;
|
26 |
+
color: white;
|
27 |
+
border: 2px solid #333333;
|
28 |
+
border-radius: 5px;
|
29 |
+
background: #222222;
|
30 |
+
box-shadow: 0 0 7px black;
|
31 |
}
|
32 |
|
33 |
.vfb-tooltip-popup h3,
|
34 |
.vfb-tooltip .vfb-tooltip-popup h3 {
|
35 |
+
font-family: sans-serif;
|
36 |
+
font-size: 13px;
|
37 |
+
font-weight: normal;
|
38 |
+
margin: 5px 0;
|
39 |
+
padding: 0 0 6px 0;
|
40 |
+
color: white;
|
41 |
+
border-bottom: 1px solid white;
|
42 |
}
|
43 |
|
44 |
.vfb-tooltip-popup p {
|
45 |
+
font-size: 12px;
|
46 |
+
margin-top: 1 0;
|
47 |
+
color: white;
|
48 |
}
|
admin/assets/css/sass/partials/_upgrade.scss
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
.vfb-pro-upgrade {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
}
|
10 |
|
11 |
.rtl .vfb-pro-upgrade {
|
12 |
-
|
13 |
}
|
14 |
|
15 |
.vfb-pro-upgrade h2,
|
16 |
.wrap .vfb-pro-upgrade h2 {
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
}
|
22 |
|
23 |
.vfb-pro-upgrade h2 a {
|
24 |
-
|
25 |
}
|
26 |
|
27 |
.vfb-pro-upgrade ul {
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
|
32 |
.rtl .vfb-pro-upgrade ul {
|
33 |
-
|
34 |
-
|
35 |
}
|
36 |
|
37 |
#vfb-upgrade-column {
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
}
|
42 |
|
43 |
.rtl #vfb-upgrade-column {
|
44 |
-
|
45 |
}
|
46 |
|
47 |
ul#promote-vfb {
|
48 |
-
|
49 |
-
|
50 |
}
|
51 |
|
52 |
.rtl ul#promote-vfb {
|
53 |
-
|
54 |
-
|
55 |
}
|
56 |
|
57 |
#promote-vfb li {
|
58 |
-
|
59 |
}
|
60 |
|
61 |
.rtl #promote-vfb li {
|
62 |
-
|
63 |
}
|
1 |
.vfb-pro-upgrade {
|
2 |
+
display: inline;
|
3 |
+
float: left;
|
4 |
+
margin-bottom: 20px;
|
5 |
+
padding: 10px;
|
6 |
+
border: 1px solid #21759b;
|
7 |
+
border-radius: 5px;
|
8 |
+
background-color: #d3e7ee;
|
9 |
}
|
10 |
|
11 |
.rtl .vfb-pro-upgrade {
|
12 |
+
float: right;
|
13 |
}
|
14 |
|
15 |
.vfb-pro-upgrade h2,
|
16 |
.wrap .vfb-pro-upgrade h2 {
|
17 |
+
font-size: 23px;
|
18 |
+
font-weight: 500;
|
19 |
+
padding: 5px 0;
|
20 |
+
text-align: center;
|
21 |
}
|
22 |
|
23 |
.vfb-pro-upgrade h2 a {
|
24 |
+
text-decoration: none;
|
25 |
}
|
26 |
|
27 |
.vfb-pro-upgrade ul {
|
28 |
+
margin-left: 10px;
|
29 |
+
list-style: outside;
|
30 |
}
|
31 |
|
32 |
.rtl .vfb-pro-upgrade ul {
|
33 |
+
margin-right: 10px;
|
34 |
+
margin-left: 0;
|
35 |
}
|
36 |
|
37 |
#vfb-upgrade-column {
|
38 |
+
display: inline;
|
39 |
+
float: left;
|
40 |
+
width: auto;
|
41 |
}
|
42 |
|
43 |
.rtl #vfb-upgrade-column {
|
44 |
+
float: right;
|
45 |
}
|
46 |
|
47 |
ul#promote-vfb {
|
48 |
+
margin-left: 20px;
|
49 |
+
list-style: disc;
|
50 |
}
|
51 |
|
52 |
.rtl ul#promote-vfb {
|
53 |
+
margin-right: 20px;
|
54 |
+
margin-left: auto;
|
55 |
}
|
56 |
|
57 |
#promote-vfb li {
|
58 |
+
text-align: left;
|
59 |
}
|
60 |
|
61 |
.rtl #promote-vfb li {
|
62 |
+
text-align: right;
|
63 |
}
|
admin/assets/css/sass/partials/_validation.scss
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
label.error {
|
2 |
-
|
3 |
-
|
4 |
}
|
5 |
|
6 |
#visual-form-builder-update input.error,
|
7 |
#visual-form-builder-update textarea.error,
|
8 |
#visual-form-builder-update select.error {
|
9 |
-
|
10 |
}
|
1 |
label.error {
|
2 |
+
display: block;
|
3 |
+
color: red;
|
4 |
}
|
5 |
|
6 |
#visual-form-builder-update input.error,
|
7 |
#visual-form-builder-update textarea.error,
|
8 |
#visual-form-builder-update select.error {
|
9 |
+
border: 1px solid red;
|
10 |
}
|
admin/assets/css/visual-form-builder-admin.css
CHANGED
@@ -524,24 +524,24 @@ strong .vfb-meta-entries-total span {
|
|
524 |
/* !Form Editor Columns - One Column */
|
525 |
@media only screen and (max-width: 799px) {
|
526 |
#vfb-form-builder-frame .vfb-postbox-container {
|
527 |
-
|
528 |
.columns-prefs .columns-prefs-3 {
|
529 |
-
|
530 |
|
531 |
/* !Form Editor Columns - Two Columns */
|
532 |
@media only screen and (min-width: 800px) and (max-width: 1200px) {
|
533 |
#vfb-form-builder-frame .vfb-postbox-container {
|
534 |
-
|
535 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-2,
|
536 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
537 |
-
|
538 |
#vfb-form-builder-frame.columns-1 .vfb-postbox-container {
|
539 |
-
|
540 |
|
541 |
/* !Form Editor Columns - Three Columns */
|
542 |
@media only screen and (min-width: 1600px) {
|
543 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
544 |
-
|
545 |
|
546 |
/* !Field Item arrows */
|
547 |
.item-edit {
|
@@ -1378,15 +1378,15 @@ ul.vfb-fields-col-2 {
|
|
1378 |
|
1379 |
@media print {
|
1380 |
body * {
|
1381 |
-
|
1382 |
html,
|
1383 |
.wrap,
|
1384 |
#wpbody-content,
|
1385 |
#vfb-poststuff {
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
#wpadminbar,
|
1391 |
#adminmenuwrap,
|
1392 |
#adminmenushadow,
|
@@ -1400,106 +1400,106 @@ ul.vfb-fields-col-2 {
|
|
1400 |
.view-entry,
|
1401 |
#major-publishing-actions,
|
1402 |
.clear {
|
1403 |
-
|
1404 |
#wpcontent,
|
1405 |
body #wpcontent {
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
#entry-edit h3 span {
|
1410 |
-
|
1411 |
-
|
1412 |
#vfb-poststuff {
|
1413 |
-
|
1414 |
#vfb-entries-body-content {
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
#side-info-column {
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
#side-info-column .postbox .inside {
|
1424 |
-
|
1425 |
-
|
1426 |
#minor-publishing,
|
1427 |
.misc-pub-section,
|
1428 |
#submitdiv,
|
1429 |
#submitdiv h3 {
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
#submitdiv h3 span {
|
1434 |
-
|
1435 |
-
|
1436 |
.inner-sidebar #side-sortables,
|
1437 |
.columns-2 .inner-sidebar #side-sortables {
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
table {
|
1442 |
-
|
1443 |
tr textarea {
|
1444 |
-
|
1445 |
|
1446 |
/* !HiDPI Displays */
|
1447 |
@media print, (-o-min-device-pixel-ratio: 5 / 4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
|
1448 |
/* Interface icons */
|
1449 |
.vfb-interface-icon {
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
/* Form items */
|
1454 |
.vfb-draggable-form-items b {
|
1455 |
-
|
1456 |
-
|
1457 |
.vfb-add-options-group .vfb-interface-plus {
|
1458 |
-
|
1459 |
.addEmail,
|
1460 |
.deleteEmail {
|
1461 |
-
|
1462 |
/* Field Item arrows */
|
1463 |
.item-edit {
|
1464 |
-
|
1465 |
-
|
1466 |
/* Blue Admin style */
|
1467 |
.admin-color-classic .item-edit {
|
1468 |
-
|
1469 |
-
|
1470 |
.item-edit:hover {
|
1471 |
-
|
1472 |
-
|
1473 |
/* Blue Admin style */
|
1474 |
.admin-color-classic .item-edit:hover {
|
1475 |
-
|
1476 |
-
|
1477 |
.item-edit.opened {
|
1478 |
-
|
1479 |
-
|
1480 |
/* Blue Admin style */
|
1481 |
.admin-color-classic .item-edit.opened {
|
1482 |
-
|
1483 |
-
|
1484 |
.item-edit.opened:hover {
|
1485 |
-
|
1486 |
-
|
1487 |
/* Blue Admin style */
|
1488 |
.admin-color-classic .item-edit.opened:hover {
|
1489 |
-
|
1490 |
-
|
1491 |
/* Form Settings arrow */
|
1492 |
.button-icon.vfb-small-arrow {
|
1493 |
-
|
1494 |
-
|
1495 |
/* Blue Admin style */
|
1496 |
.admin-color-classic .button-icon.vfb-small-arrow {
|
1497 |
-
|
1498 |
-
|
1499 |
.current .button-icon.vfb-small-arrow {
|
1500 |
-
|
1501 |
-
|
1502 |
/* Blue Admin style */
|
1503 |
.admin-color-classic .current .button-icon.vfb-small-arrow {
|
1504 |
-
|
1505 |
-
|
524 |
/* !Form Editor Columns - One Column */
|
525 |
@media only screen and (max-width: 799px) {
|
526 |
#vfb-form-builder-frame .vfb-postbox-container {
|
527 |
+
width: 100%; }
|
528 |
.columns-prefs .columns-prefs-3 {
|
529 |
+
display: none; } }
|
530 |
|
531 |
/* !Form Editor Columns - Two Columns */
|
532 |
@media only screen and (min-width: 800px) and (max-width: 1200px) {
|
533 |
#vfb-form-builder-frame .vfb-postbox-container {
|
534 |
+
width: 49.5%; }
|
535 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-2,
|
536 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
537 |
+
width: 50.5%; }
|
538 |
#vfb-form-builder-frame.columns-1 .vfb-postbox-container {
|
539 |
+
width: 100%; } }
|
540 |
|
541 |
/* !Form Editor Columns - Three Columns */
|
542 |
@media only screen and (min-width: 1600px) {
|
543 |
#vfb-form-builder-frame.columns-3 #vfb-postbox-container-3 {
|
544 |
+
width: 58%; } }
|
545 |
|
546 |
/* !Field Item arrows */
|
547 |
.item-edit {
|
1378 |
|
1379 |
@media print {
|
1380 |
body * {
|
1381 |
+
float: none; }
|
1382 |
html,
|
1383 |
.wrap,
|
1384 |
#wpbody-content,
|
1385 |
#vfb-poststuff {
|
1386 |
+
background: none !important;
|
1387 |
+
padding: 0;
|
1388 |
+
margin: 0;
|
1389 |
+
height: auto; }
|
1390 |
#wpadminbar,
|
1391 |
#adminmenuwrap,
|
1392 |
#adminmenushadow,
|
1400 |
.view-entry,
|
1401 |
#major-publishing-actions,
|
1402 |
.clear {
|
1403 |
+
display: none; }
|
1404 |
#wpcontent,
|
1405 |
body #wpcontent {
|
1406 |
+
margin-left: 0;
|
1407 |
+
width: auto;
|
1408 |
+
height: auto; }
|
1409 |
#entry-edit h3 span {
|
1410 |
+
font-size: 23px;
|
1411 |
+
font-weight: normal; }
|
1412 |
#vfb-poststuff {
|
1413 |
+
page-break-after: auto; }
|
1414 |
#vfb-entries-body-content {
|
1415 |
+
width: 100%;
|
1416 |
+
height: auto;
|
1417 |
+
margin: 0 0 50px 0;
|
1418 |
+
padding: 0; }
|
1419 |
#side-info-column {
|
1420 |
+
width: 100%;
|
1421 |
+
height: auto;
|
1422 |
+
float: none; }
|
1423 |
#side-info-column .postbox .inside {
|
1424 |
+
margin: 0;
|
1425 |
+
padding: 0; }
|
1426 |
#minor-publishing,
|
1427 |
.misc-pub-section,
|
1428 |
#submitdiv,
|
1429 |
#submitdiv h3 {
|
1430 |
+
background: none !important;
|
1431 |
+
border: none;
|
1432 |
+
margin: 0; }
|
1433 |
#submitdiv h3 span {
|
1434 |
+
font-family: sans-serif;
|
1435 |
+
font-size: 16px; }
|
1436 |
.inner-sidebar #side-sortables,
|
1437 |
.columns-2 .inner-sidebar #side-sortables {
|
1438 |
+
margin: 0;
|
1439 |
+
padding: 0;
|
1440 |
+
width: auto; }
|
1441 |
table {
|
1442 |
+
page-break-inside: auto; }
|
1443 |
tr textarea {
|
1444 |
+
overflow: visible; } }
|
1445 |
|
1446 |
/* !HiDPI Displays */
|
1447 |
@media print, (-o-min-device-pixel-ratio: 5 / 4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
|
1448 |
/* Interface icons */
|
1449 |
.vfb-interface-icon {
|
1450 |
+
top: 5px;
|
1451 |
+
background-image: url("../img/vfb-interface-icons-2x.png?d=20130712");
|
1452 |
+
background-size: cover; }
|
1453 |
/* Form items */
|
1454 |
.vfb-draggable-form-items b {
|
1455 |
+
background-image: url("../img/vfb-form-items-2x.png?d=20130712");
|
1456 |
+
background-size: cover; }
|
1457 |
.vfb-add-options-group .vfb-interface-plus {
|
1458 |
+
top: 5px; }
|
1459 |
.addEmail,
|
1460 |
.deleteEmail {
|
1461 |
+
top: 28px; }
|
1462 |
/* Field Item arrows */
|
1463 |
.item-edit {
|
1464 |
+
background-image: url("../img/arrows-2x.png?d=20130611");
|
1465 |
+
background-size: 15px 123px; }
|
1466 |
/* Blue Admin style */
|
1467 |
.admin-color-classic .item-edit {
|
1468 |
+
background-image: url("../img/arrows-vs-2x.png?d=20130611");
|
1469 |
+
background-size: 15px 123px; }
|
1470 |
.item-edit:hover {
|
1471 |
+
background-image: url("../img/arrows-dark-2x.png?d=20130611");
|
1472 |
+
background-size: 15px 123px; }
|
1473 |
/* Blue Admin style */
|
1474 |
.admin-color-classic .item-edit:hover {
|
1475 |
+
background-image: url("../img/arrows-dark-vs-2x.png?d=20130611");
|
1476 |
+
background-size: 15px 123px; }
|
1477 |
.item-edit.opened {
|
1478 |
+
background-image: url("../img/arrows-2x.png?d=20130611");
|
1479 |
+
background-size: 15px 123px; }
|
1480 |
/* Blue Admin style */
|
1481 |
.admin-color-classic .item-edit.opened {
|
1482 |
+
background-image: url("../img/arrows-vs-2x.png?d=20130611");
|
1483 |
+
background-size: 15px 123px; }
|
1484 |
.item-edit.opened:hover {
|
1485 |
+
background-image: url("../img/arrows-dark-2x.png?d=20130611");
|
1486 |
+
background-size: 15px 123px; }
|
1487 |
/* Blue Admin style */
|
1488 |
.admin-color-classic .item-edit.opened:hover {
|
1489 |
+
background-image: url("../img/arrows-dark-vs-2x.png?d=20130611");
|
1490 |
+
background-size: 15px 123px; }
|
1491 |
/* Form Settings arrow */
|
1492 |
.button-icon.vfb-small-arrow {
|
1493 |
+
background-image: url("../img/arrows-2x.png?d=20130611");
|
1494 |
+
background-size: 15px 123px; }
|
1495 |
/* Blue Admin style */
|
1496 |
.admin-color-classic .button-icon.vfb-small-arrow {
|
1497 |
+
background-image: url("../img/arrows-vs-2x.png?d=20130611");
|
1498 |
+
background-size: 15px 123px; }
|
1499 |
.current .button-icon.vfb-small-arrow {
|
1500 |
+
background-image: url("../img/arrows-2x.png?d=20130611");
|
1501 |
+
background-size: 15px 123px; }
|
1502 |
/* Blue Admin style */
|
1503 |
.admin-color-classic .current .button-icon.vfb-small-arrow {
|
1504 |
+
background-image: url("../img/arrows-vs.png?d=20130611");
|
1505 |
+
background-size: 15px 123px; } }
|
admin/assets/js/jquery.ui.nestedSortable.js
CHANGED
@@ -13,417 +13,453 @@
|
|
13 |
|
14 |
(function($) {
|
15 |
|
16 |
-
$.widget(
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
.removeData("nestedSortable")
|
43 |
-
.unbind(".nestedSortable");
|
44 |
-
return $.ui.sortable.prototype.destroy.apply(this, arguments);
|
45 |
-
},
|
46 |
-
|
47 |
-
_mouseDrag: function(event) {
|
48 |
-
|
49 |
-
//Compute the helpers position
|
50 |
-
this.position = this._generatePosition(event);
|
51 |
-
this.positionAbs = this._convertPositionTo("absolute");
|
52 |
-
|
53 |
-
if (!this.lastPositionAbs) {
|
54 |
-
this.lastPositionAbs = this.positionAbs;
|
55 |
-
}
|
56 |
-
|
57 |
-
var o = this.options;
|
58 |
-
|
59 |
-
//Do scrolling
|
60 |
-
if(this.options.scroll) {
|
61 |
-
var scrolled = false;
|
62 |
-
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
|
63 |
-
|
64 |
-
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
|
65 |
-
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
|
66 |
-
else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
|
67 |
-
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
|
68 |
-
|
69 |
-
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
|
70 |
-
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
|
71 |
-
else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
|
72 |
-
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
|
73 |
|
74 |
-
|
|
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
80 |
|
81 |
-
|
82 |
-
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
83 |
-
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
84 |
-
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
85 |
|
86 |
-
|
|
|
|
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
|
92 |
-
|
93 |
-
this.positionAbs = this._convertPositionTo("absolute");
|
94 |
|
95 |
-
|
96 |
-
|
|
|
|
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
101 |
|
102 |
-
|
103 |
-
|
|
|
|
|
|
|
104 |
|
105 |
-
|
106 |
-
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
|
107 |
-
if (!intersection) continue;
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
) {
|
115 |
|
116 |
-
|
|
|
|
|
|
|
|
|
117 |
|
118 |
-
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
} else {
|
124 |
-
break;
|
125 |
}
|
126 |
|
127 |
-
//
|
128 |
-
this.
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
}
|
133 |
-
}
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
// To find the previous sibling in the list, keep backtracking until we hit a valid list item.
|
143 |
-
var previousItem = this.placeholder[0].previousSibling ? $(this.placeholder[0].previousSibling) : null;
|
144 |
-
if (previousItem != null) {
|
145 |
-
while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
|
146 |
-
if (previousItem[0].previousSibling) {
|
147 |
-
previousItem = $(previousItem[0].previousSibling);
|
148 |
-
} else {
|
149 |
-
previousItem = null;
|
150 |
-
break;
|
151 |
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
// To find the next sibling in the list, keep stepping forward until we hit a valid list item.
|
156 |
-
var nextItem = this.placeholder[0].nextSibling ? $(this.placeholder[0].nextSibling) : null;
|
157 |
-
if (nextItem != null) {
|
158 |
-
while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
|
159 |
-
if (nextItem[0].nextSibling) {
|
160 |
-
nextItem = $(nextItem[0].nextSibling);
|
161 |
-
} else {
|
162 |
-
nextItem = null;
|
163 |
-
break;
|
164 |
-
}
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
var newList = document.createElement(o.listType);
|
169 |
-
|
170 |
-
this.beyondMaxLevels = 0;
|
171 |
-
|
172 |
-
// If the item is moved to the left, send it to its parent's level unless there are siblings below it.
|
173 |
-
if (parentItem != null && nextItem == null &&
|
174 |
-
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) ||
|
175 |
-
!o.rtl && (this.positionAbs.left < parentItem.offset().left))) {
|
176 |
-
parentItem.after(this.placeholder[0]);
|
177 |
-
this._clearEmpty(parentItem[0]);
|
178 |
-
this._trigger("change", event, this._uiHash());
|
179 |
-
}
|
180 |
-
// If the item is below a sibling and is moved to the right, make it a child of that sibling.
|
181 |
-
else if (previousItem != null &&
|
182 |
-
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize) ||
|
183 |
-
!o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))) {
|
184 |
-
this._isAllowed(previousItem, level, level+childLevels+1);
|
185 |
-
if (!previousItem.children(o.listType).length) {
|
186 |
-
previousItem[0].appendChild(newList);
|
187 |
-
}
|
188 |
-
// If this item is being moved from the top, add it to the top of the list.
|
189 |
-
if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
|
190 |
-
previousItem.children(o.listType).prepend(this.placeholder);
|
191 |
-
}
|
192 |
-
// Otherwise, add it to the bottom of the list.
|
193 |
-
else {
|
194 |
-
previousItem.children(o.listType)[0].appendChild(this.placeholder[0]);
|
195 |
-
}
|
196 |
-
this._trigger("change", event, this._uiHash());
|
197 |
-
}
|
198 |
-
else {
|
199 |
-
this._isAllowed(parentItem, level, level+childLevels);
|
200 |
-
}
|
201 |
-
|
202 |
-
//Post events to containers
|
203 |
-
this._contactContainers(event);
|
204 |
-
|
205 |
-
//Interconnect with droppables
|
206 |
-
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
|
207 |
-
|
208 |
-
//Call callbacks
|
209 |
-
this._trigger('sort', event, this._uiHash());
|
210 |
-
|
211 |
-
this.lastPositionAbs = this.positionAbs;
|
212 |
-
return false;
|
213 |
-
|
214 |
-
},
|
215 |
-
|
216 |
-
_mouseStop: function(event, noPropagation) {
|
217 |
-
|
218 |
-
// If the item is in a position not allowed, send it back
|
219 |
-
if (this.beyondMaxLevels) {
|
220 |
-
|
221 |
-
this.placeholder.removeClass(this.options.errorClass);
|
222 |
-
|
223 |
-
if (this.domPosition.prev) {
|
224 |
-
$(this.domPosition.prev).after(this.placeholder);
|
225 |
-
} else {
|
226 |
-
$(this.domPosition.parent).prepend(this.placeholder);
|
227 |
-
}
|
228 |
-
|
229 |
-
this._trigger("revert", event, this._uiHash());
|
230 |
-
|
231 |
-
}
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
var item = this.items[i].item[0];
|
236 |
-
this._clearEmpty(item);
|
237 |
-
}
|
238 |
|
239 |
-
|
|
|
|
|
|
|
|
|
240 |
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
-
|
244 |
|
245 |
-
|
246 |
-
items = this._getItemsAsjQuery(o && o.connected),
|
247 |
-
str = [];
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
.match(o.expression || (/(.+)[-=_](.+)/));
|
256 |
|
257 |
-
|
258 |
-
|
259 |
-
+ '='
|
260 |
-
+ (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID));
|
261 |
-
}
|
262 |
-
});
|
263 |
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
267 |
|
268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
-
|
273 |
|
274 |
-
|
275 |
-
sDepth = o.startDepthCount || 0,
|
276 |
-
ret = [];
|
277 |
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
|
283 |
-
|
|
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
var currentItem = {"id" : id[2]};
|
289 |
-
if ($(item).children(o.listType).children(o.items).length > 0) {
|
290 |
-
currentItem.children = [];
|
291 |
-
$(item).children(o.listType).children(o.items).each(function() {
|
292 |
-
var level = _recursiveItems(this);
|
293 |
-
currentItem.children.push(level);
|
294 |
-
});
|
295 |
}
|
296 |
-
return currentItem;
|
297 |
-
}
|
298 |
-
}
|
299 |
-
},
|
300 |
-
|
301 |
-
toArray: function(options) {
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
ret = [],
|
306 |
-
left = 2;
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
"parent_id": 'none',
|
311 |
-
"depth": sDepth,
|
312 |
-
"left": '1',
|
313 |
-
"right": ($(o.items, this.element).length + 1) * 2
|
314 |
-
});
|
315 |
|
316 |
-
|
317 |
-
left = _recursiveArray(this, sDepth + 1, left);
|
318 |
-
});
|
319 |
|
320 |
-
|
321 |
|
322 |
-
|
|
|
323 |
|
324 |
-
|
325 |
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
329 |
|
330 |
-
|
331 |
-
depth ++;
|
332 |
-
$(item).children(o.listType).children(o.items).each(function () {
|
333 |
-
right = _recursiveArray($(this), depth, right);
|
334 |
-
});
|
335 |
-
depth --;
|
336 |
-
}
|
337 |
|
338 |
-
|
339 |
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
.attr(o.attribute || 'id'))
|
346 |
-
.match(o.expression || (/(.+)[-=_](.+)/));
|
347 |
-
pid = parentItem[2];
|
348 |
-
}
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
-
|
359 |
|
360 |
-
|
361 |
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
|
367 |
-
|
368 |
|
369 |
-
|
370 |
|
371 |
-
|
372 |
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
this.
|
|
|
|
|
|
|
|
|
|
|
412 |
} else {
|
413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
}
|
415 |
-
} else {
|
416 |
-
if (maxLevels < levels && maxLevels != 0) {
|
417 |
-
this.placeholder.addClass(o.errorClass);
|
418 |
-
this.beyondMaxLevels = levels - maxLevels;
|
419 |
-
} else {
|
420 |
-
this.placeholder.removeClass(o.errorClass);
|
421 |
-
this.beyondMaxLevels = 0;
|
422 |
}
|
423 |
-
}
|
424 |
-
}
|
425 |
|
426 |
-
|
|
|
|
|
427 |
|
428 |
-
$.mjs.nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options);
|
429 |
-
})(jQuery);
|
13 |
|
14 |
(function($) {
|
15 |
|
16 |
+
$.widget(
|
17 |
+
"mjs.nestedSortable",
|
18 |
+
$.extend(
|
19 |
+
{},
|
20 |
+
$.ui.sortable.prototype,
|
21 |
+
{
|
22 |
+
|
23 |
+
options: {
|
24 |
+
tabSize: 20,
|
25 |
+
disableNesting: 'mjs-nestedSortable-no-nesting',
|
26 |
+
errorClass: 'mjs-nestedSortable-error',
|
27 |
+
doNotClear: false,
|
28 |
+
listType: 'ol',
|
29 |
+
maxLevels: 0,
|
30 |
+
protectRoot: false,
|
31 |
+
rootID: null,
|
32 |
+
rtl: false,
|
33 |
+
isAllowed: function(item, parent) { return true; }
|
34 |
+
},
|
35 |
+
|
36 |
+
_create: function() {
|
37 |
+
this.element.data( 'sortable', this.element.data( 'nestedSortable' ) );
|
38 |
+
|
39 |
+
if ( ! this.element.is( this.options.listType )) {
|
40 |
+
throw new Error( 'nestedSortable: Please check the listType option is set to your actual list type' );
|
41 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
+
return $.ui.sortable.prototype._create.apply( this, arguments );
|
44 |
+
},
|
45 |
|
46 |
+
destroy: function() {
|
47 |
+
this.element
|
48 |
+
.removeData( "nestedSortable" )
|
49 |
+
.unbind( ".nestedSortable" );
|
50 |
+
return $.ui.sortable.prototype.destroy.apply( this, arguments );
|
51 |
+
},
|
52 |
|
53 |
+
_mouseDrag: function(event) {
|
|
|
|
|
|
|
54 |
|
55 |
+
// Compute the helpers position
|
56 |
+
this.position = this._generatePosition( event );
|
57 |
+
this.positionAbs = this._convertPositionTo( "absolute" );
|
58 |
|
59 |
+
if ( ! this.lastPositionAbs) {
|
60 |
+
this.lastPositionAbs = this.positionAbs;
|
61 |
+
}
|
62 |
|
63 |
+
var o = this.options;
|
|
|
64 |
|
65 |
+
// Do scrolling
|
66 |
+
if (this.options.scroll) {
|
67 |
+
var scrolled = false;
|
68 |
+
if (this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
|
69 |
|
70 |
+
if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
|
71 |
+
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
|
72 |
+
} else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
|
73 |
+
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
|
74 |
+
}
|
75 |
|
76 |
+
if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
|
77 |
+
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
|
78 |
+
} else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
|
79 |
+
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
|
80 |
+
}
|
81 |
|
82 |
+
} else {
|
|
|
|
|
83 |
|
84 |
+
if (event.pageY - $( document ).scrollTop() < o.scrollSensitivity) {
|
85 |
+
scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed );
|
86 |
+
} else if ($( window ).height() - (event.pageY - $( document ).scrollTop()) < o.scrollSensitivity) {
|
87 |
+
scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed );
|
88 |
+
}
|
|
|
89 |
|
90 |
+
if (event.pageX - $( document ).scrollLeft() < o.scrollSensitivity) {
|
91 |
+
scrolled = $( document ).scrollLeft( $( document ).scrollLeft() - o.scrollSpeed );
|
92 |
+
} else if ($( window ).width() - (event.pageX - $( document ).scrollLeft()) < o.scrollSensitivity) {
|
93 |
+
scrolled = $( document ).scrollLeft( $( document ).scrollLeft() + o.scrollSpeed );
|
94 |
+
}
|
95 |
|
96 |
+
}
|
97 |
|
98 |
+
if (scrolled !== false && $.ui.ddmanager && ! o.dropBehaviour) {
|
99 |
+
$.ui.ddmanager.prepareOffsets( this, event );
|
100 |
+
}
|
|
|
|
|
101 |
}
|
102 |
|
103 |
+
// Regenerate the absolute position used for position checks
|
104 |
+
this.positionAbs = this._convertPositionTo( "absolute" );
|
105 |
|
106 |
+
// Find the top offset before rearrangement,
|
107 |
+
var previousTopOffset = this.placeholder.offset().top;
|
|
|
|
|
108 |
|
109 |
+
// Set the helper position
|
110 |
+
if ( ! this.options.axis || this.options.axis != "y") {
|
111 |
+
this.helper[0].style.left = this.position.left + 'px';
|
112 |
+
}
|
113 |
+
if ( ! this.options.axis || this.options.axis != "x") {
|
114 |
+
this.helper[0].style.top = this.position.top + 'px';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
+
// Rearrange
|
118 |
+
for (var i = this.items.length - 1; i >= 0; i--) {
|
|
|
|
|
|
|
119 |
|
120 |
+
// Cache variables and intersection, continue if no intersection
|
121 |
+
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer( item );
|
122 |
+
if ( ! intersection) {
|
123 |
+
continue;
|
124 |
+
}
|
125 |
|
126 |
+
if (itemElement != this.currentItem[0] // cannot intersect with itself
|
127 |
+
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement // no useless actions that have been done before
|
128 |
+
&& ! $.contains( this.placeholder[0], itemElement ) // no action if the item moved is the parent of the item checked
|
129 |
+
&& (this.options.type == 'semi-dynamic' ? ! $.contains( this.element[0], itemElement ) : true)
|
130 |
+
// && itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
|
131 |
+
) {
|
132 |
|
133 |
+
$( itemElement ).mouseenter();
|
134 |
|
135 |
+
this.direction = intersection == 1 ? "down" : "up";
|
|
|
|
|
136 |
|
137 |
+
if (this.options.tolerance == "pointer" || this._intersectsWithSides( item )) {
|
138 |
+
$( itemElement ).mouseleave();
|
139 |
+
this._rearrange( event, item );
|
140 |
+
} else {
|
141 |
+
break;
|
142 |
+
}
|
|
|
143 |
|
144 |
+
// Clear emtpy ul's/ol's
|
145 |
+
this._clearEmpty( itemElement );
|
|
|
|
|
|
|
|
|
146 |
|
147 |
+
this._trigger( "change", event, this._uiHash() );
|
148 |
+
break;
|
149 |
+
}
|
150 |
+
}
|
151 |
|
152 |
+
var parentItem = (this.placeholder[0].parentNode.parentNode &&
|
153 |
+
$( this.placeholder[0].parentNode.parentNode ).closest( '.ui-sortable' ).length)
|
154 |
+
? $( this.placeholder[0].parentNode.parentNode )
|
155 |
+
: null,
|
156 |
+
level = this._getLevel( this.placeholder ),
|
157 |
+
childLevels = this._getChildLevels( this.helper );
|
158 |
+
|
159 |
+
// To find the previous sibling in the list, keep backtracking until we hit a valid list item.
|
160 |
+
var previousItem = this.placeholder[0].previousSibling ? $( this.placeholder[0].previousSibling ) : null;
|
161 |
+
if (previousItem != null) {
|
162 |
+
while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
|
163 |
+
if (previousItem[0].previousSibling) {
|
164 |
+
previousItem = $( previousItem[0].previousSibling );
|
165 |
+
} else {
|
166 |
+
previousItem = null;
|
167 |
+
break;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
|
172 |
+
// To find the next sibling in the list, keep stepping forward until we hit a valid list item.
|
173 |
+
var nextItem = this.placeholder[0].nextSibling ? $( this.placeholder[0].nextSibling ) : null;
|
174 |
+
if (nextItem != null) {
|
175 |
+
while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
|
176 |
+
if (nextItem[0].nextSibling) {
|
177 |
+
nextItem = $( nextItem[0].nextSibling );
|
178 |
+
} else {
|
179 |
+
nextItem = null;
|
180 |
+
break;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
}
|
184 |
|
185 |
+
var newList = document.createElement( o.listType );
|
186 |
|
187 |
+
this.beyondMaxLevels = 0;
|
|
|
|
|
188 |
|
189 |
+
// If the item is moved to the left, send it to its parent's level unless there are siblings below it.
|
190 |
+
if (parentItem != null && nextItem == null &&
|
191 |
+
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() > parentItem.offset().left + parentItem.outerWidth()) ||
|
192 |
+
! o.rtl && (this.positionAbs.left < parentItem.offset().left))) {
|
193 |
+
parentItem.after( this.placeholder[0] );
|
194 |
+
this._clearEmpty( parentItem[0] );
|
195 |
+
this._trigger( "change", event, this._uiHash() );
|
196 |
+
}
|
197 |
+
// If the item is below a sibling and is moved to the right, make it a child of that sibling.
|
198 |
+
else if (previousItem != null &&
|
199 |
+
(o.rtl && (this.positionAbs.left + this.helper.outerWidth() < previousItem.offset().left + previousItem.outerWidth() - o.tabSize) ||
|
200 |
+
! o.rtl && (this.positionAbs.left > previousItem.offset().left + o.tabSize))) {
|
201 |
+
this._isAllowed( previousItem, level, level + childLevels + 1 );
|
202 |
+
if ( ! previousItem.children( o.listType ).length) {
|
203 |
+
previousItem[0].appendChild( newList );
|
204 |
+
}
|
205 |
+
// If this item is being moved from the top, add it to the top of the list.
|
206 |
+
if (previousTopOffset && (previousTopOffset <= previousItem.offset().top)) {
|
207 |
+
previousItem.children( o.listType ).prepend( this.placeholder );
|
208 |
+
}
|
209 |
+
// Otherwise, add it to the bottom of the list.
|
210 |
+
else {
|
211 |
+
previousItem.children( o.listType )[0].appendChild( this.placeholder[0] );
|
212 |
+
}
|
213 |
+
this._trigger( "change", event, this._uiHash() );
|
214 |
+
} else {
|
215 |
+
this._isAllowed( parentItem, level, level + childLevels );
|
216 |
+
}
|
217 |
|
218 |
+
// Post events to containers
|
219 |
+
this._contactContainers( event );
|
220 |
|
221 |
+
// Interconnect with droppables
|
222 |
+
if ($.ui.ddmanager) {
|
223 |
+
$.ui.ddmanager.drag( this, event );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
|
226 |
+
// Call callbacks
|
227 |
+
this._trigger( 'sort', event, this._uiHash() );
|
|
|
|
|
228 |
|
229 |
+
this.lastPositionAbs = this.positionAbs;
|
230 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
},
|
|
|
|
|
233 |
|
234 |
+
_mouseStop: function(event, noPropagation) {
|
235 |
|
236 |
+
// If the item is in a position not allowed, send it back
|
237 |
+
if (this.beyondMaxLevels) {
|
238 |
|
239 |
+
this.placeholder.removeClass( this.options.errorClass );
|
240 |
|
241 |
+
if (this.domPosition.prev) {
|
242 |
+
$( this.domPosition.prev ).after( this.placeholder );
|
243 |
+
} else {
|
244 |
+
$( this.domPosition.parent ).prepend( this.placeholder );
|
245 |
+
}
|
246 |
|
247 |
+
this._trigger( "revert", event, this._uiHash() );
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
|
249 |
+
}
|
250 |
|
251 |
+
// Clean last empty ul/ol
|
252 |
+
for (var i = this.items.length - 1; i >= 0; i--) {
|
253 |
+
var item = this.items[i].item[0];
|
254 |
+
this._clearEmpty( item );
|
255 |
+
}
|
|
|
|
|
|
|
|
|
256 |
|
257 |
+
$.ui.sortable.prototype._mouseStop.apply( this, arguments );
|
258 |
+
|
259 |
+
},
|
260 |
+
|
261 |
+
serialize: function(options) {
|
262 |
+
|
263 |
+
var o = $.extend( {}, this.options, options ),
|
264 |
+
items = this._getItemsAsjQuery( o && o.connected ),
|
265 |
+
str = [];
|
266 |
+
|
267 |
+
$( items ).each(
|
268 |
+
function() {
|
269 |
+
var res = ($( o.item || this ).attr( o.attribute || 'id' ) || '')
|
270 |
+
.match( o.expression || (/(.+)[-=_](.+)/) ),
|
271 |
+
pid = ($( o.item || this ).parent( o.listType )
|
272 |
+
.parent( o.items )
|
273 |
+
.attr( o.attribute || 'id' ) || '')
|
274 |
+
.match( o.expression || (/(.+)[-=_](.+)/) );
|
275 |
+
|
276 |
+
if (res) {
|
277 |
+
str.push(
|
278 |
+
((o.key || res[1]) + '[' + (o.key && o.expression ? res[1] : res[2]) + ']')
|
279 |
+
+ '='
|
280 |
+
+ (pid ? (o.key && o.expression ? pid[1] : pid[2]) : o.rootID)
|
281 |
+
);
|
282 |
+
}
|
283 |
+
}
|
284 |
+
);
|
285 |
+
|
286 |
+
if ( ! str.length && o.key) {
|
287 |
+
str.push( o.key + '=' );
|
288 |
+
}
|
289 |
|
290 |
+
return str.join( '&' );
|
291 |
+
|
292 |
+
},
|
293 |
+
|
294 |
+
toHierarchy: function(options) {
|
295 |
+
|
296 |
+
var o = $.extend( {}, this.options, options ),
|
297 |
+
sDepth = o.startDepthCount || 0,
|
298 |
+
ret = [];
|
299 |
+
|
300 |
+
$( this.element ).children( o.items ).each(
|
301 |
+
function () {
|
302 |
+
var level = _recursiveItems( this );
|
303 |
+
ret.push( level );
|
304 |
+
}
|
305 |
+
);
|
306 |
+
|
307 |
+
return ret;
|
308 |
+
|
309 |
+
function _recursiveItems(item) {
|
310 |
+
var id = ($( item ).attr( o.attribute || 'id' ) || '').match( o.expression || (/(.+)[-=_](.+)/) );
|
311 |
+
if (id) {
|
312 |
+
var currentItem = {"id" : id[2]};
|
313 |
+
if ($( item ).children( o.listType ).children( o.items ).length > 0) {
|
314 |
+
currentItem.children = [];
|
315 |
+
$( item ).children( o.listType ).children( o.items ).each(
|
316 |
+
function() {
|
317 |
+
var level = _recursiveItems( this );
|
318 |
+
currentItem.children.push( level );
|
319 |
+
}
|
320 |
+
);
|
321 |
+
}
|
322 |
+
return currentItem;
|
323 |
+
}
|
324 |
+
}
|
325 |
+
},
|
326 |
+
|
327 |
+
toArray: function(options) {
|
328 |
+
|
329 |
+
var o = $.extend( {}, this.options, options ),
|
330 |
+
sDepth = o.startDepthCount || 0,
|
331 |
+
ret = [],
|
332 |
+
left = 2;
|
333 |
+
|
334 |
+
ret.push(
|
335 |
+
{
|
336 |
+
"item_id": o.rootID,
|
337 |
+
"parent_id": 'none',
|
338 |
+
"depth": sDepth,
|
339 |
+
"left": '1',
|
340 |
+
"right": ($( o.items, this.element ).length + 1) * 2
|
341 |
+
}
|
342 |
+
);
|
343 |
+
|
344 |
+
$( this.element ).children( o.items ).each(
|
345 |
+
function () {
|
346 |
+
left = _recursiveArray( this, sDepth + 1, left );
|
347 |
+
}
|
348 |
+
);
|
349 |
+
|
350 |
+
ret = ret.sort( function(a,b){ return (a.left - b.left); } );
|
351 |
+
|
352 |
+
return ret;
|
353 |
+
|
354 |
+
function _recursiveArray(item, depth, left) {
|
355 |
+
|
356 |
+
var right = left + 1,
|
357 |
+
id,
|
358 |
+
pid;
|
359 |
+
|
360 |
+
if ($( item ).children( o.listType ).children( o.items ).length > 0) {
|
361 |
+
depth ++;
|
362 |
+
$( item ).children( o.listType ).children( o.items ).each(
|
363 |
+
function () {
|
364 |
+
right = _recursiveArray( $( this ), depth, right );
|
365 |
+
}
|
366 |
+
);
|
367 |
+
depth --;
|
368 |
+
}
|
369 |
+
|
370 |
+
id = ($( item ).attr( o.attribute || 'id' )).match( o.expression || (/(.+)[-=_](.+)/) );
|
371 |
+
|
372 |
+
if (depth === sDepth + 1) {
|
373 |
+
pid = o.rootID;
|
374 |
+
} else {
|
375 |
+
var parentItem = ($( item ).parent( o.listType )
|
376 |
+
.parent( o.items )
|
377 |
+
.attr( o.attribute || 'id' ))
|
378 |
+
.match( o.expression || (/(.+)[-=_](.+)/) );
|
379 |
+
pid = parentItem[2];
|
380 |
+
}
|
381 |
+
|
382 |
+
if (id) {
|
383 |
+
ret.push( {"item_id": id[2], "parent_id": pid, "depth": depth, "left": left, "right": right} );
|
384 |
+
}
|
385 |
+
|
386 |
+
left = right + 1;
|
387 |
+
return left;
|
388 |
+
}
|
389 |
|
390 |
+
},
|
391 |
|
392 |
+
_clearEmpty: function(item) {
|
393 |
|
394 |
+
var emptyList = $( item ).children( this.options.listType );
|
395 |
+
if (emptyList.length && ! emptyList.children().length && ! this.options.doNotClear) {
|
396 |
+
emptyList.remove();
|
397 |
+
}
|
398 |
|
399 |
+
},
|
400 |
|
401 |
+
_getLevel: function(item) {
|
402 |
|
403 |
+
var level = 1;
|
404 |
|
405 |
+
if (this.options.listType) {
|
406 |
+
var list = item.closest( this.options.listType );
|
407 |
+
while (list && list.length > 0 &&
|
408 |
+
! list.is( '.ui-sortable' )) {
|
409 |
+
level++;
|
410 |
+
list = list.parent().closest( this.options.listType );
|
411 |
+
}
|
412 |
+
}
|
413 |
|
414 |
+
return level;
|
415 |
+
},
|
416 |
+
|
417 |
+
_getChildLevels: function(parent, depth) {
|
418 |
+
var self = this,
|
419 |
+
o = this.options,
|
420 |
+
result = 0;
|
421 |
+
depth = depth || 0;
|
422 |
+
|
423 |
+
$( parent ).children( o.listType ).children( o.items ).each(
|
424 |
+
function (index, child) {
|
425 |
+
result = Math.max( self._getChildLevels( child, depth + 1 ), result );
|
426 |
+
}
|
427 |
+
);
|
428 |
+
|
429 |
+
return depth ? result + 1 : result;
|
430 |
+
},
|
431 |
+
|
432 |
+
_isAllowed: function(parentItem, level, levels) {
|
433 |
+
var o = this.options,
|
434 |
+
isRoot = $( this.domPosition.parent ).hasClass( 'ui-sortable' ) ? true : false,
|
435 |
+
maxLevels = this.placeholder.closest( '.ui-sortable' ).nestedSortable( 'option', 'maxLevels' ); // this takes into account the maxLevels set to the recipient list
|
436 |
+
|
437 |
+
// Is the root protected?
|
438 |
+
// Are we trying to nest under a no-nest?
|
439 |
+
// Are we nesting too deep?
|
440 |
+
if ( ! o.isAllowed( this.currentItem, parentItem ) ||
|
441 |
+
parentItem && parentItem.hasClass( o.disableNesting ) ||
|
442 |
+
o.protectRoot && (parentItem == null && ! isRoot || isRoot && level > 1)) {
|
443 |
+
this.placeholder.addClass( o.errorClass );
|
444 |
+
if (maxLevels < levels && maxLevels != 0) {
|
445 |
+
this.beyondMaxLevels = levels - maxLevels;
|
446 |
+
} else {
|
447 |
+
this.beyondMaxLevels = 1;
|
448 |
+
}
|
449 |
} else {
|
450 |
+
if (maxLevels < levels && maxLevels != 0) {
|
451 |
+
this.placeholder.addClass( o.errorClass );
|
452 |
+
this.beyondMaxLevels = levels - maxLevels;
|
453 |
+
} else {
|
454 |
+
this.placeholder.removeClass( o.errorClass );
|
455 |
+
this.beyondMaxLevels = 0;
|
456 |
+
}
|
457 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
}
|
|
|
|
|
459 |
|
460 |
+
}
|
461 |
+
)
|
462 |
+
);
|
463 |
|
464 |
+
$.mjs.nestedSortable.prototype.options = $.extend( {}, $.ui.sortable.prototype.options, $.mjs.nestedSortable.prototype.options );
|
465 |
+
})( jQuery );
|
admin/assets/js/vfb-admin.js
CHANGED
@@ -1,594 +1,678 @@
|
|
1 |
-
jQuery(document).ready(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
id = $( last_child ).attr( 'id' ),
|
57 |
-
label = $( last_child ).children( 'label' ).attr( 'for' );
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
div_id = id.replace( new RegExp( /(\d+)$/g ), '' );
|
62 |
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
newElem.find( 'input[type="radio"]' ).attr( 'value', newNum );
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
});
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
|
79 |
-
|
80 |
-
|
|
|
|
|
81 |
|
82 |
-
//
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
99 |
|
100 |
-
//
|
101 |
-
|
102 |
-
|
103 |
-
var newNum = num + 1;
|
104 |
|
105 |
-
|
106 |
-
var id = $( this ).closest( 'div' ).attr( 'id' );
|
107 |
|
108 |
-
|
109 |
-
var label_for = $( this ).closest( 'div' ).find( 'label' ).attr( 'for' );
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
|
115 |
-
|
116 |
-
|
|
|
117 |
|
118 |
-
//
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
121 |
|
122 |
-
|
123 |
-
$( '#' + div_id + num ).after( newElem );
|
124 |
-
});
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
e.preventDefault();
|
129 |
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
-
//
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
139 |
}
|
140 |
-
});
|
141 |
-
|
142 |
-
// !Uncheck Radio button for Options
|
143 |
-
$( '.option input[type="radio"]' ).mousedown( function() {
|
144 |
-
// Save previous value before .click
|
145 |
-
$( this ).attr( 'previousValue', $( this ).prop( 'checked' ) );
|
146 |
-
}).click( function() {
|
147 |
-
var previousValue = $( this ).attr( 'previousValue' );
|
148 |
-
|
149 |
-
// Change checked value if previous value is true
|
150 |
-
if ( previousValue == 'true' )
|
151 |
-
$( this ).prop( 'checked', false );
|
152 |
-
});
|
153 |
-
|
154 |
-
// !Delete menu or entry
|
155 |
-
$( '.menu-delete' ).click( function( ) {
|
156 |
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
174 |
-
|
|
|
|
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
}
|
180 |
-
else {
|
181 |
-
item.removeClass( 'vfb-menu-item-active' )
|
182 |
-
.addClass( 'vfb-menu-item-inactive' );
|
183 |
-
}
|
184 |
-
});
|
185 |
-
|
186 |
-
// !Fieldset first check
|
187 |
-
function is_fieldset_first( item ) {
|
188 |
-
if ( 'FIELDSET' !== item )
|
189 |
-
$( '#vfb-fieldset-first-warning' ).show();
|
190 |
-
else
|
191 |
-
$( '#vfb-fieldset-first-warning' ).hide();
|
192 |
-
}
|
193 |
-
|
194 |
-
// !Nest and Sort fields
|
195 |
-
$( '#vfb-menu-to-edit' ).nestedSortable({
|
196 |
-
listType: 'ul',
|
197 |
-
maxLevels: 3,
|
198 |
-
handle: '.vfb-menu-item-handle',
|
199 |
-
placeholder: 'vfb-sortable-placeholder',
|
200 |
-
forcePlaceholderSize: true,
|
201 |
-
forceHelperSize: true,
|
202 |
-
tolerance: 'pointer',
|
203 |
-
toleranceElement: '> dl',
|
204 |
-
items: 'li:not(.ui-state-disabled)',
|
205 |
-
create: function( event, ui ){
|
206 |
-
// Make sure the page doesn't jump when at the bottom
|
207 |
-
$( this ).css( 'min-height', $( this ).height() );
|
208 |
-
},
|
209 |
-
start: function( event, ui ){
|
210 |
-
// Adjust placeholder size for how many items we're dragging
|
211 |
-
ui.placeholder.height( ui.item.height() );
|
212 |
-
},
|
213 |
-
stop: function( event, ui ){
|
214 |
-
// Get the first item after sorting
|
215 |
-
var sorted_first_item = $( '#vfb-menu-to-edit .item-type:first' ).text();
|
216 |
-
|
217 |
-
opts = {
|
218 |
-
url: ajaxurl,
|
219 |
-
type: 'POST',
|
220 |
-
async: true,
|
221 |
-
cache: false,
|
222 |
-
data: {
|
223 |
-
action: 'visual_form_builder_sort_field',
|
224 |
-
order: $( this ).nestedSortable( 'toArray' )
|
225 |
-
},
|
226 |
-
success: function( response ) {
|
227 |
-
$( '#loading-animation' ).hide(); // Hide the loading animation
|
228 |
|
229 |
-
|
|
|
|
|
|
|
|
|
230 |
|
231 |
-
|
232 |
-
|
233 |
-
};
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
});
|
238 |
|
239 |
-
|
240 |
-
|
241 |
-
e.preventDefault();
|
242 |
-
$( this ).data( 'submit_value', $( this ).text() );
|
243 |
-
});
|
244 |
|
245 |
-
|
246 |
-
|
247 |
-
|
|
|
|
|
|
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
previous = $( '#vfb-menu-to-edit li.ui-state-disabled:first' ).attr( 'id' ).match( new RegExp( /(\d+)$/g ) )[0];
|
252 |
|
253 |
-
|
|
|
|
|
254 |
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
}
|
264 |
-
)
|
265 |
-
$( 'img.waiting' ).hide();
|
266 |
-
|
267 |
-
// Insert the new field last and before the Submit button
|
268 |
-
$( response ).hide().insertBefore( '#vfb-menu-to-edit li.ui-state-disabled:first' ).fadeIn();
|
269 |
-
});
|
270 |
-
});
|
271 |
-
|
272 |
-
// !Delete fields
|
273 |
-
$( document ).on( 'click', 'a.item-delete', function( e ) {
|
274 |
-
|
275 |
-
e.preventDefault();
|
276 |
-
|
277 |
-
var data = childs = new Array(),
|
278 |
-
parent = 0,
|
279 |
-
href = $( this ).attr( 'href' ), url = href.split( '&' ),
|
280 |
-
confirm_delete = confirm( "You are about to permanently delete this field.\n'Cancel' to stop, 'OK' to delete." );
|
281 |
-
|
282 |
-
if ( !confirm_delete )
|
283 |
-
return false;
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
|
291 |
-
|
292 |
-
|
|
|
|
|
293 |
|
294 |
-
|
295 |
-
|
296 |
|
297 |
-
|
298 |
-
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
childs[ i ] = $( this ).attr( 'id' ).match( new RegExp( /(\d+)$/g ) )[0];
|
303 |
-
});
|
304 |
|
305 |
-
|
306 |
-
var t = $( this ).closest( 'li.form-item' ).parents( 'li.form-item' );
|
307 |
|
308 |
-
|
309 |
-
|
310 |
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
|
|
|
|
320 |
}
|
321 |
-
)
|
322 |
-
$( '#form_item_' + data['field'] ).addClass( 'deleting' ).animate({
|
323 |
-
opacity : 0,
|
324 |
-
height: 0
|
325 |
-
}, 350, function() {
|
326 |
-
$( this ).before( child_html ).remove();
|
327 |
-
});
|
328 |
-
});
|
329 |
-
});
|
330 |
-
|
331 |
-
// !Form Settings
|
332 |
-
$( '#form-settings-button' ).click( function(e){
|
333 |
-
e.preventDefault();
|
334 |
-
|
335 |
-
$( this ).toggleClass( 'current' );
|
336 |
-
|
337 |
-
$( '#form-settings' ).slideToggle( 'fast' );
|
338 |
-
|
339 |
-
var form_id = $( 'input[name="form_id"]' ).val(),
|
340 |
-
state = ( $( this ).hasClass( 'current' ) ) ? 'opened' : 'closed';
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
page: pagenow
|
348 |
-
}
|
349 |
-
).done( function( response ) {
|
350 |
-
if ( state == 'closed' ) {
|
351 |
-
$( '.settings-links' ).removeClass( 'on' );
|
352 |
-
$( '.settings-links:first' ).addClass( 'on' );
|
353 |
-
$( '.form-details' ).slideUp( 'normal' );
|
354 |
-
$( '.form-details:first' ).show( 'normal' );
|
355 |
}
|
356 |
-
|
357 |
-
});
|
358 |
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
|
363 |
-
|
364 |
-
|
|
|
|
|
|
|
365 |
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
-
//
|
370 |
-
if( $(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
|
372 |
-
|
|
|
|
|
|
|
373 |
|
374 |
-
|
375 |
-
|
376 |
|
377 |
-
|
378 |
-
accordion = this.hash.replace( /#/g, '' );
|
379 |
|
380 |
-
|
381 |
-
|
382 |
-
action: 'visual_form_builder_form_settings',
|
383 |
-
form: form_id,
|
384 |
-
accordion: accordion,
|
385 |
-
page: pagenow
|
386 |
}
|
387 |
);
|
388 |
-
});
|
389 |
-
|
390 |
-
// !Ask to Save before navigating away from page
|
391 |
-
var vfb_forms_changed = false;
|
392 |
-
$( '#vfb-form-builder-management input, #vfb-form-builder-management select, #vfb-form-builder-management textarea' ).change( function(){
|
393 |
-
vfb_register_change();
|
394 |
-
});
|
395 |
-
|
396 |
-
function vfb_register_change() {
|
397 |
-
vfb_forms_changed = true;
|
398 |
-
}
|
399 |
-
|
400 |
-
window.onbeforeunload = function(){
|
401 |
-
if ( vfb_forms_changed )
|
402 |
-
return 'The changes you made will be lost if you navigate away from this page.';
|
403 |
-
};
|
404 |
-
|
405 |
-
$( document ).on( 'submit', '#visual-form-builder-update', function() {
|
406 |
-
window.onbeforeunload = null;
|
407 |
-
});
|
408 |
-
|
409 |
-
// !Sticky sidebar
|
410 |
-
if ( $( '.columns-2 #side-sortables' ).length > 0 ) {
|
411 |
-
var sidebar = $( '#vfb_form_items_meta_box' ),
|
412 |
-
sidebar_width = sidebar.width(),
|
413 |
-
offset = sidebar.offset(),
|
414 |
-
next_box = sidebar.nextAll(),
|
415 |
-
hidden = false;
|
416 |
-
|
417 |
-
$( window ).on( 'scroll', function() {
|
418 |
-
if ( $( window ).scrollTop() > offset.top ) {
|
419 |
-
|
420 |
-
sidebar.stop().css({
|
421 |
-
'top' : 55,
|
422 |
-
'position' : 'fixed',
|
423 |
-
'z-index' : '1',
|
424 |
-
'width' : sidebar_width
|
425 |
-
});
|
426 |
-
|
427 |
-
// change opacity of other meta boxes if visible
|
428 |
-
if ( next_box.is( ':visible' ) ) {
|
429 |
-
hidden = true;
|
430 |
-
next_box.stop().css({
|
431 |
-
'opacity' : 0.1
|
432 |
-
});
|
433 |
-
}
|
434 |
-
|
435 |
-
} else {
|
436 |
-
sidebar.stop().css({
|
437 |
-
'top' : 0,
|
438 |
-
'position': 'relative'
|
439 |
-
});
|
440 |
-
|
441 |
-
// only change opacity if meta box was changed
|
442 |
-
if ( hidden ) {
|
443 |
-
next_box.stop().css({
|
444 |
-
'opacity' : 1
|
445 |
-
});
|
446 |
-
}
|
447 |
-
};
|
448 |
-
});
|
449 |
-
}
|
450 |
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
$( '#vfb-field-tabs li' ).removeClass( 'tabs' ); //Remove any "active" class
|
482 |
-
$( this ).parent().addClass( 'tabs' ); //Add "active" class to selected tab
|
483 |
-
|
484 |
-
$( '.tabs-panel-active' ).removeClass( 'tabs-panel-active' ).addClass( 'tabs-panel-inactive' );
|
485 |
-
|
486 |
-
var activeTab = this.hash; //Find the href attribute value to identify the active tab + content
|
487 |
-
$( activeTab ).removeClass( 'tabs-panel-inactive' ).addClass( 'tabs-panel-active' );
|
488 |
-
});
|
489 |
-
|
490 |
-
// !Validate the sender details section
|
491 |
-
$( '#visual-form-builder-update' ).validate({
|
492 |
-
rules: {
|
493 |
-
'form_email_to[]': {
|
494 |
-
email: true
|
495 |
-
},
|
496 |
-
form_email_from: {
|
497 |
-
email: true
|
498 |
-
},
|
499 |
-
form_success_message_redirect: {
|
500 |
-
url: true
|
501 |
-
},
|
502 |
-
form_notification_email_name: {
|
503 |
-
required: function( element ){
|
504 |
-
return $( '#form-notification-setting' ).is( ':checked' );
|
505 |
-
}
|
506 |
-
},
|
507 |
-
form_notification_email_from: {
|
508 |
-
required: function( element ){
|
509 |
-
return $( '#form-notification-setting' ).is( ':checked' );
|
510 |
},
|
511 |
-
|
512 |
-
|
513 |
-
form_notification_email: {
|
514 |
-
required: function( element ){
|
515 |
-
return $( '#form-notification-setting' ).is( ':checked' );
|
516 |
}
|
517 |
}
|
518 |
-
|
519 |
-
errorPlacement: function( error, element ) {
|
520 |
-
error.insertAfter( element.parent() );
|
521 |
-
}
|
522 |
-
});
|
523 |
-
|
524 |
-
$( '#visual-form-builder-new-form' ).validate();
|
525 |
-
|
526 |
-
// !Sender Name field readonly if the override is active
|
527 |
-
$( '#form_email_from_name_override' ).change( function(){
|
528 |
-
if ( $( '#form_email_from_name_override' ).val() == '' )
|
529 |
-
$( '#form-email-sender-name' ).prop( 'readonly', false );
|
530 |
-
else
|
531 |
-
$( '#form-email-sender-name' ).prop( 'readonly', 'readonly' );
|
532 |
-
});
|
533 |
-
|
534 |
-
// !Sender Email field readonly if the override is active
|
535 |
-
$( '#form_email_from_override' ).change( function(){
|
536 |
-
if ( $( '#form_email_from_override' ).val() == '' )
|
537 |
-
$( '#form-email-sender' ).prop( 'readonly', false );
|
538 |
-
else
|
539 |
-
$( '#form-email-sender' ).prop( 'readonly', 'readonly' );
|
540 |
-
});
|
541 |
|
|
|
542 |
|
543 |
-
|
544 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
|
546 |
-
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
|
550 |
-
|
551 |
-
|
552 |
-
$( '#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry' ).prop( 'disabled', false );
|
553 |
-
}
|
554 |
-
else{
|
555 |
-
$( '#notification-email' ).hide();
|
556 |
-
$( '#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry' ).prop( 'disabled', 'disabled' );
|
557 |
-
}
|
558 |
-
});
|
559 |
|
560 |
-
|
561 |
-
|
562 |
-
|
|
|
563 |
|
564 |
-
|
565 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
566 |
|
567 |
-
|
568 |
-
|
|
|
|
|
569 |
|
570 |
-
|
571 |
-
|
|
|
572 |
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
|
577 |
-
|
|
|
|
|
578 |
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
584 |
}
|
585 |
-
)
|
586 |
-
|
587 |
-
|
588 |
-
$( '#vfb-export-entries-fields' ).html( 'Error loading entry fields.' );
|
589 |
-
});
|
590 |
-
});
|
591 |
-
});
|
592 |
|
593 |
/**
|
594 |
* Accordion-folding functionality.
|
@@ -622,20 +706,26 @@ jQuery(document).ready(function($) {
|
|
622 |
|
623 |
( function( $ ){
|
624 |
|
625 |
-
$( document ).ready(
|
|
|
626 |
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
|
|
|
|
|
|
632 |
|
633 |
-
|
634 |
|
635 |
-
|
636 |
-
|
|
|
637 |
|
638 |
-
|
|
|
639 |
|
640 |
/**
|
641 |
* Close the current accordion section and open a new one.
|
@@ -645,8 +735,8 @@ jQuery(document).ready(function($) {
|
|
645 |
*/
|
646 |
function vfbAccordionSwitch ( el ) {
|
647 |
var section = el.closest( '.vfb-accordion-section' ),
|
648 |
-
|
649 |
-
|
650 |
|
651 |
// This section has no content and cannot be expanded.
|
652 |
if ( section.hasClass( 'cannot-expand' ) ) {
|
@@ -664,4 +754,4 @@ jQuery(document).ready(function($) {
|
|
664 |
}
|
665 |
}
|
666 |
|
667 |
-
})(jQuery);
|
1 |
+
jQuery( document ).ready(
|
2 |
+
function($) {
|
3 |
+
// Initialize our tooltip timeout var
|
4 |
+
var tooltip_timeout = null;
|
5 |
+
|
6 |
+
// !Display/Hide the tooltip
|
7 |
+
$( document ).on(
|
8 |
+
'mouseenter mouseleave',
|
9 |
+
'.vfb-tooltip',
|
10 |
+
function( e ) {
|
11 |
+
// If mouse over tooltips
|
12 |
+
if ( e.type == 'mouseenter' ) {
|
13 |
+
// Clear the timeout of our tooltip, if it exists
|
14 |
+
if ( tooltip_timeout ) {
|
15 |
+
clearTimeout( tooltip_timeout );
|
16 |
+
tooltip_timeout = null;
|
17 |
+
}
|
18 |
+
|
19 |
+
var tip_title = $( this ).attr( 'title' ),
|
20 |
+
tip = $( this ).attr( 'rel' ),
|
21 |
+
width = $( this ).width();
|
22 |
+
|
23 |
+
// Create our tooltip popup
|
24 |
+
$( this ).append( '<div class="vfb-tooltip-popup"><h3>' + tip_title + '</h3><p>' + tip + '</p></div>' );
|
25 |
+
|
26 |
+
// Save the title before we remove it
|
27 |
+
$.data( this, 'title', tip_title );
|
28 |
+
|
29 |
+
// Remove the title so the browser tooltip doesn't display
|
30 |
+
this.title = '';
|
31 |
+
|
32 |
+
// Move over the div so it's not on top of the link
|
33 |
+
$( this ).find( '.vfb-tooltip-popup' ).css( {left:width + 22} );
|
34 |
+
|
35 |
+
// Set a timer for hover intent
|
36 |
+
tooltip_timeout = setTimeout(
|
37 |
+
function(){
|
38 |
+
$( '.vfb-tooltip-popup' ).fadeIn( 300 );
|
39 |
+
},
|
40 |
+
500
|
41 |
+
);
|
42 |
+
} else {
|
43 |
+
// Add the title back
|
44 |
+
this.title = $.data( this, 'title' );
|
45 |
+
|
46 |
+
// Close the tooltip
|
47 |
+
$( '.vfb-tooltip-popup' ).fadeOut( 500 );
|
48 |
+
|
49 |
+
// Remove the appended tooltip div
|
50 |
+
$( this ).children().remove();
|
51 |
+
}
|
52 |
}
|
53 |
+
);
|
54 |
|
55 |
+
// !Dynamically add options for Select, Radio, and Checkbox
|
56 |
+
$( document ).on(
|
57 |
+
'click',
|
58 |
+
'a.vfb-add-option',
|
59 |
+
function( e ) {
|
60 |
+
e.preventDefault();
|
61 |
+
|
62 |
+
var clones = $( this ).parent().siblings( '.vfb-cloned-options' ),
|
63 |
+
children = clones.children(),
|
64 |
+
num = children.length, newNum = num + 1,
|
65 |
+
last_child = children[ num - 1 ],
|
66 |
+
id = $( last_child ).attr( 'id' ),
|
67 |
+
label = $( last_child ).children( 'label' ).attr( 'for' );
|
68 |
+
|
69 |
+
// Strip out the last number (i.e. count) from the for to make a new ID
|
70 |
+
var new_id = label.replace( new RegExp( /(\d+)$/g ), '' ),
|
71 |
+
div_id = id.replace( new RegExp( /(\d+)$/g ), '' );
|
72 |
+
|
73 |
+
// Clone this div and change the ID
|
74 |
+
var newElem = $( '#' + id ).clone().attr( 'id', div_id + newNum );
|
75 |
+
|
76 |
+
// Change the IDs of the for and input to match
|
77 |
+
newElem.children( 'label' ).attr( 'for', new_id + newNum );
|
78 |
+
newElem.find( 'input[type="text"]' ).attr( 'id', new_id + newNum );
|
79 |
+
newElem.find( 'input[type="radio"]' ).attr( 'value', newNum );
|
80 |
+
|
81 |
+
// Insert our cloned option after the last one
|
82 |
+
$( '#' + div_id + num ).after( newElem );
|
83 |
+
}
|
84 |
+
);
|
85 |
|
86 |
+
// !Dynamically delete options for Select, Radio, and Checkbox
|
87 |
+
$( document ).on(
|
88 |
+
'click',
|
89 |
+
'a.deleteOption',
|
90 |
+
function( e ) {
|
91 |
+
e.preventDefault();
|
92 |
+
|
93 |
+
// Get how many options we already have
|
94 |
+
var num = $( this ).parent().parent().find( '.clonedOption' ).length;
|
95 |
+
|
96 |
+
// If there's only one option left, don't let someone delete it
|
97 |
+
if ( num - 1 == 0 ) {
|
98 |
+
alert( 'You must have at least one option.' );
|
99 |
+
} else {
|
100 |
+
$( this ).closest( 'div' ).remove();
|
101 |
+
}
|
102 |
+
}
|
103 |
+
);
|
104 |
|
105 |
+
// !Sort options
|
106 |
+
$( '.vfb-cloned-options' ).sortable(
|
107 |
+
{
|
108 |
+
items: 'div.option'
|
109 |
+
}
|
110 |
+
);
|
111 |
|
112 |
+
// !Add values for the E-mail(s) To field
|
113 |
+
$( document ).on(
|
114 |
+
'click',
|
115 |
+
'a.addEmail',
|
116 |
+
function( e ) {
|
117 |
+
e.preventDefault();
|
118 |
|
119 |
+
// Get how many options we already have
|
120 |
+
var num = $( this ).closest( '#email-details' ).find( '.clonedOption' ).length;
|
121 |
+
// Add one to how many options
|
122 |
+
var newNum = num + 1;
|
|
|
|
|
123 |
|
124 |
+
// Get this div's ID
|
125 |
+
var id = $( this ).closest( 'div' ).attr( 'id' );
|
|
|
126 |
|
127 |
+
// Get this div's for attribute, which matches the input's ID
|
128 |
+
var label_for = $( this ).closest( 'div' ).find( 'label' ).attr( 'for' );
|
129 |
|
130 |
+
// Strip out the last number (i.e. count) from the for to make a new ID
|
131 |
+
var new_id = label_for.replace( new RegExp( /(\d+)$/g ), '' );
|
132 |
+
var div_id = id.replace( new RegExp( /(\d+)$/g ), '' );
|
|
|
133 |
|
134 |
+
// Clone this div and change the ID
|
135 |
+
var newElem = $( '#' + id ).clone().attr( 'id', div_id + newNum );
|
|
|
136 |
|
137 |
+
// Change the IDs of the for and input to match
|
138 |
+
newElem.find( 'label' ).attr( 'for', new_id + newNum );
|
139 |
+
newElem.find( 'input' ).attr( 'id', new_id + newNum );
|
140 |
|
141 |
+
// Insert our cloned option after the last one
|
142 |
+
$( '#' + div_id + num ).after( newElem );
|
143 |
+
}
|
144 |
+
);
|
145 |
|
146 |
+
// !Delete values for the E-mail(s) To field
|
147 |
+
$( document ).on(
|
148 |
+
'click',
|
149 |
+
'a.deleteEmail',
|
150 |
+
function( e ) {
|
151 |
+
e.preventDefault();
|
152 |
+
|
153 |
+
// Get how many options we already have
|
154 |
+
var num = $( this ).closest( '#email-details' ).find( '.clonedOption' ).length
|
155 |
+
|
156 |
+
// If there's only one option left, don't let someone delete it
|
157 |
+
if ( num - 1 == 0 ) {
|
158 |
+
alert( 'You must have at least one option.' );
|
159 |
+
} else {
|
160 |
+
$( this ).closest( 'div' ).remove();
|
161 |
+
}
|
162 |
+
}
|
163 |
+
);
|
164 |
|
165 |
+
// !Uncheck Radio button for Options
|
166 |
+
$( '.option input[type="radio"]' ).mousedown(
|
167 |
+
function() {
|
168 |
+
// Save previous value before .click
|
169 |
+
$( this ).attr( 'previousValue', $( this ).prop( 'checked' ) );
|
170 |
+
}
|
171 |
+
).click(
|
172 |
+
function() {
|
173 |
+
var previousValue = $( this ).attr( 'previousValue' );
|
174 |
|
175 |
+
// Change checked value if previous value is true
|
176 |
+
if ( previousValue == 'true' ) {
|
177 |
+
$( this ).prop( 'checked', false );
|
178 |
+
}
|
179 |
+
}
|
180 |
+
);
|
181 |
|
182 |
+
// !Delete menu or entry
|
183 |
+
$( '.menu-delete' ).click(
|
184 |
+
function( ) {
|
|
|
185 |
|
186 |
+
var message = ( $( this ).hasClass( 'entry-delete' ) ) ? 'entry' : 'form';
|
|
|
187 |
|
188 |
+
var confirm_delete = confirm( "You are about to permanently delete this " + message + " and all of its data.\n'Cancel' to stop, 'OK' to delete." );
|
|
|
189 |
|
190 |
+
if ( confirm_delete ) {
|
191 |
+
return true;
|
192 |
+
}
|
193 |
|
194 |
+
return false;
|
195 |
+
}
|
196 |
+
);
|
197 |
|
198 |
+
// !Field item details box toggle
|
199 |
+
$( document ).on(
|
200 |
+
'click',
|
201 |
+
'a.item-edit',
|
202 |
+
function( e ){
|
203 |
+
e.preventDefault();
|
204 |
|
205 |
+
$( e.target ).closest( 'li' ).children( '.menu-item-settings' ).slideToggle( 'fast' );
|
|
|
|
|
206 |
|
207 |
+
$( this ).toggleClass( 'opened' );
|
208 |
+
var item = $( e.target ).closest( 'dl' );
|
|
|
209 |
|
210 |
+
if ( item.hasClass( 'vfb-menu-item-inactive' ) ) {
|
211 |
+
item.removeClass( 'vfb-menu-item-inactive' )
|
212 |
+
.addClass( 'vfb-menu-item-active' );
|
213 |
+
} else {
|
214 |
+
item.removeClass( 'vfb-menu-item-active' )
|
215 |
+
.addClass( 'vfb-menu-item-inactive' );
|
216 |
+
}
|
217 |
+
}
|
218 |
+
);
|
219 |
|
220 |
+
// !Fieldset first check
|
221 |
+
function is_fieldset_first( item ) {
|
222 |
+
if ( 'FIELDSET' !== item ) {
|
223 |
+
$( '#vfb-fieldset-first-warning' ).show();
|
224 |
+
} else {
|
225 |
+
$( '#vfb-fieldset-first-warning' ).hide();
|
226 |
+
}
|
227 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
+
// !Nest and Sort fields
|
230 |
+
$( '#vfb-menu-to-edit' ).sortable(
|
231 |
+
{
|
232 |
+
handle: '.vfb-menu-item-handle',
|
233 |
+
placeholder: 'vfb-sortable-placeholder',
|
234 |
+
forcePlaceholderSize: true,
|
235 |
+
forceHelperSize: true,
|
236 |
+
tolerance: 'pointer',
|
237 |
+
items: 'li:not(.ui-state-disabled)',
|
238 |
+
create: function( event, ui ){
|
239 |
+
// Make sure the page doesn't jump when at the bottom
|
240 |
+
$( this ).css( 'min-height', $( this ).height() );
|
241 |
+
},
|
242 |
+
stop: function( event, ui ){
|
243 |
+
// Get the first item after sorting
|
244 |
+
var sorted_first_item = $( '#vfb-menu-to-edit .item-type:first' ).text();
|
245 |
+
|
246 |
+
$.post(
|
247 |
+
ajaxurl,
|
248 |
+
{
|
249 |
+
action: 'visual_form_builder_sort_field',
|
250 |
+
order: $( this ).sortable( 'serialize' )
|
251 |
+
}
|
252 |
+
).done(
|
253 |
+
function( response ) {
|
254 |
+
$( '#loading-animation' ).hide();
|
255 |
+
is_fieldset_first( sorted_first_item );
|
256 |
+
}
|
257 |
+
);
|
258 |
+
}
|
259 |
+
}
|
260 |
+
);
|
261 |
|
262 |
+
// !Get the clicked value for creating a new field item
|
263 |
+
$( '#vfb-form-items .vfb-draggable-form-items' ).click(
|
264 |
+
function( e ) {
|
265 |
+
e.preventDefault();
|
266 |
+
$( this ).data( 'submit_value', $( this ).text() );
|
267 |
+
}
|
268 |
+
);
|
269 |
|
270 |
+
// !Create fields
|
271 |
+
$( '#vfb-form-items .vfb-draggable-form-items' ).click(
|
272 |
+
function( e ) {
|
273 |
+
e.preventDefault();
|
274 |
+
|
275 |
+
var d = $( this ).closest( 'form' ).serializeArray(),
|
276 |
+
field_type = $( this ).data( 'submit_value' ),
|
277 |
+
previous = $( '#vfb-menu-to-edit li.ui-state-disabled:first' ).attr( 'id' ).match( new RegExp( /(\d+)$/g ) )[0];
|
278 |
+
|
279 |
+
$( 'img.waiting' ).show();
|
280 |
+
|
281 |
+
$.post(
|
282 |
+
ajaxurl,
|
283 |
+
{
|
284 |
+
action: 'visual_form_builder_create_field',
|
285 |
+
data: d,
|
286 |
+
field_type: field_type,
|
287 |
+
previous: previous,
|
288 |
+
page: pagenow,
|
289 |
+
nonce: $( '#_wpnonce' ).val()
|
290 |
+
}
|
291 |
+
).done(
|
292 |
+
function( response ) {
|
293 |
+
$( 'img.waiting' ).hide();
|
294 |
+
|
295 |
+
// Insert the new field last and before the Submit button
|
296 |
+
$( response ).hide().insertBefore( '#vfb-menu-to-edit li.ui-state-disabled:first' ).fadeIn();
|
297 |
+
}
|
298 |
+
);
|
299 |
+
}
|
300 |
+
);
|
301 |
|
302 |
+
// !Delete fields
|
303 |
+
$( document ).on(
|
304 |
+
'click',
|
305 |
+
'a.item-delete',
|
306 |
+
function( e ) {
|
307 |
|
308 |
+
e.preventDefault();
|
309 |
|
310 |
+
var data = childs = new Array(),
|
311 |
+
parent = 0,
|
312 |
+
href = $( this ).attr( 'href' ), url = href.split( '&' ),
|
313 |
+
confirm_delete = confirm( "You are about to permanently delete this field.\n'Cancel' to stop, 'OK' to delete." );
|
314 |
|
315 |
+
if ( ! confirm_delete ) {
|
316 |
+
return false;
|
317 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
|
319 |
+
for ( var i = 0; i < url.length; i++ ) {
|
320 |
+
// break each pair at the first "=" to obtain the argname and value
|
321 |
+
var pos = url[i].indexOf( '=' );
|
322 |
+
var argname = url[i].substring( 0, pos );
|
323 |
+
var value = url[i].substring( pos + 1 );
|
324 |
|
325 |
+
data[ argname ] = value;
|
326 |
+
}
|
|
|
327 |
|
328 |
+
// Find the deleted item's children
|
329 |
+
var children = $( this ).closest( '.form-item' ).find( 'ul' ).children();
|
|
|
330 |
|
331 |
+
// Save the children's HTML
|
332 |
+
var child_html = children.parent().html();
|
|
|
|
|
|
|
333 |
|
334 |
+
// Loop through each child and get the ID
|
335 |
+
children.each(
|
336 |
+
function( i ) {
|
337 |
+
childs[ i ] = $( this ).attr( 'id' ).match( new RegExp( /(\d+)$/g ) )[0];
|
338 |
+
}
|
339 |
+
);
|
340 |
|
341 |
+
// The closest parent (<li>) to the child items
|
342 |
+
var t = $( this ).closest( 'li.form-item' ).parents( 'li.form-item' );
|
|
|
343 |
|
344 |
+
if ( t.length ) {
|
345 |
+
parent = t.attr( 'id' ).match( new RegExp( /(\d+)$/g ) )[0];
|
346 |
+
}
|
347 |
|
348 |
+
$.post(
|
349 |
+
ajaxurl,
|
350 |
+
{
|
351 |
+
action: 'visual_form_builder_delete_field',
|
352 |
+
form: data['form'],
|
353 |
+
field: data['field'],
|
354 |
+
child_ids: childs,
|
355 |
+
parent_id: parent,
|
356 |
+
page: pagenow,
|
357 |
+
nonce: data['_wpnonce']
|
358 |
+
}
|
359 |
+
).done(
|
360 |
+
function( response ) {
|
361 |
+
$( '#form_item_' + data['field'] ).addClass( 'deleting' ).animate(
|
362 |
+
{
|
363 |
+
opacity : 0,
|
364 |
+
height: 0
|
365 |
+
},
|
366 |
+
350,
|
367 |
+
function() {
|
368 |
+
$( this ).before( child_html ).remove();
|
369 |
+
}
|
370 |
+
);
|
371 |
+
}
|
372 |
+
);
|
373 |
}
|
374 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
|
376 |
+
// !Form Settings
|
377 |
+
$( '#form-settings-button' ).click(
|
378 |
+
function(e){
|
379 |
+
e.preventDefault();
|
380 |
+
|
381 |
+
$( this ).toggleClass( 'current' );
|
382 |
+
|
383 |
+
$( '#form-settings' ).slideToggle( 'fast' );
|
384 |
+
|
385 |
+
var form_id = $( 'input[name="form_id"]' ).val(),
|
386 |
+
state = ( $( this ).hasClass( 'current' ) ) ? 'opened' : 'closed';
|
387 |
+
|
388 |
+
$.post(
|
389 |
+
ajaxurl,
|
390 |
+
{
|
391 |
+
action: 'visual_form_builder_form_settings',
|
392 |
+
form: form_id,
|
393 |
+
status: state,
|
394 |
+
page: pagenow
|
395 |
+
}
|
396 |
+
).done(
|
397 |
+
function( response ) {
|
398 |
+
if ( state == 'closed' ) {
|
399 |
+
$( '.settings-links' ).removeClass( 'on' );
|
400 |
+
$( '.settings-links:first' ).addClass( 'on' );
|
401 |
+
$( '.form-details' ).slideUp( 'normal' );
|
402 |
+
$( '.form-details:first' ).show( 'normal' );
|
403 |
+
}
|
404 |
+
}
|
405 |
+
);
|
406 |
+
}
|
407 |
+
);
|
408 |
|
409 |
+
// !Form Settings - internal links
|
410 |
+
$( '.settings-links' ).click(
|
411 |
+
function(e){
|
412 |
+
e.preventDefault();
|
413 |
|
414 |
+
// Remove the 'on' class from all buttons
|
415 |
+
$( '.settings-links' ).removeClass( 'on' );
|
416 |
|
417 |
+
// Always close open slides
|
418 |
+
$( '.form-details' ).slideUp( 'fast' );
|
419 |
|
420 |
+
// If the next slide wasn't open, open it
|
421 |
+
if ( $( this ).next( 'div' ).is( ':hidden' ) == true ) {
|
|
|
|
|
422 |
|
423 |
+
$( this ).addClass( 'on' );
|
|
|
424 |
|
425 |
+
$( this ).next().slideDown( 'normal' );
|
426 |
+
}
|
427 |
|
428 |
+
var form_id = $( 'input[name="form_id"]' ).val(),
|
429 |
+
accordion = this.hash.replace( /#/g, '' );
|
430 |
+
|
431 |
+
$.post(
|
432 |
+
ajaxurl,
|
433 |
+
{
|
434 |
+
action: 'visual_form_builder_form_settings',
|
435 |
+
form: form_id,
|
436 |
+
accordion: accordion,
|
437 |
+
page: pagenow
|
438 |
+
}
|
439 |
+
);
|
440 |
}
|
441 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
|
443 |
+
// !Ask to Save before navigating away from page
|
444 |
+
var vfb_forms_changed = false;
|
445 |
+
$( '#vfb-form-builder-management input, #vfb-form-builder-management select, #vfb-form-builder-management textarea' ).change(
|
446 |
+
function(){
|
447 |
+
vfb_register_change();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
}
|
449 |
+
);
|
|
|
450 |
|
451 |
+
function vfb_register_change() {
|
452 |
+
vfb_forms_changed = true;
|
453 |
+
}
|
454 |
|
455 |
+
window.onbeforeunload = function(){
|
456 |
+
if ( vfb_forms_changed ) {
|
457 |
+
return 'The changes you made will be lost if you navigate away from this page.';
|
458 |
+
}
|
459 |
+
};
|
460 |
|
461 |
+
$( document ).on(
|
462 |
+
'submit',
|
463 |
+
'#visual-form-builder-update',
|
464 |
+
function() {
|
465 |
+
window.onbeforeunload = null;
|
466 |
+
}
|
467 |
+
);
|
468 |
|
469 |
+
// !Sticky sidebar
|
470 |
+
// if ( $( '.columns-2 #side-sortables' ).length > 0 ) {
|
471 |
+
// var sidebar = $( '#vfb_form_items_meta_box' ),
|
472 |
+
// sidebar_width = sidebar.width(),
|
473 |
+
// offset = sidebar.offset(),
|
474 |
+
// next_box = sidebar.nextAll(),
|
475 |
+
// hidden = false;
|
476 |
+
|
477 |
+
// $( window ).on( 'scroll', function() {
|
478 |
+
// if ( $( window ).scrollTop() > offset.top ) {
|
479 |
+
|
480 |
+
// sidebar.stop().css({
|
481 |
+
// 'top' : 55,
|
482 |
+
// 'position' : 'fixed',
|
483 |
+
// 'z-index' : '1',
|
484 |
+
// 'width' : sidebar_width
|
485 |
+
// });
|
486 |
+
|
487 |
+
// change opacity of other meta boxes if visible
|
488 |
+
// if ( next_box.is( ':visible' ) ) {
|
489 |
+
// hidden = true;
|
490 |
+
// next_box.stop().css({
|
491 |
+
// 'opacity' : 0.1
|
492 |
+
// });
|
493 |
+
// }
|
494 |
+
|
495 |
+
// } else {
|
496 |
+
// sidebar.stop().css({
|
497 |
+
// 'top' : 0,
|
498 |
+
// 'position': 'relative'
|
499 |
+
// });
|
500 |
+
|
501 |
+
// only change opacity if meta box was changed
|
502 |
+
// if ( hidden ) {
|
503 |
+
// next_box.stop().css({
|
504 |
+
// 'opacity' : 1
|
505 |
+
// });
|
506 |
+
// }
|
507 |
+
// };
|
508 |
+
// });
|
509 |
+
// }
|
510 |
+
|
511 |
+
// !Display the selected confirmation type on load
|
512 |
+
var confirmation = $( '.form-success-type:checked' ).val();
|
513 |
+
$( '#form-success-message-' + confirmation ).show();
|
514 |
+
|
515 |
+
// !Confirmation Message tabs
|
516 |
+
$( '.form-success-type' ).change(
|
517 |
+
function(){
|
518 |
+
var type = $( this ).val();
|
519 |
+
|
520 |
+
switch ( type ) {
|
521 |
+
case 'text' :
|
522 |
+
$( '#form-success-message-text' ).show();
|
523 |
+
$( '#form-success-message-page, #form-success-message-redirect' ).hide();
|
524 |
+
break;
|
525 |
+
|
526 |
+
case 'page' :
|
527 |
+
$( '#form-success-message-page' ).show();
|
528 |
+
$( '#form-success-message-text, #form-success-message-redirect' ).hide();
|
529 |
+
break;
|
530 |
+
|
531 |
+
case 'redirect' :
|
532 |
+
$( '#form-success-message-redirect' ).show();
|
533 |
+
$( '#form-success-message-text, #form-success-message-page' ).hide();
|
534 |
+
break;
|
535 |
+
}
|
536 |
+
}
|
537 |
+
);
|
538 |
|
539 |
+
// !Field Types tabs
|
540 |
+
$( '.vfb-field-types' ).click(
|
541 |
+
function( e ){
|
542 |
+
e.preventDefault();
|
543 |
|
544 |
+
$( '#vfb-field-tabs li' ).removeClass( 'tabs' ); // Remove any "active" class
|
545 |
+
$( this ).parent().addClass( 'tabs' ); // Add "active" class to selected tab
|
546 |
|
547 |
+
$( '.tabs-panel-active' ).removeClass( 'tabs-panel-active' ).addClass( 'tabs-panel-inactive' );
|
|
|
548 |
|
549 |
+
var activeTab = this.hash; // Find the href attribute value to identify the active tab + content
|
550 |
+
$( activeTab ).removeClass( 'tabs-panel-inactive' ).addClass( 'tabs-panel-active' );
|
|
|
|
|
|
|
|
|
551 |
}
|
552 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
|
554 |
+
// !Validate the sender details section
|
555 |
+
$( '#visual-form-builder-update' ).validate(
|
556 |
+
{
|
557 |
+
rules: {
|
558 |
+
'form_email_to[]': {
|
559 |
+
email: true
|
560 |
+
},
|
561 |
+
form_email_from: {
|
562 |
+
email: true
|
563 |
+
},
|
564 |
+
form_success_message_redirect: {
|
565 |
+
url: true
|
566 |
+
},
|
567 |
+
form_notification_email_name: {
|
568 |
+
required: function( element ){
|
569 |
+
return $( '#form-notification-setting' ).is( ':checked' );
|
570 |
+
}
|
571 |
+
},
|
572 |
+
form_notification_email_from: {
|
573 |
+
required: function( element ){
|
574 |
+
return $( '#form-notification-setting' ).is( ':checked' );
|
575 |
+
},
|
576 |
+
email: true
|
577 |
+
},
|
578 |
+
form_notification_email: {
|
579 |
+
required: function( element ){
|
580 |
+
return $( '#form-notification-setting' ).is( ':checked' );
|
581 |
+
}
|
582 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
},
|
584 |
+
errorPlacement: function( error, element ) {
|
585 |
+
error.insertAfter( element.parent() );
|
|
|
|
|
|
|
586 |
}
|
587 |
}
|
588 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
|
590 |
+
$( '#visual-form-builder-new-form' ).validate();
|
591 |
|
592 |
+
// !Sender Name field readonly if the override is active
|
593 |
+
$( '#form_email_from_name_override' ).change(
|
594 |
+
function(){
|
595 |
+
if ( $( '#form_email_from_name_override' ).val() == '' ) {
|
596 |
+
$( '#form-email-sender-name' ).prop( 'readonly', false );
|
597 |
+
} else {
|
598 |
+
$( '#form-email-sender-name' ).prop( 'readonly', 'readonly' );
|
599 |
+
}
|
600 |
+
}
|
601 |
+
);
|
602 |
|
603 |
+
// !Sender Email field readonly if the override is active
|
604 |
+
$( '#form_email_from_override' ).change(
|
605 |
+
function(){
|
606 |
+
if ( $( '#form_email_from_override' ).val() == '' ) {
|
607 |
+
$( '#form-email-sender' ).prop( 'readonly', false );
|
608 |
+
} else {
|
609 |
+
$( '#form-email-sender' ).prop( 'readonly', 'readonly' );
|
610 |
+
}
|
611 |
+
}
|
612 |
+
);
|
613 |
|
614 |
+
// !Show/Hide display of Notification fields
|
615 |
+
$( '#notification-email' ).toggle( $( '#form-notification-setting' ).prop( 'checked' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
|
617 |
+
// !Enable/Disable Notification fields
|
618 |
+
$( '#form-notification-setting' ).change(
|
619 |
+
function(){
|
620 |
+
var checked = $( this ).is( ':checked' );
|
621 |
|
622 |
+
if ( checked ) {
|
623 |
+
$( '#notification-email' ).show();
|
624 |
+
$( '#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry' ).prop( 'disabled', false );
|
625 |
+
} else {
|
626 |
+
$( '#notification-email' ).hide();
|
627 |
+
$( '#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry' ).prop( 'disabled', 'disabled' );
|
628 |
+
}
|
629 |
+
}
|
630 |
+
);
|
631 |
|
632 |
+
// !Entries Select All
|
633 |
+
$( '#vfb-export-select-all' ).click(
|
634 |
+
function( e ) {
|
635 |
+
e.preventDefault();
|
636 |
|
637 |
+
$( '#vfb-export-entries-fields input[type="checkbox"]' ).prop( 'checked', true );
|
638 |
+
}
|
639 |
+
);
|
640 |
|
641 |
+
$( '#vfb-export-unselect-all' ).click(
|
642 |
+
function( e ) {
|
643 |
+
e.preventDefault();
|
644 |
|
645 |
+
$( '#vfb-export-entries-fields input[type="checkbox"]' ).prop( 'checked', false );
|
646 |
+
}
|
647 |
+
);
|
648 |
|
649 |
+
// !Entries fields
|
650 |
+
$( '#vfb-export-forms-list' ).change(
|
651 |
+
function(){
|
652 |
+
var form_id = $( this ).val();
|
653 |
+
|
654 |
+
$( '#vfb-export-entries-fields' ).html( 'Loading...' );
|
655 |
+
|
656 |
+
$.get(
|
657 |
+
ajaxurl,
|
658 |
+
{
|
659 |
+
action: 'vfb-export-fields',
|
660 |
+
id: form_id,
|
661 |
+
vfb_ajax_nonce: vfb_settings.vfb_ajax_nonce
|
662 |
+
}
|
663 |
+
).done(
|
664 |
+
function( response ) {
|
665 |
+
$( '#vfb-export-entries-fields' ).html( response );
|
666 |
+
}
|
667 |
+
).fail(
|
668 |
+
function( response ) {
|
669 |
+
$( '#vfb-export-entries-fields' ).html( 'Error loading entry fields.' );
|
670 |
+
}
|
671 |
+
);
|
672 |
}
|
673 |
+
);
|
674 |
+
}
|
675 |
+
);
|
|
|
|
|
|
|
|
|
676 |
|
677 |
/**
|
678 |
* Accordion-folding functionality.
|
706 |
|
707 |
( function( $ ){
|
708 |
|
709 |
+
$( document ).ready(
|
710 |
+
function () {
|
711 |
|
712 |
+
// Expand/Collapse accordion sections on click.
|
713 |
+
$( '.vfb-accordion-container' ).on(
|
714 |
+
'click keydown',
|
715 |
+
'.vfb-accordion-section-title',
|
716 |
+
function( e ) {
|
717 |
+
if ( e.type === 'keydown' && 13 !== e.which ) { // "return" key
|
718 |
+
return;
|
719 |
+
}
|
720 |
|
721 |
+
e.preventDefault(); // Keep this AFTER the key filter above
|
722 |
|
723 |
+
vfbAccordionSwitch( $( this ) );
|
724 |
+
}
|
725 |
+
);
|
726 |
|
727 |
+
}
|
728 |
+
);
|
729 |
|
730 |
/**
|
731 |
* Close the current accordion section and open a new one.
|
735 |
*/
|
736 |
function vfbAccordionSwitch ( el ) {
|
737 |
var section = el.closest( '.vfb-accordion-section' ),
|
738 |
+
siblings = section.closest( '.vfb-accordion-container' ).find( '.open' ),
|
739 |
+
content = section.find( '.vfb-accordion-section-content' );
|
740 |
|
741 |
// This section has no content and cannot be expanded.
|
742 |
if ( section.hasClass( 'cannot-expand' ) ) {
|
754 |
}
|
755 |
}
|
756 |
|
757 |
+
})( jQuery );
|
admin/assets/js/vfb-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready((function(e){var t=null;e(document).on("mouseenter mouseleave",".vfb-tooltip",(function(i){if("mouseenter"==i.type){t&&(clearTimeout(t),t=null);var o=e(this).attr("title"),n=e(this).attr("rel"),a=e(this).width();e(this).append('<div class="vfb-tooltip-popup"><h3>'+o+"</h3><p>"+n+"</p></div>"),e.data(this,"title",o),this.title="",e(this).find(".vfb-tooltip-popup").css({left:a+22}),t=setTimeout((function(){e(".vfb-tooltip-popup").fadeIn(300)}),500)}else this.title=e.data(this,"title"),e(".vfb-tooltip-popup").fadeOut(500),e(this).children().remove()})),e(document).on("click","a.vfb-add-option",(function(t){t.preventDefault();var i=e(this).parent().siblings(".vfb-cloned-options").children(),o=i.length,n=o+1,a=i[o-1],s=e(a).attr("id"),r=e(a).children("label").attr("for").replace(new RegExp(/(\d+)$/g),""),l=s.replace(new RegExp(/(\d+)$/g),""),c=e("#"+s).clone().attr("id",l+n);c.children("label").attr("for",r+n),c.find('input[type="text"]').attr("id",r+n),c.find('input[type="radio"]').attr("value",n),e("#"+l+o).after(c)})),e(document).on("click","a.deleteOption",(function(t){t.preventDefault(),e(this).parent().parent().find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()})),e(".vfb-cloned-options").sortable({items:"div.option"}),e(document).on("click","a.addEmail",(function(t){t.preventDefault();var i=e(this).closest("#email-details").find(".clonedOption").length,o=i+1,n=e(this).closest("div").attr("id"),a=e(this).closest("div").find("label").attr("for").replace(new RegExp(/(\d+)$/g),""),s=n.replace(new RegExp(/(\d+)$/g),""),r=e("#"+n).clone().attr("id",s+o);r.find("label").attr("for",a+o),r.find("input").attr("id",a+o),e("#"+s+i).after(r)})),e(document).on("click","a.deleteEmail",(function(t){t.preventDefault(),e(this).closest("#email-details").find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()})),e('.option input[type="radio"]').mousedown((function(){e(this).attr("previousValue",e(this).prop("checked"))})).click((function(){"true"==e(this).attr("previousValue")&&e(this).prop("checked",!1)})),e(".menu-delete").click((function(){var t=e(this).hasClass("entry-delete")?"entry":"form";return!!confirm("You are about to permanently delete this "+t+" and all of its data.\n'Cancel' to stop, 'OK' to delete.")})),e(document).on("click","a.item-edit",(function(t){t.preventDefault(),e(t.target).closest("li").children(".menu-item-settings").slideToggle("fast"),e(this).toggleClass("opened");var i=e(t.target).closest("dl");i.hasClass("vfb-menu-item-inactive")?i.removeClass("vfb-menu-item-inactive").addClass("vfb-menu-item-active"):i.removeClass("vfb-menu-item-active").addClass("vfb-menu-item-inactive")})),e("#vfb-menu-to-edit").nestedSortable({listType:"ul",maxLevels:3,handle:".vfb-menu-item-handle",placeholder:"vfb-sortable-placeholder",forcePlaceholderSize:!0,forceHelperSize:!0,tolerance:"pointer",toleranceElement:"> dl",items:"li:not(.ui-state-disabled)",create:function(t,i){e(this).css("min-height",e(this).height())},start:function(e,t){t.placeholder.height(t.item.height())},stop:function(t,i){var o=e("#vfb-menu-to-edit .item-type:first").text();opts={url:ajaxurl,type:"POST",async:!0,cache:!1,data:{action:"visual_form_builder_sort_field",order:e(this).nestedSortable("toArray")},success:function(t){e("#loading-animation").hide(),"FIELDSET"!==o?e("#vfb-fieldset-first-warning").show():e("#vfb-fieldset-first-warning").hide()}},e.ajax(opts)}}),e("#vfb-form-items .vfb-draggable-form-items").click((function(t){t.preventDefault(),e(this).data("submit_value",e(this).text())})),e("#vfb-form-items .vfb-draggable-form-items").click((function(t){t.preventDefault();var i=e(this).closest("form").serializeArray(),o=e(this).data("submit_value"),n=e("#vfb-menu-to-edit li.ui-state-disabled:first").attr("id").match(new RegExp(/(\d+)$/g))[0];e("img.waiting").show(),e.post(ajaxurl,{action:"visual_form_builder_create_field",data:i,field_type:o,previous:n,page:pagenow,nonce:e("#_wpnonce").val()}).done((function(t){e("img.waiting").hide(),e(t).hide().insertBefore("#vfb-menu-to-edit li.ui-state-disabled:first").fadeIn()}))})),e(document).on("click","a.item-delete",(function(t){t.preventDefault();var i=childs=new Array,o=0,n=e(this).attr("href").split("&");if(!confirm("You are about to permanently delete this field.\n'Cancel' to stop, 'OK' to delete."))return!1;for(var a=0;a<n.length;a++){var s=n[a].indexOf("="),r=n[a].substring(0,s),l=n[a].substring(s+1);i[r]=l}var c=e(this).closest(".form-item").find("ul").children(),f=c.parent().html();c.each((function(t){childs[t]=e(this).attr("id").match(new RegExp(/(\d+)$/g))[0]}));var d=e(this).closest("li.form-item").parents("li.form-item");d.length&&(o=d.attr("id").match(new RegExp(/(\d+)$/g))[0]),e.post(ajaxurl,{action:"visual_form_builder_delete_field",form:i.form,field:i.field,child_ids:childs,parent_id:o,page:pagenow,nonce:i._wpnonce}).done((function(t){e("#form_item_"+i.field).addClass("deleting").animate({opacity:0,height:0},350,(function(){e(this).before(f).remove()}))}))})),e("#form-settings-button").click((function(t){t.preventDefault(),e(this).toggleClass("current"),e("#form-settings").slideToggle("fast");var i=e('input[name="form_id"]').val(),o=e(this).hasClass("current")?"opened":"closed";e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,status:o,page:pagenow}).done((function(t){"closed"==o&&(e(".settings-links").removeClass("on"),e(".settings-links:first").addClass("on"),e(".form-details").slideUp("normal"),e(".form-details:first").show("normal"))}))})),e(".settings-links").click((function(t){t.preventDefault(),e(".settings-links").removeClass("on"),e(".form-details").slideUp("fast"),1==e(this).next("div").is(":hidden")&&(e(this).addClass("on"),e(this).next().slideDown("normal"));var i=e('input[name="form_id"]').val(),o=this.hash.replace(/#/g,"");e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,accordion:o,page:pagenow})}));var i=!1;if(e("#vfb-form-builder-management input, #vfb-form-builder-management select, #vfb-form-builder-management textarea").change((function(){i=!0})),window.onbeforeunload=function(){if(i)return"The changes you made will be lost if you navigate away from this page."},e(document).on("submit","#visual-form-builder-update",(function(){window.onbeforeunload=null})),e(".columns-2 #side-sortables").length>0){var o=e("#vfb_form_items_meta_box"),n=o.width(),a=o.offset(),s=o.nextAll(),r=!1;e(window).on("scroll",(function(){e(window).scrollTop()>a.top?(o.stop().css({top:55,position:"fixed","z-index":"1",width:n}),s.is(":visible")&&(r=!0,s.stop().css({opacity:.1}))):(o.stop().css({top:0,position:"relative"}),r&&s.stop().css({opacity:1}))}))}var l=e(".form-success-type:checked").val();e("#form-success-message-"+l).show(),e(".form-success-type").change((function(){switch(e(this).val()){case"text":e("#form-success-message-text").show(),e("#form-success-message-page, #form-success-message-redirect").hide();break;case"page":e("#form-success-message-page").show(),e("#form-success-message-text, #form-success-message-redirect").hide();break;case"redirect":e("#form-success-message-redirect").show(),e("#form-success-message-text, #form-success-message-page").hide()}})),e(".vfb-field-types").click((function(t){t.preventDefault(),e("#vfb-field-tabs li").removeClass("tabs"),e(this).parent().addClass("tabs"),e(".tabs-panel-active").removeClass("tabs-panel-active").addClass("tabs-panel-inactive");var i=this.hash;e(i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active")})),e("#visual-form-builder-update").validate({rules:{"form_email_to[]":{email:!0},form_email_from:{email:!0},form_success_message_redirect:{url:!0},form_notification_email_name:{required:function(t){return e("#form-notification-setting").is(":checked")}},form_notification_email_from:{required:function(t){return e("#form-notification-setting").is(":checked")},email:!0},form_notification_email:{required:function(t){return e("#form-notification-setting").is(":checked")}}},errorPlacement:function(e,t){e.insertAfter(t.parent())}}),e("#visual-form-builder-new-form").validate(),e("#form_email_from_name_override").change((function(){""==e("#form_email_from_name_override").val()?e("#form-email-sender-name").prop("readonly",!1):e("#form-email-sender-name").prop("readonly","readonly")})),e("#form_email_from_override").change((function(){""==e("#form_email_from_override").val()?e("#form-email-sender").prop("readonly",!1):e("#form-email-sender").prop("readonly","readonly")})),e("#notification-email").toggle(e("#form-notification-setting").prop("checked")),e("#form-notification-setting").change((function(){e(this).is(":checked")?(e("#notification-email").show(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled",!1)):(e("#notification-email").hide(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled","disabled"))})),e("#vfb-export-select-all").click((function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!0)})),e("#vfb-export-unselect-all").click((function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!1)})),e("#vfb-export-forms-list").change((function(){var t=e(this).val();e("#vfb-export-entries-fields").html("Loading..."),e.get(ajaxurl,{action:"vfb-export-fields",id:t,vfb_ajax_nonce:vfb_settings.vfb_ajax_nonce}).done((function(t){e("#vfb-export-entries-fields").html(t)})).fail((function(t){e("#vfb-export-entries-fields").html("Error loading entry fields.")}))}))})),function(e){e(document).ready((function(){e(".vfb-accordion-container").on("click keydown",".vfb-accordion-section-title",(function(t){"keydown"===t.type&&13!==t.which||(t.preventDefault(),function(e){var t=e.closest(".vfb-accordion-section"),i=t.closest(".vfb-accordion-container").find(".open"),o=t.find(".vfb-accordion-section-content");if(t.hasClass("cannot-expand"))return;t.hasClass("open")?(t.toggleClass("open"),o.toggle(!0).slideToggle(150)):(i.removeClass("open"),i.find(".vfb-accordion-section-content").show().slideUp(150),o.toggle(!1).slideToggle(150),t.toggleClass("open"))}(e(this)))}))}))}(jQuery);
|
1 |
+
jQuery(document).ready(function(e){var t=null;e(document).on("mouseenter mouseleave",".vfb-tooltip",function(i){if("mouseenter"==i.type){t&&(clearTimeout(t),t=null);var o=e(this).attr("title"),n=e(this).attr("rel"),a=e(this).width();e(this).append('<div class="vfb-tooltip-popup"><h3>'+o+"</h3><p>"+n+"</p></div>"),e.data(this,"title",o),this.title="",e(this).find(".vfb-tooltip-popup").css({left:a+22}),t=setTimeout(function(){e(".vfb-tooltip-popup").fadeIn(300)},500)}else this.title=e.data(this,"title"),e(".vfb-tooltip-popup").fadeOut(500),e(this).children().remove()}),e(document).on("click","a.vfb-add-option",function(t){t.preventDefault();var i=e(this).parent().siblings(".vfb-cloned-options").children(),o=i.length,n=o+1,a=i[o-1],s=e(a).attr("id"),r=e(a).children("label").attr("for").replace(new RegExp(/(\d+)$/g),""),l=s.replace(new RegExp(/(\d+)$/g),""),f=e("#"+s).clone().attr("id",l+n);f.children("label").attr("for",r+n),f.find('input[type="text"]').attr("id",r+n),f.find('input[type="radio"]').attr("value",n),e("#"+l+o).after(f)}),e(document).on("click","a.deleteOption",function(t){t.preventDefault(),e(this).parent().parent().find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()}),e(".vfb-cloned-options").sortable({items:"div.option"}),e(document).on("click","a.addEmail",function(t){t.preventDefault();var i=e(this).closest("#email-details").find(".clonedOption").length,o=i+1,n=e(this).closest("div").attr("id"),a=e(this).closest("div").find("label").attr("for").replace(new RegExp(/(\d+)$/g),""),s=n.replace(new RegExp(/(\d+)$/g),""),r=e("#"+n).clone().attr("id",s+o);r.find("label").attr("for",a+o),r.find("input").attr("id",a+o),e("#"+s+i).after(r)}),e(document).on("click","a.deleteEmail",function(t){t.preventDefault(),e(this).closest("#email-details").find(".clonedOption").length-1==0?alert("You must have at least one option."):e(this).closest("div").remove()}),e('.option input[type="radio"]').mousedown(function(){e(this).attr("previousValue",e(this).prop("checked"))}).click(function(){"true"==e(this).attr("previousValue")&&e(this).prop("checked",!1)}),e(".menu-delete").click(function(){var t=e(this).hasClass("entry-delete")?"entry":"form";return!!confirm("You are about to permanently delete this "+t+" and all of its data.\n'Cancel' to stop, 'OK' to delete.")}),e(document).on("click","a.item-edit",function(t){t.preventDefault(),e(t.target).closest("li").children(".menu-item-settings").slideToggle("fast"),e(this).toggleClass("opened");var i=e(t.target).closest("dl");i.hasClass("vfb-menu-item-inactive")?i.removeClass("vfb-menu-item-inactive").addClass("vfb-menu-item-active"):i.removeClass("vfb-menu-item-active").addClass("vfb-menu-item-inactive")}),e("#vfb-menu-to-edit").sortable({handle:".vfb-menu-item-handle",placeholder:"vfb-sortable-placeholder",forcePlaceholderSize:!0,forceHelperSize:!0,tolerance:"pointer",items:"li:not(.ui-state-disabled)",create:function(t,i){e(this).css("min-height",e(this).height())},stop:function(t,i){var o=e("#vfb-menu-to-edit .item-type:first").text();e.post(ajaxurl,{action:"visual_form_builder_sort_field",order:e(this).sortable("serialize")}).done(function(t){e("#loading-animation").hide(),"FIELDSET"!==o?e("#vfb-fieldset-first-warning").show():e("#vfb-fieldset-first-warning").hide()})}}),e("#vfb-form-items .vfb-draggable-form-items").click(function(t){t.preventDefault(),e(this).data("submit_value",e(this).text())}),e("#vfb-form-items .vfb-draggable-form-items").click(function(t){t.preventDefault();var i=e(this).closest("form").serializeArray(),o=e(this).data("submit_value"),n=e("#vfb-menu-to-edit li.ui-state-disabled:first").attr("id").match(new RegExp(/(\d+)$/g))[0];e("img.waiting").show(),e.post(ajaxurl,{action:"visual_form_builder_create_field",data:i,field_type:o,previous:n,page:pagenow,nonce:e("#_wpnonce").val()}).done(function(t){e("img.waiting").hide(),e(t).hide().insertBefore("#vfb-menu-to-edit li.ui-state-disabled:first").fadeIn()})}),e(document).on("click","a.item-delete",function(t){t.preventDefault();var i=childs=new Array,o=0,n=e(this).attr("href").split("&");if(!confirm("You are about to permanently delete this field.\n'Cancel' to stop, 'OK' to delete."))return!1;for(var a=0;a<n.length;a++){var s=n[a].indexOf("="),r=n[a].substring(0,s),l=n[a].substring(s+1);i[r]=l}var f=e(this).closest(".form-item").find("ul").children(),c=f.parent().html();f.each(function(t){childs[t]=e(this).attr("id").match(new RegExp(/(\d+)$/g))[0]});var d=e(this).closest("li.form-item").parents("li.form-item");d.length&&(o=d.attr("id").match(new RegExp(/(\d+)$/g))[0]),e.post(ajaxurl,{action:"visual_form_builder_delete_field",form:i.form,field:i.field,child_ids:childs,parent_id:o,page:pagenow,nonce:i._wpnonce}).done(function(t){e("#form_item_"+i.field).addClass("deleting").animate({opacity:0,height:0},350,function(){e(this).before(c).remove()})})}),e("#form-settings-button").click(function(t){t.preventDefault(),e(this).toggleClass("current"),e("#form-settings").slideToggle("fast");var i=e('input[name="form_id"]').val(),o=e(this).hasClass("current")?"opened":"closed";e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,status:o,page:pagenow}).done(function(t){"closed"==o&&(e(".settings-links").removeClass("on"),e(".settings-links:first").addClass("on"),e(".form-details").slideUp("normal"),e(".form-details:first").show("normal"))})}),e(".settings-links").click(function(t){t.preventDefault(),e(".settings-links").removeClass("on"),e(".form-details").slideUp("fast"),1==e(this).next("div").is(":hidden")&&(e(this).addClass("on"),e(this).next().slideDown("normal"));var i=e('input[name="form_id"]').val(),o=this.hash.replace(/#/g,"");e.post(ajaxurl,{action:"visual_form_builder_form_settings",form:i,accordion:o,page:pagenow})});var i=!1;e("#vfb-form-builder-management input, #vfb-form-builder-management select, #vfb-form-builder-management textarea").change(function(){i=!0}),window.onbeforeunload=function(){if(i)return"The changes you made will be lost if you navigate away from this page."},e(document).on("submit","#visual-form-builder-update",function(){window.onbeforeunload=null});var o=e(".form-success-type:checked").val();e("#form-success-message-"+o).show(),e(".form-success-type").change(function(){switch(e(this).val()){case"text":e("#form-success-message-text").show(),e("#form-success-message-page, #form-success-message-redirect").hide();break;case"page":e("#form-success-message-page").show(),e("#form-success-message-text, #form-success-message-redirect").hide();break;case"redirect":e("#form-success-message-redirect").show(),e("#form-success-message-text, #form-success-message-page").hide()}}),e(".vfb-field-types").click(function(t){t.preventDefault(),e("#vfb-field-tabs li").removeClass("tabs"),e(this).parent().addClass("tabs"),e(".tabs-panel-active").removeClass("tabs-panel-active").addClass("tabs-panel-inactive");var i=this.hash;e(i).removeClass("tabs-panel-inactive").addClass("tabs-panel-active")}),e("#visual-form-builder-update").validate({rules:{"form_email_to[]":{email:!0},form_email_from:{email:!0},form_success_message_redirect:{url:!0},form_notification_email_name:{required:function(t){return e("#form-notification-setting").is(":checked")}},form_notification_email_from:{required:function(t){return e("#form-notification-setting").is(":checked")},email:!0},form_notification_email:{required:function(t){return e("#form-notification-setting").is(":checked")}}},errorPlacement:function(e,t){e.insertAfter(t.parent())}}),e("#visual-form-builder-new-form").validate(),e("#form_email_from_name_override").change(function(){""==e("#form_email_from_name_override").val()?e("#form-email-sender-name").prop("readonly",!1):e("#form-email-sender-name").prop("readonly","readonly")}),e("#form_email_from_override").change(function(){""==e("#form_email_from_override").val()?e("#form-email-sender").prop("readonly",!1):e("#form-email-sender").prop("readonly","readonly")}),e("#notification-email").toggle(e("#form-notification-setting").prop("checked")),e("#form-notification-setting").change(function(){e(this).is(":checked")?(e("#notification-email").show(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled",!1)):(e("#notification-email").hide(),e("#form-notification-email-name, #form-notification-email-from, #form-notification-email, #form-notification-subject, #form-notification-message, #form-notification-entry").prop("disabled","disabled"))}),e("#vfb-export-select-all").click(function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!0)}),e("#vfb-export-unselect-all").click(function(t){t.preventDefault(),e('#vfb-export-entries-fields input[type="checkbox"]').prop("checked",!1)}),e("#vfb-export-forms-list").change(function(){var t=e(this).val();e("#vfb-export-entries-fields").html("Loading..."),e.get(ajaxurl,{action:"vfb-export-fields",id:t,vfb_ajax_nonce:vfb_settings.vfb_ajax_nonce}).done(function(t){e("#vfb-export-entries-fields").html(t)}).fail(function(t){e("#vfb-export-entries-fields").html("Error loading entry fields.")})})}),function(e){e(document).ready(function(){e(".vfb-accordion-container").on("click keydown",".vfb-accordion-section-title",function(t){"keydown"===t.type&&13!==t.which||(t.preventDefault(),function(e){var t=e.closest(".vfb-accordion-section"),i=t.closest(".vfb-accordion-container").find(".open"),o=t.find(".vfb-accordion-section-content");if(t.hasClass("cannot-expand"))return;t.hasClass("open")?(t.toggleClass("open"),o.toggle(!0).slideToggle(150)):(i.removeClass("open"),i.find(".vfb-accordion-section-content").show().slideUp(150),o.toggle(!1).slideToggle(150),t.toggleClass("open"))}(e(this)))})})}(jQuery);
|
admin/assets/js/vfb-validation.js
CHANGED
@@ -1,48 +1,64 @@
|
|
1 |
-
jQuery(document).ready(
|
2 |
-
|
3 |
-
|
4 |
-
$(
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
-
|
22 |
-
});
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
1 |
+
jQuery( document ).ready(
|
2 |
+
function($) {
|
3 |
+
// !Validate each form on the page
|
4 |
+
$( '.visual-form-builder' ).each(
|
5 |
+
function() {
|
6 |
+
$( this ).validate(
|
7 |
+
{
|
8 |
+
rules: {
|
9 |
+
"vfb-secret":{
|
10 |
+
required: true,
|
11 |
+
digits: true,
|
12 |
+
maxlength:2
|
13 |
+
}
|
14 |
+
},
|
15 |
+
errorClass : 'vfb-error',
|
16 |
+
errorPlacement: function(error, element) {
|
17 |
+
if ( element.is( ':radio' ) || element.is( ':checkbox' ) ) {
|
18 |
+
error.appendTo( element.parent().parent() );
|
19 |
+
} else if ( element.is( ':password' ) ) {
|
20 |
+
error.hide();
|
21 |
+
} else {
|
22 |
+
error.insertAfter( element );
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
);
|
27 |
}
|
28 |
+
);
|
|
|
29 |
|
30 |
+
// Force bullets to hide, but only if list-style-type isn't set
|
31 |
+
$( '.visual-form-builder li:not(.vfb-item-instructions li, .vfb-span li)' ).filter(
|
32 |
+
function(){
|
33 |
+
return $( this ).css( 'list-style-type' ) !== 'none';
|
34 |
+
}
|
35 |
+
).css( 'list-style', 'none' );
|
36 |
|
37 |
+
// !Display jQuery UI date picker
|
38 |
+
$( '.vfb-date-picker' ).each(
|
39 |
+
function(){
|
40 |
+
var vfb_dateFormat = $( this ).attr( 'data-dp-dateFormat' ) ? $( this ).attr( 'data-dp-dateFormat' ) : 'mm/dd/yy';
|
41 |
|
42 |
+
$( this ).datepicker(
|
43 |
+
{
|
44 |
+
dateFormat: vfb_dateFormat
|
45 |
+
}
|
46 |
+
);
|
47 |
+
}
|
48 |
+
);
|
49 |
|
50 |
+
// !Custom validation method to check multiple emails
|
51 |
+
$.validator.addMethod(
|
52 |
+
'phone',
|
53 |
+
function( value, element ) {
|
54 |
+
// Strip out all spaces, periods, dashes, parentheses, and plus signs
|
55 |
+
value = value.replace( /[\+\s\(\)\.\-\ ]/g, '' );
|
56 |
|
57 |
+
return this.optional( element ) || value.length > 9 &&
|
58 |
+
value.match( /^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/ );
|
59 |
|
60 |
+
},
|
61 |
+
$.validator.messages.phone
|
62 |
+
);
|
63 |
+
}
|
64 |
+
);
|
admin/class-admin-menu.php
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
* Add all admin menus
|
4 |
*
|
5 |
* Defines and adds all admin menus
|
6 |
-
*
|
7 |
*/
|
8 |
class Visual_Form_Builder_Admin_Menu {
|
9 |
|
@@ -14,7 +13,6 @@ class Visual_Form_Builder_Admin_Menu {
|
|
14 |
* @return void
|
15 |
*/
|
16 |
public function __construct() {
|
17 |
-
// Add main menu
|
18 |
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
19 |
}
|
20 |
|
@@ -98,12 +96,12 @@ class Visual_Form_Builder_Admin_Menu {
|
|
98 |
add_action( 'load-' . $export, array( $scripts, 'add_css' ) );
|
99 |
add_action( 'load-' . $export, array( $scripts, 'add_js' ) );
|
100 |
|
101 |
-
// Enable Screen Options tabs here (saving is hooked in main plugin instance() )
|
102 |
$screen_options = new Visual_Form_Builder_Admin_Screen_Options();
|
103 |
add_action( 'load-' . $page, array( $screen_options, 'add_option' ) );
|
104 |
add_action( 'load-' . $entries, array( $screen_options, 'add_option_entries' ) );
|
105 |
|
106 |
-
// Add Help dropdown
|
107 |
add_action( 'load-' . $page, array( $this, 'help' ) );
|
108 |
}
|
109 |
|
@@ -115,10 +113,11 @@ class Visual_Form_Builder_Admin_Menu {
|
|
115 |
* @return void
|
116 |
*/
|
117 |
public function admin() {
|
118 |
-
if ( isset( $_GET['form'] ) && 'edit'
|
119 |
-
|
120 |
-
else
|
121 |
$this->forms_list();
|
|
|
122 |
}
|
123 |
|
124 |
/**
|
@@ -130,70 +129,64 @@ class Visual_Form_Builder_Admin_Menu {
|
|
130 |
*/
|
131 |
public function forms_list() {
|
132 |
$forms = new Visual_Form_Builder_Forms_List();
|
133 |
-
|
134 |
<div class="wrap">
|
135 |
<h1>
|
136 |
-
|
137 |
-
|
138 |
|
139 |
-
// Add New link
|
140 |
-
|
141 |
-
'
|
142 |
esc_url( admin_url( 'admin.php?page=vfb-add-new' ) ),
|
143 |
-
|
144 |
);
|
145 |
-
|
146 |
-
// If searched, output the query
|
147 |
-
if ( isset( $_POST['s'] ) && !empty( $_POST['s'] ) )
|
148 |
-
echo '<span class="subtitle">' . sprintf( __( 'Search results for "%s"' , 'visual-form-builder'), esc_html( $_POST['s'] ) );
|
149 |
-
|
150 |
-
$form_nav_selected_id = isset( $_GET['form'] ) ? $_GET['form'] : '0';
|
151 |
-
?>
|
152 |
</h1>
|
153 |
|
154 |
<div id="vfb-form-list">
|
155 |
<div id="vfb-sidebar">
|
156 |
<div id="vfb-upgrade-column">
|
157 |
<div class="vfb-pro-upgrade">
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
</div> <!-- #vfb-sidebar -->
|
198 |
<div id="vfb-main" class="vfb-order-type-list">
|
199 |
<form id="forms-filter" method="post" action="">
|
@@ -201,14 +194,13 @@ class Visual_Form_Builder_Admin_Menu {
|
|
201 |
$forms->views();
|
202 |
$forms->prepare_items();
|
203 |
|
204 |
-
$forms->search_box( 'search', 'search_id' );
|
205 |
$forms->display();
|
206 |
?>
|
207 |
</form>
|
208 |
</div> <!-- #vfb-main -->
|
209 |
</div> <!-- #vfb-form-list -->
|
210 |
</div> <!-- .wrap -->
|
211 |
-
|
212 |
}
|
213 |
|
214 |
/**
|
@@ -239,38 +231,34 @@ class Visual_Form_Builder_Admin_Menu {
|
|
239 |
|
240 |
/**
|
241 |
* View for Entries
|
242 |
-
*
|
|
|
243 |
*/
|
244 |
public function entries() {
|
245 |
$entries_list = new Visual_Form_Builder_Entries_List();
|
246 |
$entries_detail = new Visual_Form_Builder_Entries_Detail();
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
if ( isset( $_POST['s'] ) && !empty( $_POST['s'] ) )
|
255 |
-
echo '<span class="subtitle">' . sprintf( __( 'Search results for "%s"' , 'visual-form-builder' ), esc_html( $_POST['s'] ) );
|
256 |
-
?>
|
257 |
-
</h1>
|
258 |
<?php
|
259 |
-
if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'view', 'edit', 'update_entry' ) ) ) :
|
260 |
$entries_detail->entries_detail();
|
261 |
else :
|
262 |
$entries_list->views();
|
263 |
$entries_list->prepare_items();
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
<?php
|
267 |
-
$entries_list->search_box( 'search', 'search_id' );
|
268 |
-
$entries_list->display();
|
269 |
-
?>
|
270 |
-
</form>
|
271 |
-
<?php endif; ?>
|
272 |
-
</div>
|
273 |
-
<?php
|
274 |
}
|
275 |
|
276 |
/**
|
@@ -299,87 +287,100 @@ class Visual_Form_Builder_Admin_Menu {
|
|
299 |
|
300 |
/**
|
301 |
* Add Help dropdown
|
302 |
-
*
|
|
|
303 |
*/
|
304 |
public function help() {
|
305 |
$screen = get_current_screen();
|
306 |
|
307 |
-
$screen->add_help_tab(
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
}
|
385 |
}
|
3 |
* Add all admin menus
|
4 |
*
|
5 |
* Defines and adds all admin menus
|
|
|
6 |
*/
|
7 |
class Visual_Form_Builder_Admin_Menu {
|
8 |
|
13 |
* @return void
|
14 |
*/
|
15 |
public function __construct() {
|
|
|
16 |
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
17 |
}
|
18 |
|
96 |
add_action( 'load-' . $export, array( $scripts, 'add_css' ) );
|
97 |
add_action( 'load-' . $export, array( $scripts, 'add_js' ) );
|
98 |
|
99 |
+
// Enable Screen Options tabs here (saving is hooked in main plugin instance() ).
|
100 |
$screen_options = new Visual_Form_Builder_Admin_Screen_Options();
|
101 |
add_action( 'load-' . $page, array( $screen_options, 'add_option' ) );
|
102 |
add_action( 'load-' . $entries, array( $screen_options, 'add_option_entries' ) );
|
103 |
|
104 |
+
// Add Help dropdown.
|
105 |
add_action( 'load-' . $page, array( $this, 'help' ) );
|
106 |
}
|
107 |
|
113 |
* @return void
|
114 |
*/
|
115 |
public function admin() {
|
116 |
+
if ( isset( $_GET['form'] ) && isset( $_GET['action'] ) && 'edit' === $_GET['action'] ) {
|
117 |
+
$this->edit_form();
|
118 |
+
} else {
|
119 |
$this->forms_list();
|
120 |
+
}
|
121 |
}
|
122 |
|
123 |
/**
|
129 |
*/
|
130 |
public function forms_list() {
|
131 |
$forms = new Visual_Form_Builder_Forms_List();
|
132 |
+
?>
|
133 |
<div class="wrap">
|
134 |
<h1>
|
135 |
+
<?php
|
136 |
+
esc_html_e( 'Visual Form Builder', 'visual-form-builder' );
|
137 |
|
138 |
+
// Add New link.
|
139 |
+
printf(
|
140 |
+
'<a href="%1$s" class="page-title-action">%2$s</a>',
|
141 |
esc_url( admin_url( 'admin.php?page=vfb-add-new' ) ),
|
142 |
+
esc_html__( 'Add New', 'visual-form-builder' )
|
143 |
);
|
144 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
</h1>
|
146 |
|
147 |
<div id="vfb-form-list">
|
148 |
<div id="vfb-sidebar">
|
149 |
<div id="vfb-upgrade-column">
|
150 |
<div class="vfb-pro-upgrade">
|
151 |
+
<h2><a href="http://vfbpro.com">VFB Pro</a></h2>
|
152 |
+
<p class="vfb-pro-call-to-action">
|
153 |
+
<a class="vfb-btn vfb-btn-inverse" href="http://vfbpro.com/pages/pricing" target="_blank"><?php esc_html_e( 'View Pricing', 'visual-form-builder' ); ?></a>
|
154 |
+
<a class="vfb-btn vfb-btn-primary" href="http://vfbpro.com/pages/pricing" target="_blank"><?php esc_html_e( 'Buy Now', 'visual-form-builder' ); ?></a>
|
155 |
+
</p>
|
156 |
+
<p class="vfb-pro-call-to-action">
|
157 |
+
<a class="button" href="http://demo.vfbpro.com" target="_blank"><?php esc_html_e( 'Try the Free Live Demo →', 'visual-form-builder' ); ?></a>
|
158 |
+
</p>
|
159 |
+
<h3><?php esc_html_e( 'New Features', 'visual-form-builder' ); ?></h3>
|
160 |
+
<ul>
|
161 |
+
<li><a href="http://vfbpro.com/collections/add-ons"><?php esc_html_e( 'Now with Add-Ons', 'visual-form-builder' ); ?></a></li>
|
162 |
+
<li><?php esc_html_e( 'Akismet Support', 'visual-form-builder' ); ?></li>
|
163 |
+
<li><?php esc_html_e( 'reCAPTCHA v2', 'visual-form-builder' ); ?></li>
|
164 |
+
<li><?php esc_html_e( 'Conditional Logic', 'visual-form-builder' ); ?></li>
|
165 |
+
<li><?php esc_html_e( '15 new Form Fields', 'visual-form-builder' ); ?></li>
|
166 |
+
<li><?php esc_html_e( 'Complete Entries Management', 'visual-form-builder' ); ?></li>
|
167 |
+
<li><?php esc_html_e( 'Import/Export', 'visual-form-builder' ); ?></li>
|
168 |
+
<li><?php esc_html_e( 'Quality HTML Email Template', 'visual-form-builder' ); ?></li>
|
169 |
+
<li><?php esc_html_e( 'Plain Text Email Option', 'visual-form-builder' ); ?></li>
|
170 |
+
<li><?php esc_html_e( 'Email Designer', 'visual-form-builder' ); ?></li>
|
171 |
+
<li><?php esc_html_e( 'Data & Form Migration', 'visual-form-builder' ); ?></li>
|
172 |
+
<li><?php esc_html_e( 'Scheduling', 'visual-form-builder' ); ?></li>
|
173 |
+
<li><?php esc_html_e( 'Limit Form Entries', 'visual-form-builder' ); ?></li>
|
174 |
+
<li><?php esc_html_e( 'Form Paging', 'visual-form-builder' ); ?></li>
|
175 |
+
<li><?php esc_html_e( 'Custom Capabilities', 'visual-form-builder' ); ?></li>
|
176 |
+
<li><?php esc_html_e( 'Automatic Updates', 'visual-form-builder' ); ?></li>
|
177 |
+
</ul>
|
178 |
+
|
179 |
+
<p><a href="http://vfbpro.com/pages/features"><?php esc_html_e( 'View all features', 'visual-form-builder' ); ?></a></p>
|
180 |
+
</div> <!-- .vfb-pro-upgrade -->
|
181 |
+
|
182 |
+
<h3><?php esc_html_e( 'Promote Visual Form Builder', 'visual-form-builder' ); ?></h3>
|
183 |
+
<ul id="promote-vfb">
|
184 |
+
<li id="star"><a href="http://wordpress.org/extend/plugins/visual-form-builder/"><?php esc_html_e( 'Rate Visual Form Builder on WordPress.org', 'visual-form-builder' ); ?></a></li>
|
185 |
+
<li id="paypal">
|
186 |
+
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=G87A9UN9CLPH4&lc=US&item_name=Visual%20Form%20Builder¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" width="74" height="21"></a>
|
187 |
+
</li>
|
188 |
+
</ul>
|
189 |
+
</div> <!-- #vfb-upgrade-column -->
|
190 |
</div> <!-- #vfb-sidebar -->
|
191 |
<div id="vfb-main" class="vfb-order-type-list">
|
192 |
<form id="forms-filter" method="post" action="">
|
194 |
$forms->views();
|
195 |
$forms->prepare_items();
|
196 |
|
|
|
197 |
$forms->display();
|
198 |
?>
|
199 |
</form>
|
200 |
</div> <!-- #vfb-main -->
|
201 |
</div> <!-- #vfb-form-list -->
|
202 |
</div> <!-- .wrap -->
|
203 |
+
<?php
|
204 |
}
|
205 |
|
206 |
/**
|
231 |
|
232 |
/**
|
233 |
* View for Entries
|
234 |
+
*
|
235 |
+
* @return void
|
236 |
*/
|
237 |
public function entries() {
|
238 |
$entries_list = new Visual_Form_Builder_Entries_List();
|
239 |
$entries_detail = new Visual_Form_Builder_Entries_Detail();
|
240 |
+
?>
|
241 |
+
<div class="wrap">
|
242 |
+
<h1>
|
243 |
+
<?php
|
244 |
+
esc_html_e( 'Entries', 'visual-form-builder' );
|
245 |
+
?>
|
246 |
+
</h1>
|
|
|
|
|
|
|
|
|
247 |
<?php
|
248 |
+
if ( isset( $_GET['vfb-action'] ) && in_array( $_GET['vfb-action'], array( 'view', 'edit', 'update_entry' ) ) ) :
|
249 |
$entries_detail->entries_detail();
|
250 |
else :
|
251 |
$entries_list->views();
|
252 |
$entries_list->prepare_items();
|
253 |
+
?>
|
254 |
+
<form id="entries-filter" method="post" action="">
|
255 |
+
<?php
|
256 |
+
$entries_list->display();
|
257 |
+
?>
|
258 |
+
</form>
|
259 |
+
<?php endif; ?>
|
260 |
+
</div>
|
261 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
|
264 |
/**
|
287 |
|
288 |
/**
|
289 |
* Add Help dropdown
|
290 |
+
*
|
291 |
+
* @return void
|
292 |
*/
|
293 |
public function help() {
|
294 |
$screen = get_current_screen();
|
295 |
|
296 |
+
$screen->add_help_tab(
|
297 |
+
array(
|
298 |
+
'id' => 'vfb-help-tab-getting-started',
|
299 |
+
'title' => 'Getting Started',
|
300 |
+
'content' => '<ul>
|
301 |
+
<li>Click on the + tab, give your form a name and click Create Form.</li>
|
302 |
+
<li>Select form fields from the box on the left and click a field to add it to your form.</li>
|
303 |
+
<li>Edit the information for each form field by clicking on the down arrow.</li>
|
304 |
+
<li>Drag and drop the elements to put them in order.</li>
|
305 |
+
<li>Click Save Form to save your changes.</li>
|
306 |
+
</ul>',
|
307 |
+
)
|
308 |
+
);
|
309 |
+
|
310 |
+
$screen->add_help_tab(
|
311 |
+
array(
|
312 |
+
'id' => 'vfb-help-tab-item-config',
|
313 |
+
'title' => 'Form Item Configuration',
|
314 |
+
'content' => "<ul>
|
315 |
+
<li><em>Name</em> will change the display name of your form input.</li>
|
316 |
+
<li><em>Description</em> will be displayed below the associated input.</li>
|
317 |
+
<li><em>Validation</em> allows you to select from several of jQuery's Form Validation methods for text inputs. For more about the types of validation, read the <em>Validation</em> section below.</li>
|
318 |
+
<li><em>Required</em> is either Yes or No. Selecting 'Yes' will make the associated input a required field and the form will not submit until the user fills this field out correctly.</li>
|
319 |
+
<li><em>Options</em> will only be active for Radio and Checkboxes. This field contols how many options are available for the associated input.</li>
|
320 |
+
<li><em>Size</em> controls the width of Text, Textarea, Select, and Date Picker input fields. The default is set to Medium but if you need a longer text input, select Large.</li>
|
321 |
+
<li><em>CSS Classes</em> allow you to add custom CSS to a field. This option allows you to fine tune the look of the form.</li>
|
322 |
+
</ul>",
|
323 |
+
)
|
324 |
+
);
|
325 |
+
|
326 |
+
$screen->add_help_tab(
|
327 |
+
array(
|
328 |
+
'id' => 'vfb-help-tab-validation',
|
329 |
+
'title' => 'Validation',
|
330 |
+
'content' => "<p>Visual Form Builder uses the <a href='http://docs.jquery.com/Plugins/Validation/Validator'>jQuery Form Validation plugin</a> to perform clientside form validation.</p>
|
331 |
+
<ul>
|
332 |
+
|
333 |
+
<li><em>Email</em>: makes the element require a valid email.</li>
|
334 |
+
<li><em>URL</em>: makes the element require a valid url.</li>
|
335 |
+
<li><em>Date</em>: makes the element require a date. <a href='http://docs.jquery.com/Plugins/Validation/Methods/date'>Refer to documentation for various accepted formats</a>.
|
336 |
+
<li><em>Number</em>: makes the element require a decimal number.</li>
|
337 |
+
<li><em>Digits</em>: makes the element require digits only.</li>
|
338 |
+
<li><em>Phone</em>: makes the element require a US or International phone number. Most formats are accepted.</li>
|
339 |
+
<li><em>Time</em>: choose either 12- or 24-hour time format (NOTE: only available with the Time field).</li>
|
340 |
+
</ul>",
|
341 |
+
)
|
342 |
+
);
|
343 |
+
|
344 |
+
$screen->add_help_tab(
|
345 |
+
array(
|
346 |
+
'id' => 'vfb-help-tab-confirmation',
|
347 |
+
'title' => 'Confirmation',
|
348 |
+
'content' => '<p>Each form allows you to customize the confirmation by selecing either a Text Message, a WordPress Page, or to Redirect to a URL.</p>
|
349 |
+
<ul>
|
350 |
+
<li><em>Text</em> allows you to enter a custom formatted message that will be displayed on the page after your form is submitted. HTML is allowed here.</li>
|
351 |
+
<li><em>Page</em> displays a dropdown of all WordPress Pages you have created. Select one to redirect the user to that page after your form is submitted.</li>
|
352 |
+
<li><em>Redirect</em> will only accept URLs and can be used to send the user to a different site completely, if you choose.</li>
|
353 |
+
</ul>',
|
354 |
+
)
|
355 |
+
);
|
356 |
+
|
357 |
+
$screen->add_help_tab(
|
358 |
+
array(
|
359 |
+
'id' => 'vfb-help-tab-notification',
|
360 |
+
'title' => 'Notification',
|
361 |
+
'content' => "<p>Send a customized notification email to the user when the form has been successfully submitted.</p>
|
362 |
+
<ul>
|
363 |
+
<li><em>Sender Name</em>: the name that will be displayed on the email.</li>
|
364 |
+
<li><em>Sender Email</em>: the email that will be used as the Reply To email.</li>
|
365 |
+
<li><em>Send To</em>: the email where the notification will be sent. This must be a required text field with email validation.</li>
|
366 |
+
<li><em>Subject</em>: the subject of the email.</li>
|
367 |
+
<li><em>Message</em>: additional text that can be displayed in the body of the email. HTML tags are allowed.</li>
|
368 |
+
<li><em>Include a Copy of the User's Entry</em>: appends a copy of the user's submitted entry to the notification email.</li>
|
369 |
+
</ul>",
|
370 |
+
)
|
371 |
+
);
|
372 |
+
|
373 |
+
$screen->add_help_tab(
|
374 |
+
array(
|
375 |
+
'id' => 'vfb-help-tab-tips',
|
376 |
+
'title' => 'Tips',
|
377 |
+
'content' => "<ul>
|
378 |
+
<li>Fieldsets, a way to group form fields, are an essential piece of this plugin's HTML. As such, at least one fieldset is required and must be first in the order. Subsequent fieldsets may be placed wherever you would like to start your next grouping of fields.</li>
|
379 |
+
<li>Security verification is automatically included on very form. It's a simple logic question and should keep out most, if not all, spam bots.</li>
|
380 |
+
<li>There is a hidden spam field, known as a honey pot, that should also help deter potential abusers of your form.</li>
|
381 |
+
<li>Nesting is allowed underneath fieldsets and sections. Sections can be nested underneath fieldsets. Nesting is not required, however, it does make reorganizing easier.</li>
|
382 |
+
</ul>",
|
383 |
+
)
|
384 |
+
);
|
385 |
}
|
386 |
}
|
admin/class-admin-notices.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that displays all Admin Notices after saving
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Admin_Notices {
|
7 |
/**
|
@@ -25,13 +24,17 @@ class Visual_Form_Builder_Admin_Notices {
|
|
25 |
* @return void
|
26 |
*/
|
27 |
public function create_form() {
|
28 |
-
if (
|
29 |
return;
|
30 |
-
|
31 |
-
if ( 'create_form' !== $_POST['action'] )
|
32 |
return;
|
|
|
33 |
|
34 |
-
echo sprintf(
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
/**
|
@@ -41,13 +44,18 @@ class Visual_Form_Builder_Admin_Notices {
|
|
41 |
* @return void
|
42 |
*/
|
43 |
public function save_form() {
|
44 |
-
if (
|
45 |
return;
|
|
|
46 |
|
47 |
-
if ( 'update_form' !== $_POST['action'] )
|
48 |
return;
|
|
|
49 |
|
50 |
-
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
/**
|
@@ -57,13 +65,18 @@ class Visual_Form_Builder_Admin_Notices {
|
|
57 |
* @return void
|
58 |
*/
|
59 |
public function delete_form() {
|
60 |
-
if (
|
61 |
return;
|
|
|
62 |
|
63 |
-
if ( 'deleted' !== $_POST['action'] )
|
64 |
return;
|
|
|
65 |
|
66 |
-
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
/**
|
@@ -73,13 +86,18 @@ class Visual_Form_Builder_Admin_Notices {
|
|
73 |
* @return void
|
74 |
*/
|
75 |
public function copy_form() {
|
76 |
-
if (
|
77 |
return;
|
|
|
78 |
|
79 |
-
if ( 'copy_form' !== $_POST['action'] )
|
80 |
return;
|
|
|
81 |
|
82 |
-
|
|
|
|
|
|
|
83 |
}
|
84 |
|
85 |
/**
|
@@ -89,13 +107,18 @@ class Visual_Form_Builder_Admin_Notices {
|
|
89 |
* @return void
|
90 |
*/
|
91 |
public function settings() {
|
92 |
-
if (
|
93 |
return;
|
|
|
94 |
|
95 |
-
if ( 'vfb_settings' !== $_POST['action'] )
|
96 |
return;
|
|
|
97 |
|
98 |
-
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
/**
|
@@ -105,8 +128,9 @@ class Visual_Form_Builder_Admin_Notices {
|
|
105 |
* @return void
|
106 |
*/
|
107 |
public function submit_check() {
|
108 |
-
if ( !isset( $_POST['action'] ) || !isset( $_GET['page'] ) )
|
109 |
return;
|
|
|
110 |
|
111 |
$pages = array(
|
112 |
'visual-form-builder',
|
@@ -116,8 +140,9 @@ class Visual_Form_Builder_Admin_Notices {
|
|
116 |
'vfb-settings',
|
117 |
);
|
118 |
|
119 |
-
if ( !in_array( $_GET['page'], $pages ) )
|
120 |
return;
|
|
|
121 |
|
122 |
return true;
|
123 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that displays all Admin Notices after saving
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Admin_Notices {
|
6 |
/**
|
24 |
* @return void
|
25 |
*/
|
26 |
public function create_form() {
|
27 |
+
if ( ! $this->submit_check() ) {
|
28 |
return;
|
29 |
+
}
|
30 |
+
if ( 'create_form' !== $_POST['action'] ) {
|
31 |
return;
|
32 |
+
}
|
33 |
|
34 |
+
echo sprintf(
|
35 |
+
'<div id="message" class="updated"><p>%s</p></div>',
|
36 |
+
esc_html__( 'Form created.', 'visual-form-builder' )
|
37 |
+
);
|
38 |
}
|
39 |
|
40 |
/**
|
44 |
* @return void
|
45 |
*/
|
46 |
public function save_form() {
|
47 |
+
if ( ! $this->submit_check() ) {
|
48 |
return;
|
49 |
+
}
|
50 |
|
51 |
+
if ( 'update_form' !== $_POST['action'] ) {
|
52 |
return;
|
53 |
+
}
|
54 |
|
55 |
+
printf(
|
56 |
+
'<div id="message" class="updated"><p>%s</p></div>',
|
57 |
+
esc_html__( 'Form updated.', 'visual-form-builder' )
|
58 |
+
);
|
59 |
}
|
60 |
|
61 |
/**
|
65 |
* @return void
|
66 |
*/
|
67 |
public function delete_form() {
|
68 |
+
if ( ! $this->submit_check() ) {
|
69 |
return;
|
70 |
+
}
|
71 |
|
72 |
+
if ( 'deleted' !== $_POST['action'] ) {
|
73 |
return;
|
74 |
+
}
|
75 |
|
76 |
+
printf(
|
77 |
+
'<div id="message" class="updated"><p>%s</p></div>',
|
78 |
+
esc_html__( 'Item permanently deleted.', 'visual-form-builder' )
|
79 |
+
);
|
80 |
}
|
81 |
|
82 |
/**
|
86 |
* @return void
|
87 |
*/
|
88 |
public function copy_form() {
|
89 |
+
if ( ! $this->submit_check() ) {
|
90 |
return;
|
91 |
+
}
|
92 |
|
93 |
+
if ( 'copy_form' !== $_POST['action'] ) {
|
94 |
return;
|
95 |
+
}
|
96 |
|
97 |
+
printf(
|
98 |
+
'<div id="message" class="updated"><p>%s</p></div>',
|
99 |
+
esc_html__( 'Item successfully duplicated.', 'visual-form-builder' )
|
100 |
+
);
|
101 |
}
|
102 |
|
103 |
/**
|
107 |
* @return void
|
108 |
*/
|
109 |
public function settings() {
|
110 |
+
if ( ! $this->submit_check() ) {
|
111 |
return;
|
112 |
+
}
|
113 |
|
114 |
+
if ( 'vfb_settings' !== $_POST['action'] ) {
|
115 |
return;
|
116 |
+
}
|
117 |
|
118 |
+
printf(
|
119 |
+
'<div id="message" class="updated"><p>%s</p></div>',
|
120 |
+
esc_html__( 'Settings saved.', 'visual-form-builder' )
|
121 |
+
);
|
122 |
}
|
123 |
|
124 |
/**
|
128 |
* @return void
|
129 |
*/
|
130 |
public function submit_check() {
|
131 |
+
if ( ! isset( $_POST['action'] ) || ! isset( $_GET['page'] ) ) {
|
132 |
return;
|
133 |
+
}
|
134 |
|
135 |
$pages = array(
|
136 |
'visual-form-builder',
|
140 |
'vfb-settings',
|
141 |
);
|
142 |
|
143 |
+
if ( ! in_array( $_GET['page'], $pages ) ) {
|
144 |
return;
|
145 |
+
}
|
146 |
|
147 |
return true;
|
148 |
}
|
admin/class-ajax.php
CHANGED
@@ -17,119 +17,127 @@ class Visual_Form_Builder_Admin_AJAX {
|
|
17 |
|
18 |
/**
|
19 |
* Sort fields
|
20 |
-
*
|
|
|
21 |
*/
|
22 |
public function sort_field() {
|
23 |
global $wpdb;
|
24 |
|
25 |
$data = array();
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
}
|
34 |
}
|
35 |
|
36 |
foreach ( $data as $k => $v ) {
|
37 |
-
// Update each field with it's new sequence and parent ID
|
38 |
-
$wpdb->update(
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
41 |
array(
|
42 |
-
'field_id' => $v['field_id']
|
43 |
),
|
44 |
'%d'
|
45 |
);
|
46 |
}
|
47 |
|
48 |
-
die(1);
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
* Create field by click
|
53 |
-
*
|
|
|
54 |
*/
|
55 |
public function create_field() {
|
56 |
global $wpdb;
|
57 |
|
58 |
-
$data
|
59 |
$field_options = $field_validation = '';
|
60 |
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
}
|
64 |
|
65 |
check_ajax_referer( 'create-field-' . $data['form_id'], 'nonce' );
|
66 |
|
67 |
-
$form_id
|
68 |
-
$field_key
|
69 |
-
$field_name = sanitize_text_field( $_POST['field_type'] );
|
70 |
-
$field_type = strtolower( sanitize_title( $_POST['field_type'] ) );
|
71 |
|
72 |
-
// Set defaults for validation
|
73 |
switch ( $field_type ) {
|
74 |
-
case 'select'
|
75 |
-
case 'radio'
|
76 |
-
case 'checkbox'
|
77 |
$field_options = serialize( array( 'Option 1', 'Option 2', 'Option 3' ) );
|
78 |
break;
|
79 |
|
80 |
-
case 'email'
|
81 |
-
case 'url'
|
82 |
-
case 'phone'
|
83 |
$field_validation = $field_type;
|
84 |
break;
|
85 |
|
86 |
-
case 'currency'
|
87 |
$field_validation = 'number';
|
88 |
break;
|
89 |
|
90 |
-
case 'number'
|
91 |
$field_validation = 'digits';
|
92 |
break;
|
93 |
|
94 |
-
case 'time'
|
95 |
$field_validation = 'time-12';
|
96 |
break;
|
97 |
|
98 |
-
case 'file-upload'
|
99 |
$field_options = serialize( array( 'png|jpe?g|gif' ) );
|
100 |
break;
|
101 |
}
|
102 |
|
|
|
|
|
103 |
|
104 |
-
//
|
105 |
-
$
|
106 |
-
|
107 |
-
// If it's not the first for this form, add 1
|
108 |
-
$field_sequence = ( !empty( $sequence_last_row ) ) ? $sequence_last_row : 0;
|
109 |
|
110 |
$newdata = array(
|
111 |
-
'form_id'
|
112 |
-
'field_key'
|
113 |
-
'field_name'
|
114 |
-
'field_type'
|
115 |
-
'field_options'
|
116 |
-
'field_sequence'
|
117 |
-
'field_validation'
|
118 |
);
|
119 |
|
120 |
-
// Create the field
|
121 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $newdata );
|
122 |
$insert_id = $wpdb->insert_id;
|
123 |
|
124 |
-
// VIP fields
|
125 |
$vip_fields = array( 'verification', 'secret', 'submit' );
|
126 |
|
127 |
-
// Move the VIPs
|
128 |
foreach ( $vip_fields as $update ) {
|
129 |
$field_sequence++;
|
130 |
$where = array(
|
131 |
-
'form_id'
|
132 |
-
'field_type'
|
133 |
);
|
134 |
$wpdb->update( VFB_WP_FIELDS_TABLE_NAME, array( 'field_sequence' => $field_sequence ), $where );
|
135 |
|
@@ -138,71 +146,72 @@ class Visual_Form_Builder_Admin_AJAX {
|
|
138 |
$field = new Visual_Form_Builder_Admin_Fields();
|
139 |
echo $field->field_output( $data['form_id'], $insert_id );
|
140 |
|
141 |
-
die(1);
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
* Delete field
|
146 |
-
*
|
|
|
147 |
*/
|
148 |
public function delete_field() {
|
149 |
global $wpdb;
|
150 |
|
151 |
-
if ( isset( $_POST['action'] ) && $_POST['action']
|
152 |
-
$form_id = absint( $_POST['form'] );
|
153 |
-
$field_id = absint( $_POST['field'] );
|
154 |
|
155 |
check_ajax_referer( 'delete-field-' . $form_id, 'nonce' );
|
156 |
|
157 |
-
if ( isset( $_POST['child_ids'] ) ) {
|
158 |
-
foreach ( $_POST['child_ids'] as $children ) {
|
159 |
$parent = absint( $_POST['parent_id'] );
|
160 |
|
161 |
-
// Update each child item with the new parent ID
|
162 |
$wpdb->update( VFB_WP_FIELDS_TABLE_NAME, array( 'field_parent' => $parent ), array( 'field_id' => $children ) );
|
163 |
}
|
164 |
}
|
165 |
|
166 |
-
// Delete the field
|
167 |
-
$wpdb->query( $wpdb->prepare(
|
168 |
}
|
169 |
|
170 |
-
die(1);
|
171 |
}
|
172 |
|
173 |
/**
|
174 |
* Form settings
|
175 |
-
*
|
|
|
176 |
*/
|
177 |
public function form_settings() {
|
178 |
$current_user = wp_get_current_user();
|
179 |
|
180 |
-
if ( isset( $_POST['action'] ) && $_POST['action']
|
181 |
-
$form_id
|
182 |
-
$status
|
183 |
-
$accordion = isset( $_POST['accordion'] ) ? sanitize_text_field( $_POST['accordion'] ) : 'general-settings';
|
184 |
$user_id = $current_user instanceof WP_User ? $current_user->ID : 1;
|
185 |
|
186 |
$form_settings = get_user_meta( $user_id, 'vfb-form-settings', true );
|
187 |
|
188 |
$array = array(
|
189 |
-
'form_setting_tab'
|
190 |
-
'setting_accordion' => $accordion
|
191 |
);
|
192 |
|
193 |
-
// Set defaults if meta key doesn't exist
|
194 |
-
if (
|
195 |
$meta_value[ $form_id ] = $array;
|
196 |
|
197 |
update_user_meta( $user_id, 'vfb-form-settings', $meta_value );
|
198 |
-
}
|
199 |
-
else {
|
200 |
$form_settings[ $form_id ] = $array;
|
201 |
|
202 |
update_user_meta( $user_id, 'vfb-form-settings', $form_settings );
|
203 |
}
|
204 |
}
|
205 |
|
206 |
-
die(1);
|
207 |
}
|
208 |
}
|
17 |
|
18 |
/**
|
19 |
* Sort fields
|
20 |
+
*
|
21 |
+
* @return void
|
22 |
*/
|
23 |
public function sort_field() {
|
24 |
global $wpdb;
|
25 |
|
26 |
$data = array();
|
27 |
|
28 |
+
if ( isset( $_POST['order'] ) && ! empty( $_POST['order'] ) ) {
|
29 |
+
foreach ( wp_unslash( $_POST['order'] ) as $k ) {
|
30 |
+
if ( 'root' !== $k['item_id'] && ! empty( $k['item_id'] ) ) {
|
31 |
+
$data[] = array(
|
32 |
+
'field_id' => $k['item_id'],
|
33 |
+
'parent' => $k['parent_id'],
|
34 |
+
);
|
35 |
+
}
|
36 |
}
|
37 |
}
|
38 |
|
39 |
foreach ( $data as $k => $v ) {
|
40 |
+
// Update each field with it's new sequence and parent ID.
|
41 |
+
$wpdb->update(
|
42 |
+
VFB_WP_FIELDS_TABLE_NAME,
|
43 |
+
array(
|
44 |
+
'field_sequence' => $k,
|
45 |
+
'field_parent' => $v['parent'],
|
46 |
+
),
|
47 |
array(
|
48 |
+
'field_id' => $v['field_id'],
|
49 |
),
|
50 |
'%d'
|
51 |
);
|
52 |
}
|
53 |
|
54 |
+
die( 1 );
|
55 |
}
|
56 |
|
57 |
/**
|
58 |
* Create field by click
|
59 |
+
*
|
60 |
+
* @return void
|
61 |
*/
|
62 |
public function create_field() {
|
63 |
global $wpdb;
|
64 |
|
65 |
+
$data = array();
|
66 |
$field_options = $field_validation = '';
|
67 |
|
68 |
+
if ( isset( $_POST['data'] ) && ! empty( $_POST['data'] ) ) {
|
69 |
+
foreach ( wp_unslash( $_POST['data'] ) as $k ) {
|
70 |
+
$data[ $k['name'] ] = $k['value'];
|
71 |
+
}
|
72 |
}
|
73 |
|
74 |
check_ajax_referer( 'create-field-' . $data['form_id'], 'nonce' );
|
75 |
|
76 |
+
$form_id = absint( $data['form_id'] );
|
77 |
+
$field_key = isset( $_POST['field_type'] ) ? sanitize_title( wp_unslash( $_POST['field_type'] ) ) : '';
|
78 |
+
$field_name = isset( $_POST['field_type'] ) ? sanitize_text_field( wp_unslash( $_POST['field_type'] ) ) : '';
|
79 |
+
$field_type = isset( $_POST['field_type'] ) ? strtolower( sanitize_title( wp_unslash( $_POST['field_type'] ) ) ) : '';
|
80 |
|
81 |
+
// Set defaults for validation.
|
82 |
switch ( $field_type ) {
|
83 |
+
case 'select':
|
84 |
+
case 'radio':
|
85 |
+
case 'checkbox':
|
86 |
$field_options = serialize( array( 'Option 1', 'Option 2', 'Option 3' ) );
|
87 |
break;
|
88 |
|
89 |
+
case 'email':
|
90 |
+
case 'url':
|
91 |
+
case 'phone':
|
92 |
$field_validation = $field_type;
|
93 |
break;
|
94 |
|
95 |
+
case 'currency':
|
96 |
$field_validation = 'number';
|
97 |
break;
|
98 |
|
99 |
+
case 'number':
|
100 |
$field_validation = 'digits';
|
101 |
break;
|
102 |
|
103 |
+
case 'time':
|
104 |
$field_validation = 'time-12';
|
105 |
break;
|
106 |
|
107 |
+
case 'file-upload':
|
108 |
$field_options = serialize( array( 'png|jpe?g|gif' ) );
|
109 |
break;
|
110 |
}
|
111 |
|
112 |
+
// Get the last row's sequence that isn't a Verification.
|
113 |
+
$sequence_last_row = $wpdb->get_var( $wpdb->prepare( 'SELECT field_sequence FROM ' . VFB_WP_FIELDS_TABLE_NAME . " WHERE form_id = %d AND field_type = 'verification' ORDER BY field_sequence DESC LIMIT 1", $form_id ) );
|
114 |
|
115 |
+
// If it's not the first for this form, add 1.
|
116 |
+
$field_sequence = ( ! empty( $sequence_last_row ) ) ? $sequence_last_row : 0;
|
|
|
|
|
|
|
117 |
|
118 |
$newdata = array(
|
119 |
+
'form_id' => $form_id,
|
120 |
+
'field_key' => $field_key,
|
121 |
+
'field_name' => $field_name,
|
122 |
+
'field_type' => $field_type,
|
123 |
+
'field_options' => $field_options,
|
124 |
+
'field_sequence' => $field_sequence,
|
125 |
+
'field_validation' => $field_validation,
|
126 |
);
|
127 |
|
128 |
+
// Create the field.
|
129 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $newdata );
|
130 |
$insert_id = $wpdb->insert_id;
|
131 |
|
132 |
+
// VIP fields.
|
133 |
$vip_fields = array( 'verification', 'secret', 'submit' );
|
134 |
|
135 |
+
// Move the VIPs.
|
136 |
foreach ( $vip_fields as $update ) {
|
137 |
$field_sequence++;
|
138 |
$where = array(
|
139 |
+
'form_id' => absint( $data['form_id'] ),
|
140 |
+
'field_type' => $update,
|
141 |
);
|
142 |
$wpdb->update( VFB_WP_FIELDS_TABLE_NAME, array( 'field_sequence' => $field_sequence ), $where );
|
143 |
|
146 |
$field = new Visual_Form_Builder_Admin_Fields();
|
147 |
echo $field->field_output( $data['form_id'], $insert_id );
|
148 |
|
149 |
+
die( 1 );
|
150 |
}
|
151 |
|
152 |
/**
|
153 |
* Delete field
|
154 |
+
*
|
155 |
+
* @return void
|
156 |
*/
|
157 |
public function delete_field() {
|
158 |
global $wpdb;
|
159 |
|
160 |
+
if ( isset( $_POST['action'] ) && 'visual_form_builder_delete_field' === $_POST['action'] ) {
|
161 |
+
$form_id = isset( $_POST['form'] ) ? absint( $_POST['form'] ) : 0;
|
162 |
+
$field_id = isset( $_POST['field'] ) ? absint( $_POST['field'] ) : 0;
|
163 |
|
164 |
check_ajax_referer( 'delete-field-' . $form_id, 'nonce' );
|
165 |
|
166 |
+
if ( isset( $_POST['child_ids'] ) && ! empty( $_POST['child_ids'] ) ) {
|
167 |
+
foreach ( wp_unslash( $_POST['child_ids'] ) as $children ) {
|
168 |
$parent = absint( $_POST['parent_id'] );
|
169 |
|
170 |
+
// Update each child item with the new parent ID.
|
171 |
$wpdb->update( VFB_WP_FIELDS_TABLE_NAME, array( 'field_parent' => $parent ), array( 'field_id' => $children ) );
|
172 |
}
|
173 |
}
|
174 |
|
175 |
+
// Delete the field.
|
176 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_FIELDS_TABLE_NAME . ' WHERE field_id = %d', $field_id ) );
|
177 |
}
|
178 |
|
179 |
+
die( 1 );
|
180 |
}
|
181 |
|
182 |
/**
|
183 |
* Form settings
|
184 |
+
*
|
185 |
+
* @return void
|
186 |
*/
|
187 |
public function form_settings() {
|
188 |
$current_user = wp_get_current_user();
|
189 |
|
190 |
+
if ( isset( $_POST['action'] ) && 'visual_form_builder_form_settings' === $_POST['action'] ) {
|
191 |
+
$form_id = isset( $_POST['form'] ) ? absint( $_POST['form'] ) : 0;
|
192 |
+
$status = isset( $_POST['status'] ) ? sanitize_text_field( wp_unslash( $_POST['status'] ) ) : 'opened';
|
193 |
+
$accordion = isset( $_POST['accordion'] ) ? sanitize_text_field( wp_unslash( $_POST['accordion'] ) ) : 'general-settings';
|
194 |
$user_id = $current_user instanceof WP_User ? $current_user->ID : 1;
|
195 |
|
196 |
$form_settings = get_user_meta( $user_id, 'vfb-form-settings', true );
|
197 |
|
198 |
$array = array(
|
199 |
+
'form_setting_tab' => $status,
|
200 |
+
'setting_accordion' => $accordion,
|
201 |
);
|
202 |
|
203 |
+
// Set defaults if meta key doesn't exist.
|
204 |
+
if ( ! $form_settings || '' === $form_settings ) {
|
205 |
$meta_value[ $form_id ] = $array;
|
206 |
|
207 |
update_user_meta( $user_id, 'vfb-form-settings', $meta_value );
|
208 |
+
} else {
|
|
|
209 |
$form_settings[ $form_id ] = $array;
|
210 |
|
211 |
update_user_meta( $user_id, 'vfb-form-settings', $form_settings );
|
212 |
}
|
213 |
}
|
214 |
|
215 |
+
die( 1 );
|
216 |
}
|
217 |
}
|
admin/class-dashboard-widgets.php
CHANGED
@@ -1,18 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that displays widgets on the WordPress dashboard
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Dashboard_Widgets {
|
7 |
/**
|
8 |
* __construct function.
|
9 |
*
|
10 |
* @access public
|
11 |
-
* @param mixed $id
|
12 |
* @return void
|
13 |
*/
|
14 |
public function __construct() {
|
15 |
-
// Adds a Dashboard widget
|
16 |
add_action( 'wp_dashboard_setup', array( $this, 'register_widgets' ) );
|
17 |
}
|
18 |
|
@@ -30,7 +27,7 @@ class Visual_Form_Builder_Dashboard_Widgets {
|
|
30 |
array( $this, 'widget_control' )
|
31 |
);
|
32 |
|
33 |
-
if ( !get_option( 'vfb_dashboard_widget_options' ) ) {
|
34 |
$widget_options['vfb_dashboard_recent_entries'] = array(
|
35 |
'items' => 5,
|
36 |
);
|
@@ -40,68 +37,78 @@ class Visual_Form_Builder_Dashboard_Widgets {
|
|
40 |
|
41 |
/**
|
42 |
* Display recent submitted entries
|
|
|
43 |
* @return [type] [description]
|
44 |
*/
|
45 |
public function widget_entries() {
|
46 |
global $wpdb;
|
47 |
|
48 |
-
// Get the date/time format that is saved in the options table
|
49 |
$date_format = get_option( 'date_format' );
|
50 |
$time_format = get_option( 'time_format' );
|
51 |
|
52 |
$widgets = get_option( 'vfb_dashboard_widget_options' );
|
53 |
$total_items = isset( $widgets['vfb_dashboard_recent_entries'] ) && isset( $widgets['vfb_dashboard_recent_entries']['items'] ) ? absint( $widgets['vfb_dashboard_recent_entries']['items'] ) : 5;
|
54 |
|
55 |
-
$forms = $wpdb->get_var(
|
56 |
|
57 |
-
if (
|
58 |
-
|
59 |
'<p>%1$s <a href="%2$s">%3$s</a></p>',
|
60 |
-
|
61 |
esc_url( admin_url( 'admin.php?page=vfb-add-new' ) ),
|
62 |
-
|
63 |
);
|
64 |
|
65 |
return;
|
66 |
}
|
67 |
|
68 |
-
$entries = $wpdb->get_results( $wpdb->prepare(
|
69 |
-
|
70 |
-
if ( !$entries ) {
|
71 |
-
echo sprintf( '<p>%1$s</p>', __( 'You currently do not have any entries.', 'visual-form-builder' ) );
|
72 |
-
}
|
73 |
-
else {
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
$content = '';
|
76 |
|
77 |
foreach ( $entries as $entry ) {
|
78 |
$content .= sprintf(
|
79 |
'<li><a href="%1$s">%4$s</a> via <a href="%2$s">%5$s</a> <span class="rss-date">%6$s</span><cite>%3$s</cite></li>',
|
80 |
-
esc_url(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
esc_url( add_query_arg( 'form-filter', absint( $entry->form_id ), admin_url( 'admin.php?page=vfb-entries' ) ) ),
|
82 |
esc_html( $entry->sender_name ),
|
83 |
esc_html( $entry->sender_email ),
|
84 |
esc_html( $entry->form_title ),
|
85 |
-
|
86 |
);
|
87 |
}
|
88 |
|
89 |
-
echo "<div class='rss-widget'><ul
|
90 |
}
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
* Displays the dashboard widget form control
|
95 |
-
* @return [type] [description]
|
96 |
*/
|
97 |
public function widget_control() {
|
98 |
-
if (
|
99 |
$widget_options = array();
|
|
|
100 |
|
101 |
-
if ( !isset( $widget_options['vfb_dashboard_recent_entries'] ) )
|
102 |
$widget_options['vfb_dashboard_recent_entries'] = array();
|
|
|
103 |
|
104 |
-
if (
|
105 |
$number = absint( $_POST['vfb-widget-recent-entries']['items'] );
|
106 |
$widget_options['vfb_dashboard_recent_entries']['items'] = $number;
|
107 |
update_option( 'vfb_dashboard_widget_options', $widget_options );
|
@@ -114,8 +121,8 @@ class Visual_Form_Builder_Dashboard_Widgets {
|
|
114 |
<label for="comments-number">%1$s</label>
|
115 |
<input id="comments-number" name="vfb-widget-recent-entries[items]" type="text" value="%2$d" size="3" />
|
116 |
</p>',
|
117 |
-
|
118 |
-
$number
|
119 |
);
|
120 |
}
|
121 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that displays widgets on the WordPress dashboard
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Dashboard_Widgets {
|
6 |
/**
|
7 |
* __construct function.
|
8 |
*
|
9 |
* @access public
|
|
|
10 |
* @return void
|
11 |
*/
|
12 |
public function __construct() {
|
|
|
13 |
add_action( 'wp_dashboard_setup', array( $this, 'register_widgets' ) );
|
14 |
}
|
15 |
|
27 |
array( $this, 'widget_control' )
|
28 |
);
|
29 |
|
30 |
+
if ( ! get_option( 'vfb_dashboard_widget_options' ) ) {
|
31 |
$widget_options['vfb_dashboard_recent_entries'] = array(
|
32 |
'items' => 5,
|
33 |
);
|
37 |
|
38 |
/**
|
39 |
* Display recent submitted entries
|
40 |
+
*
|
41 |
* @return [type] [description]
|
42 |
*/
|
43 |
public function widget_entries() {
|
44 |
global $wpdb;
|
45 |
|
|
|
46 |
$date_format = get_option( 'date_format' );
|
47 |
$time_format = get_option( 'time_format' );
|
48 |
|
49 |
$widgets = get_option( 'vfb_dashboard_widget_options' );
|
50 |
$total_items = isset( $widgets['vfb_dashboard_recent_entries'] ) && isset( $widgets['vfb_dashboard_recent_entries']['items'] ) ? absint( $widgets['vfb_dashboard_recent_entries']['items'] ) : 5;
|
51 |
|
52 |
+
$forms = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . VFB_WP_FORMS_TABLE_NAME );
|
53 |
|
54 |
+
if ( ! $forms ) {
|
55 |
+
printf(
|
56 |
'<p>%1$s <a href="%2$s">%3$s</a></p>',
|
57 |
+
esc_html__( 'You currently do not have any forms.', 'visual-form-builder' ),
|
58 |
esc_url( admin_url( 'admin.php?page=vfb-add-new' ) ),
|
59 |
+
esc_html__( 'Get started!', 'visual-form-builder' )
|
60 |
);
|
61 |
|
62 |
return;
|
63 |
}
|
64 |
|
65 |
+
$entries = $wpdb->get_results( $wpdb->prepare( 'SELECT forms.form_title, entries.entries_id, entries.form_id, entries.sender_name, entries.sender_email, entries.date_submitted FROM ' . VFB_WP_FORMS_TABLE_NAME . ' AS forms INNER JOIN ' . VFB_WP_ENTRIES_TABLE_NAME . ' AS entries ON entries.form_id = forms.form_id ORDER BY entries.date_submitted DESC LIMIT %d', $total_items ) );
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
if ( ! $entries ) {
|
68 |
+
printf(
|
69 |
+
'<p>%1$s</p>',
|
70 |
+
esc_html__( 'You currently do not have any entries.', 'visual-form-builder' )
|
71 |
+
);
|
72 |
+
} else {
|
73 |
$content = '';
|
74 |
|
75 |
foreach ( $entries as $entry ) {
|
76 |
$content .= sprintf(
|
77 |
'<li><a href="%1$s">%4$s</a> via <a href="%2$s">%5$s</a> <span class="rss-date">%6$s</span><cite>%3$s</cite></li>',
|
78 |
+
esc_url(
|
79 |
+
add_query_arg(
|
80 |
+
array(
|
81 |
+
'action' => 'view',
|
82 |
+
'entry' => absint( $entry->entries_id ),
|
83 |
+
),
|
84 |
+
admin_url( 'admin.php?page=vfb-entries' )
|
85 |
+
)
|
86 |
+
),
|
87 |
esc_url( add_query_arg( 'form-filter', absint( $entry->form_id ), admin_url( 'admin.php?page=vfb-entries' ) ) ),
|
88 |
esc_html( $entry->sender_name ),
|
89 |
esc_html( $entry->sender_email ),
|
90 |
esc_html( $entry->form_title ),
|
91 |
+
gmdate( "$date_format $time_format", strtotime( $entry->date_submitted ) )
|
92 |
);
|
93 |
}
|
94 |
|
95 |
+
echo "<div class='rss-widget'><ul>" . wp_kses_post( $content ) . '</ul></div>';
|
96 |
}
|
97 |
}
|
98 |
|
99 |
/**
|
100 |
* Displays the dashboard widget form control
|
|
|
101 |
*/
|
102 |
public function widget_control() {
|
103 |
+
if ( ! $widget_options = get_option( 'vfb_dashboard_widget_options' ) ) {
|
104 |
$widget_options = array();
|
105 |
+
}
|
106 |
|
107 |
+
if ( ! isset( $widget_options['vfb_dashboard_recent_entries'] ) ) {
|
108 |
$widget_options['vfb_dashboard_recent_entries'] = array();
|
109 |
+
}
|
110 |
|
111 |
+
if ( isset( $_POST['vfb-widget-recent-entries']['items'] ) ) {
|
112 |
$number = absint( $_POST['vfb-widget-recent-entries']['items'] );
|
113 |
$widget_options['vfb_dashboard_recent_entries']['items'] = $number;
|
114 |
update_option( 'vfb_dashboard_widget_options', $widget_options );
|
121 |
<label for="comments-number">%1$s</label>
|
122 |
<input id="comments-number" name="vfb-widget-recent-entries[items]" type="text" value="%2$d" size="3" />
|
123 |
</p>',
|
124 |
+
esc_html__( 'Number of entries to show:', 'visual-form-builder' ),
|
125 |
+
esc_html( $number )
|
126 |
);
|
127 |
}
|
128 |
}
|
admin/class-entries-detail.php
CHANGED
@@ -12,6 +12,9 @@ class Visual_Form_Builder_Entries_Detail {
|
|
12 |
add_action( 'admin_init', array( $this, 'entries_detail' ) );
|
13 |
}
|
14 |
|
|
|
|
|
|
|
15 |
public function entries_detail() {
|
16 |
global $wpdb;
|
17 |
|
@@ -19,77 +22,85 @@ class Visual_Form_Builder_Entries_Detail {
|
|
19 |
|
20 |
$entry_id = absint( $_GET['entry'] );
|
21 |
|
22 |
-
$entries = $wpdb->get_results( $wpdb->prepare(
|
23 |
|
24 |
-
// Get the date/time format that is saved in the options table
|
25 |
-
$date_format = get_option('date_format');
|
26 |
-
$time_format = get_option('time_format');
|
27 |
|
28 |
-
// Loop trough the entries and setup the data to be displayed for each row
|
29 |
foreach ( $entries as $entry ) {
|
30 |
$data = unserialize( $entry->data );
|
31 |
-
?>
|
32 |
<form id="entry-edit" method="post" action="">
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
$open_fieldset = $open_section = false;
|
87 |
|
88 |
foreach ( $data as $k => $v ) :
|
89 |
-
if ( !is_array( $v ) ) :
|
90 |
-
if ( $count
|
91 |
echo '<div class="postbox">
|
92 |
-
<h3><span>' . $entry->form_title . ' : ' .
|
93 |
<div class="inside">';
|
94 |
}
|
95 |
|
@@ -97,69 +108,67 @@ class Visual_Form_Builder_Entries_Detail {
|
|
97 |
echo esc_html( $v );
|
98 |
$count++;
|
99 |
else :
|
100 |
-
// Cast each array as an object
|
101 |
$obj = (object) $v;
|
102 |
|
103 |
-
if ( $obj->type
|
104 |
-
// Close each fieldset
|
105 |
-
if ( $open_fieldset
|
106 |
echo '</table>';
|
|
|
107 |
|
108 |
printf( '<h3>%s</h3><table class="form-table">', esc_html( $obj->name ) );
|
109 |
|
110 |
$open_fieldset = true;
|
111 |
endif;
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
case '
|
116 |
-
case '
|
117 |
-
case '
|
118 |
-
case '
|
119 |
-
case '
|
120 |
-
case 'secret' :
|
121 |
break;
|
122 |
|
123 |
-
case 'file-upload'
|
124 |
?>
|
125 |
<tr valign="top">
|
126 |
-
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
127 |
-
<td style="background:#eee;border:1px solid #ddd"><a href="<?php
|
128 |
</tr>
|
129 |
-
|
130 |
break;
|
131 |
|
132 |
-
case 'textarea'
|
133 |
-
case 'html'
|
134 |
?>
|
135 |
<tr valign="top">
|
136 |
-
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
137 |
<td style="background:#eee;border:1px solid #ddd"><?php echo wpautop( esc_html( $obj->value ) ); ?></td>
|
138 |
</tr>
|
139 |
-
|
140 |
break;
|
141 |
|
142 |
-
default
|
143 |
?>
|
144 |
<tr valign="top">
|
145 |
-
<th scope="row"><label for="field[<?php echo $obj->id; ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
146 |
<td style="background:#eee;border:1px solid #ddd"><?php echo esc_html( $obj->value ); ?></td>
|
147 |
</tr>
|
148 |
-
|
149 |
break;
|
150 |
-
|
151 |
-
endswitch;
|
152 |
endif;
|
153 |
endforeach;
|
154 |
|
155 |
-
if ( $count > 0 )
|
156 |
echo '</div></div>';
|
157 |
-
|
158 |
}
|
159 |
echo '</table></div>';
|
160 |
echo '<br class="clear"></div>';
|
161 |
|
162 |
-
|
163 |
echo '</form>';
|
164 |
}
|
165 |
}
|
12 |
add_action( 'admin_init', array( $this, 'entries_detail' ) );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* [entries_detail description]
|
17 |
+
*/
|
18 |
public function entries_detail() {
|
19 |
global $wpdb;
|
20 |
|
22 |
|
23 |
$entry_id = absint( $_GET['entry'] );
|
24 |
|
25 |
+
$entries = $wpdb->get_results( $wpdb->prepare( 'SELECT forms.form_title, entries.* FROM ' . VFB_WP_FORMS_TABLE_NAME . ' AS forms INNER JOIN ' . VFB_WP_ENTRIES_TABLE_NAME . ' AS entries ON entries.form_id = forms.form_id WHERE entries.entries_id = %d', $entry_id ) );
|
26 |
|
27 |
+
// Get the date/time format that is saved in the options table.
|
28 |
+
$date_format = get_option( 'date_format' );
|
29 |
+
$time_format = get_option( 'time_format' );
|
30 |
|
31 |
+
// Loop trough the entries and setup the data to be displayed for each row.
|
32 |
foreach ( $entries as $entry ) {
|
33 |
$data = unserialize( $entry->data );
|
34 |
+
?>
|
35 |
<form id="entry-edit" method="post" action="">
|
36 |
+
<h3><span><?php echo esc_html( $entry->form_title ); ?> : <?php esc_attr_e( 'Entry', 'visual-form-builder' ); ?> # <?php echo esc_html( $entry->entries_id ); ?></span></h3>
|
37 |
+
<div id="vfb-poststuff" class="metabox-holder has-right-sidebar">
|
38 |
+
<div id="side-info-column" class="inner-sidebar">
|
39 |
+
<div id="side-sortables">
|
40 |
+
<div id="submitdiv" class="postbox">
|
41 |
+
<h3><span><?php esc_html_e( 'Details', 'visual-form-builder' ); ?></span></h3>
|
42 |
+
<div class="inside">
|
43 |
+
<div id="submitbox" class="submitbox">
|
44 |
+
<div id="minor-publishing">
|
45 |
+
<div id="misc-publishing-actions">
|
46 |
+
<div class="misc-pub-section">
|
47 |
+
<span><strong><?php esc_html_e( 'Form Title', 'visual-form-builder' ); ?>: </strong><?php echo esc_html( $entry->form_title ); ?></span>
|
48 |
+
</div>
|
49 |
+
<div class="misc-pub-section">
|
50 |
+
<span><strong><?php esc_html_e( 'Date Submitted', 'visual-form-builder' ); ?>: </strong><?php echo esc_html( gmdate( "$date_format $time_format", strtotime( $entry->date_submitted ) ) ); ?></span>
|
51 |
+
</div>
|
52 |
+
<div class="misc-pub-section">
|
53 |
+
<span><strong><?php esc_html_e( 'IP Address', 'visual-form-builder' ); ?>: </strong><?php echo esc_html( $entry->ip_address ); ?></span>
|
54 |
+
</div>
|
55 |
+
<div class="misc-pub-section">
|
56 |
+
<span><strong><?php esc_html_e( 'Email Subject', 'visual-form-builder' ); ?>: </strong><?php echo esc_html( $entry->subject ); ?></span>
|
57 |
+
</div>
|
58 |
+
<div class="misc-pub-section">
|
59 |
+
<span><strong><?php esc_html_e( 'Sender Name', 'visual-form-builder' ); ?>: </strong><?php echo esc_html( $entry->sender_name ); ?></span>
|
60 |
+
</div>
|
61 |
+
<div class="misc-pub-section">
|
62 |
+
<span><strong><?php esc_html_e( 'Sender Email', 'visual-form-builder' ); ?>: </strong><a href="mailto:<?php echo esc_html( $entry->sender_email ); ?>"><?php echo esc_html( $entry->sender_email ); ?></a></span>
|
63 |
+
</div>
|
64 |
+
<div class="misc-pub-section">
|
65 |
+
<span><strong><?php esc_html_e( 'Emailed To', 'visual-form-builder' ); ?>: </strong><?php echo preg_replace( '/\b([A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4})\b/i', '<a href="mailto:$1">$1</a>', esc_html( implode( ',', unserialize( wp_unslash( $entry->emails_to ) ) ) ) ); ?></span>
|
66 |
+
</div>
|
67 |
+
<div class="clear"></div>
|
68 |
+
</div> <!--#misc-publishing-actions -->
|
69 |
+
</div> <!-- #minor-publishing -->
|
70 |
+
|
71 |
+
<div id="major-publishing-actions">
|
72 |
+
<div id="delete-action">
|
73 |
+
<?php
|
74 |
+
printf(
|
75 |
+
'<a class="submitdelete deletion entry-delete" href="%2$s&action=%3$s&entry=%4$d">%1$s</a>',
|
76 |
+
esc_html__( 'Move to Trash', 'visual-form-builder' ),
|
77 |
+
wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_trash_entry' ),
|
78 |
+
'trash',
|
79 |
+
absint( $entry_id )
|
80 |
+
);
|
81 |
+
?>
|
82 |
+
</div>
|
83 |
+
<div id="publishing-action">
|
84 |
+
<?php submit_button( esc_html__( 'Print', 'visual-form-builder' ), 'secondary', 'submit', false, array( 'onclick' => 'window.print();return false;' ) ); ?>
|
85 |
+
</div>
|
86 |
+
<div class="clear"></div>
|
87 |
+
</div> <!-- #major-publishing-actions -->
|
88 |
+
</div> <!-- #submitbox -->
|
89 |
+
</div> <!-- .inside -->
|
90 |
+
</div> <!-- #submitdiv -->
|
91 |
+
</div> <!-- #side-sortables -->
|
92 |
+
</div> <!-- #side-info-column -->
|
93 |
+
|
94 |
+
<div id="vfb-entries-body-content">
|
95 |
+
<?php
|
96 |
+
$count = 0;
|
97 |
$open_fieldset = $open_section = false;
|
98 |
|
99 |
foreach ( $data as $k => $v ) :
|
100 |
+
if ( ! is_array( $v ) ) :
|
101 |
+
if ( $count === 0 ) {
|
102 |
echo '<div class="postbox">
|
103 |
+
<h3><span>' . esc_html( $entry->form_title ) . ' : ' . esc_html__( 'Entry', 'visual-form-builder' ) . ' #' . esc_html( $entry->entries_id ) . '</span></h3>
|
104 |
<div class="inside">';
|
105 |
}
|
106 |
|
108 |
echo esc_html( $v );
|
109 |
$count++;
|
110 |
else :
|
111 |
+
// Cast each array as an object.
|
112 |
$obj = (object) $v;
|
113 |
|
114 |
+
if ( 'fieldset' === $obj->type ) :
|
115 |
+
// Close each fieldset.
|
116 |
+
if ( true === $open_fieldset ) {
|
117 |
echo '</table>';
|
118 |
+
}
|
119 |
|
120 |
printf( '<h3>%s</h3><table class="form-table">', esc_html( $obj->name ) );
|
121 |
|
122 |
$open_fieldset = true;
|
123 |
endif;
|
124 |
|
125 |
+
switch ( $obj->type ) {
|
126 |
+
case 'fieldset':
|
127 |
+
case 'section':
|
128 |
+
case 'submit':
|
129 |
+
case 'page-break':
|
130 |
+
case 'verification':
|
131 |
+
case 'secret':
|
|
|
132 |
break;
|
133 |
|
134 |
+
case 'file-upload':
|
135 |
?>
|
136 |
<tr valign="top">
|
137 |
+
<th scope="row"><label for="field[<?php echo esc_attr( $obj->id ); ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
138 |
+
<td style="background:#eee;border:1px solid #ddd"><a href="<?php esc_attr( $obj->value ); ?>" target="_blank"><?php echo esc_html( $obj->value ); ?></a></td>
|
139 |
</tr>
|
140 |
+
<?php
|
141 |
break;
|
142 |
|
143 |
+
case 'textarea':
|
144 |
+
case 'html':
|
145 |
?>
|
146 |
<tr valign="top">
|
147 |
+
<th scope="row"><label for="field[<?php echo esc_attr( $obj->id ); ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
148 |
<td style="background:#eee;border:1px solid #ddd"><?php echo wpautop( esc_html( $obj->value ) ); ?></td>
|
149 |
</tr>
|
150 |
+
<?php
|
151 |
break;
|
152 |
|
153 |
+
default:
|
154 |
?>
|
155 |
<tr valign="top">
|
156 |
+
<th scope="row"><label for="field[<?php echo esc_attr( $obj->id ); ?>]"><?php echo esc_html( $obj->name ); ?></label></th>
|
157 |
<td style="background:#eee;border:1px solid #ddd"><?php echo esc_html( $obj->value ); ?></td>
|
158 |
</tr>
|
159 |
+
<?php
|
160 |
break;
|
161 |
+
}
|
|
|
162 |
endif;
|
163 |
endforeach;
|
164 |
|
165 |
+
if ( $count > 0 ) {
|
166 |
echo '</div></div>';
|
167 |
+
}
|
168 |
}
|
169 |
echo '</table></div>';
|
170 |
echo '<br class="clear"></div>';
|
171 |
|
|
|
172 |
echo '</form>';
|
173 |
}
|
174 |
}
|
admin/class-entries-list.php
CHANGED
@@ -4,34 +4,41 @@
|
|
4 |
*
|
5 |
* @since 1.2
|
6 |
*/
|
7 |
-
class Visual_Form_Builder_Entries_List extends
|
8 |
/**
|
9 |
* [__construct description]
|
10 |
*/
|
11 |
-
function __construct(){
|
12 |
global $status, $page;
|
13 |
|
14 |
-
// CSV delimiter
|
15 |
$this->delimiter = apply_filters( 'vfb_csv_delimiter', ',' );
|
16 |
|
17 |
-
// Set parent defaults
|
18 |
-
parent::__construct(
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
// Handle our bulk actions
|
25 |
$this->process_bulk_action();
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
/**
|
29 |
* Display column names. We'll handle the Form column separately.
|
30 |
*
|
31 |
-
* @
|
32 |
-
* @
|
|
|
|
|
33 |
*/
|
34 |
-
function column_default( $item, $column_name ){
|
35 |
switch ( $column_name ) {
|
36 |
case 'subject':
|
37 |
case 'sender_name':
|
@@ -39,7 +46,7 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
39 |
case 'emails_to':
|
40 |
case 'date':
|
41 |
case 'ip_address':
|
42 |
-
case 'entry_id'
|
43 |
return $item[ $column_name ];
|
44 |
}
|
45 |
}
|
@@ -47,19 +54,21 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
47 |
/**
|
48 |
* Builds the on:hover links for the Form column
|
49 |
*
|
50 |
-
* @
|
|
|
|
|
51 |
*/
|
52 |
-
function column_form( $item ){
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
-
if (
|
59 |
-
$actions['trash'] = sprintf( '<a href="%s&action=%s&entry=%s">Trash</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_trash_entry' ), 'trash', $item['entry_id'] );
|
60 |
-
elseif ( $this->get_entry_status() && 'trash'
|
61 |
-
$actions['restore'] = sprintf( '<a href="%s&action=%s&entry=%s">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_undo_trash_entry' ), 'restore', $item['entry_id'], __( 'Restore', 'visual-form-builder' ) );
|
62 |
-
$actions['delete']
|
63 |
}
|
64 |
|
65 |
return sprintf( '%1$s %2$s', $item['form'], $this->row_actions( $actions ) );
|
@@ -68,28 +77,30 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
68 |
/**
|
69 |
* Used for checkboxes and bulk editing
|
70 |
*
|
71 |
-
* @
|
|
|
|
|
72 |
*/
|
73 |
-
function column_cb( $item ){
|
74 |
return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['entry_id'] );
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
* Builds the actual columns
|
79 |
*
|
80 |
-
* @
|
81 |
*/
|
82 |
-
function get_columns(){
|
83 |
$columns = array(
|
84 |
-
'cb'
|
85 |
-
'form'
|
86 |
-
'subject'
|
87 |
-
'sender_name'
|
88 |
-
'sender_email'
|
89 |
-
'emails_to'
|
90 |
-
'ip_address'
|
91 |
-
'date'
|
92 |
-
'entry_id'
|
93 |
);
|
94 |
|
95 |
return $columns;
|
@@ -98,16 +109,21 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
98 |
/**
|
99 |
* A custom function to get the entries and sort them
|
100 |
*
|
101 |
-
* @
|
102 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
103 |
*/
|
104 |
-
function get_entries( $orderby = 'date', $order = 'ASC', $per_page, $offset = 0, $search = '' ){
|
105 |
global $wpdb;
|
106 |
|
107 |
-
// Set OFFSET for pagination
|
108 |
$offset = ( $offset > 0 ) ? "OFFSET $offset" : '';
|
109 |
|
110 |
-
|
111 |
case 'date':
|
112 |
$order_col = 'date_submitted';
|
113 |
break;
|
@@ -123,44 +139,47 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
123 |
$order_col = $orderby;
|
124 |
break;
|
125 |
|
126 |
-
case 'entry_id'
|
127 |
$order_col = 'entries_id';
|
128 |
break;
|
129 |
}
|
130 |
|
131 |
$where = '';
|
132 |
|
133 |
-
// If the form filter dropdown is used
|
134 |
-
if ( $this->current_filter_action() )
|
135 |
$where .= $wpdb->prepare( 'AND forms.form_id = %d', $this->current_filter_action() );
|
|
|
136 |
|
137 |
-
// Get the month and year from the dropdown
|
138 |
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
139 |
|
140 |
-
// If a month/year has been selected, parse out the month/year and build the clause
|
141 |
if ( $m > 0 ) {
|
142 |
-
$year
|
143 |
-
$month
|
144 |
|
145 |
-
$where .= $wpdb->prepare(
|
146 |
}
|
147 |
|
148 |
-
// Get the month/year from the dropdown
|
149 |
$today = isset( $_GET['today'] ) ? (int) $_GET['today'] : 0;
|
150 |
|
151 |
-
// Parse month/year and build the clause
|
152 |
-
if ( $today > 0 )
|
153 |
-
$where .=
|
|
|
154 |
|
155 |
-
// Entries type filter
|
156 |
$where .= ( $this->get_entry_status() && 'all' !== $this->get_entry_status() ) ? $wpdb->prepare( ' AND entries.entry_approved = %s', $this->get_entry_status() ) : '';
|
157 |
|
158 |
-
// Always display approved entries, unless an Entries Type filter is set
|
159 |
-
if (
|
160 |
$where .= $wpdb->prepare( ' AND entries.entry_approved = %d', 1 );
|
|
|
161 |
|
162 |
$sql_order = sanitize_sql_orderby( "$order_col $order" );
|
163 |
-
$cols
|
164 |
|
165 |
return $cols;
|
166 |
}
|
@@ -168,41 +187,42 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
168 |
/**
|
169 |
* Get the entry status: All, Spam, or Trash
|
170 |
*
|
171 |
-
* @since
|
172 |
* @returns string Entry status
|
173 |
*/
|
174 |
-
function get_entry_status() {
|
175 |
-
if ( !isset( $_GET['entry_status'] ) )
|
176 |
return false;
|
|
|
177 |
|
178 |
-
return esc_html( $_GET['entry_status'] );
|
179 |
}
|
180 |
|
181 |
/**
|
182 |
* Build the different views for the entries screen
|
183 |
*
|
184 |
-
* @
|
185 |
-
* @returns array $status_links Status links with counts
|
186 |
*/
|
187 |
-
function get_views() {
|
188 |
$status_links = array();
|
189 |
-
$num_entries
|
190 |
-
$class
|
191 |
-
$link
|
192 |
|
193 |
$stati = array(
|
194 |
-
'all'
|
195 |
-
'trash'
|
196 |
);
|
197 |
|
198 |
$total_entries = (int) $num_entries->all;
|
199 |
-
$entry_status
|
200 |
|
201 |
foreach ( $stati as $status => $label ) {
|
202 |
-
$class = ( $status
|
203 |
|
204 |
-
if ( !isset( $num_entries->$status ) )
|
205 |
$num_entries->$status = 10;
|
|
|
206 |
|
207 |
$link = add_query_arg( 'entry_status', $status, $link );
|
208 |
|
@@ -218,30 +238,38 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
218 |
/**
|
219 |
* Get the number of entries for use with entry statuses
|
220 |
*
|
221 |
-
* @
|
222 |
-
* @returns array $stats Counts of different entry types
|
223 |
*/
|
224 |
-
function get_entries_count() {
|
225 |
global $wpdb;
|
226 |
|
227 |
$stats = array();
|
228 |
|
229 |
-
$entries = $wpdb->get_results(
|
230 |
|
231 |
-
$total
|
232 |
-
$approved = array(
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
foreach ( (array) $entries as $row ) {
|
234 |
-
// Don't count trashed toward totals
|
235 |
-
if ( 'trash'
|
236 |
$total += $row['num_entries'];
|
237 |
-
|
238 |
-
|
|
|
|
|
239 |
}
|
240 |
|
241 |
$stats['all'] = $total;
|
242 |
foreach ( $approved as $key ) {
|
243 |
-
if ( empty( $stats[ $key ] ) )
|
244 |
$stats[ $key ] = 0;
|
|
|
245 |
}
|
246 |
|
247 |
$stats = (object) $stats;
|
@@ -252,17 +280,16 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
252 |
/**
|
253 |
* Setup which columns are sortable. Default is by Date.
|
254 |
*
|
255 |
-
* @
|
256 |
-
* @returns array() $sortable_columns Sortable columns
|
257 |
*/
|
258 |
-
function get_sortable_columns() {
|
259 |
$sortable_columns = array(
|
260 |
-
'form'
|
261 |
-
'subject'
|
262 |
-
'sender_name'
|
263 |
-
'sender_email'
|
264 |
-
'date'
|
265 |
-
'entry_id'
|
266 |
);
|
267 |
|
268 |
return $sortable_columns;
|
@@ -271,16 +298,14 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
271 |
/**
|
272 |
* Define our bulk actions
|
273 |
*
|
274 |
-
* @
|
275 |
-
* @returns array() $actions Bulk actions
|
276 |
*/
|
277 |
-
function get_bulk_actions() {
|
278 |
-
|
279 |
-
if ( !$this->get_entry_status() || 'all' == $this->get_entry_status() )
|
280 |
$actions['trash'] = __( 'Move to Trash', 'visual-form-builder' );
|
281 |
-
elseif ( $this->get_entry_status() && 'trash'
|
282 |
$actions['restore'] = __( 'Restore', 'visual-form-builder' );
|
283 |
-
$actions['delete']
|
284 |
}
|
285 |
|
286 |
return $actions;
|
@@ -289,374 +314,320 @@ class Visual_Form_Builder_Entries_List extends Visual_Form_Builder_List_Table {
|
|
289 |
/**
|
290 |
* Process our bulk actions
|
291 |
*
|
292 |
-
* @
|
293 |
*/
|
294 |
-
function process_bulk_action() {
|
295 |
global $wpdb;
|
296 |
|
297 |
$entry_id = '';
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
}
|
306 |
|
307 |
-
switch( $this->current_action() )
|
308 |
-
case 'trash'
|
309 |
-
check_admin_referer( '
|
310 |
|
311 |
foreach ( $entry_id as $id ) {
|
312 |
$id = absint( $id );
|
313 |
$wpdb->update( VFB_WP_ENTRIES_TABLE_NAME, array( 'entry_approved' => 'trash' ), array( 'entries_id' => $id ) );
|
314 |
}
|
315 |
-
|
316 |
|
317 |
-
case '
|
318 |
-
check_admin_referer( '
|
319 |
|
320 |
foreach ( $entry_id as $id ) {
|
321 |
$id = absint( $id );
|
322 |
-
$wpdb->
|
323 |
}
|
324 |
-
|
325 |
|
326 |
-
case '
|
327 |
-
check_admin_referer( '
|
328 |
|
329 |
foreach ( $entry_id as $id ) {
|
330 |
$id = absint( $id );
|
331 |
-
$wpdb->
|
332 |
}
|
333 |
-
|
|
|
|
|
334 |
|
335 |
-
|
336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
|
338 |
-
|
|
|
|
|
339 |
|
340 |
-
|
|
|
|
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
}
|
349 |
|
350 |
/**
|
351 |
* Adds our forms filter dropdown
|
352 |
*
|
353 |
-
* @
|
|
|
|
|
354 |
*/
|
355 |
-
function extra_tablenav( $which ) {
|
356 |
global $wpdb;
|
357 |
|
358 |
-
$cols = $wpdb->get_results(
|
359 |
|
360 |
-
// Only display the dropdown on the top of the table
|
361 |
-
if ( 'top'
|
362 |
echo '<div class="alignleft actions">';
|
363 |
-
|
364 |
echo '<select id="form-filter" name="form-filter">
|
365 |
-
|
366 |
|
367 |
foreach ( $cols as $form ) {
|
368 |
-
|
369 |
-
$
|
370 |
-
|
371 |
-
$form->
|
|
|
372 |
);
|
373 |
}
|
374 |
|
375 |
echo '</select>
|
376 |
-
|
377 |
-
|
378 |
}
|
379 |
}
|
380 |
|
381 |
/**
|
382 |
* Display Year/Month filter
|
383 |
*
|
384 |
-
* @
|
|
|
|
|
385 |
*/
|
386 |
-
function months_dropdown( $post_type = '' ) {
|
387 |
global $wpdb, $wp_locale;
|
388 |
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
|
|
|
|
394 |
|
395 |
$month_count = count( $months );
|
396 |
|
397 |
-
if (
|
398 |
return;
|
|
|
399 |
|
400 |
-
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
401 |
-
?>
|
402 |
-
|
403 |
-
|
404 |
-
<?php
|
405 |
foreach ( $months as $arc_row ) {
|
406 |
-
if ( 0 == $arc_row->year )
|
407 |
continue;
|
|
|
408 |
|
409 |
$month = zeroise( $arc_row->month, 2 );
|
410 |
-
$year
|
411 |
|
412 |
-
printf(
|
413 |
-
|
|
|
414 |
esc_attr( $arc_row->year . $month ),
|
415 |
-
sprintf(
|
416 |
);
|
417 |
}
|
418 |
-
?>
|
419 |
-
|
420 |
-
<?php
|
421 |
}
|
422 |
|
423 |
/**
|
424 |
* Set our forms filter action
|
425 |
*
|
426 |
-
* @
|
427 |
-
* @returns int Form ID
|
428 |
*/
|
429 |
-
function current_filter_action() {
|
430 |
-
if ( isset( $_POST['form-filter'] ) && -1
|
431 |
return absint( $_POST['form-filter'] );
|
|
|
432 |
|
433 |
return false;
|
434 |
}
|
435 |
|
436 |
-
/**
|
437 |
-
* Display Search box
|
438 |
-
*
|
439 |
-
* @since 1.4
|
440 |
-
* @returns html Search Form
|
441 |
-
*/
|
442 |
-
function search_box( $text, $input_id ) {
|
443 |
-
parent::search_box( $text, $input_id );
|
444 |
-
}
|
445 |
-
|
446 |
/**
|
447 |
* Prepares our data for display
|
448 |
*
|
449 |
* @since 1.2
|
450 |
*/
|
451 |
-
function prepare_items() {
|
452 |
global $wpdb;
|
453 |
|
454 |
-
// get the current user ID
|
455 |
$user = get_current_user_id();
|
456 |
|
457 |
-
// get the current admin screen
|
458 |
$screen = get_current_screen();
|
459 |
|
460 |
-
// retrieve the "per_page" option
|
461 |
$screen_option = $screen->get_option( 'per_page', 'option' );
|
462 |
|
463 |
-
// retrieve the value of the option stored for the current user
|
464 |
$per_page = get_user_meta( $user, $screen_option, true );
|
465 |
|
466 |
-
// get the default value if none is set
|
467 |
-
if ( empty
|
468 |
$per_page = 20;
|
|
|
469 |
|
470 |
-
// Get the date/time format that is saved in the options table
|
471 |
$date_format = get_option( 'date_format' );
|
472 |
$time_format = get_option( 'time_format' );
|
473 |
|
474 |
// What page are we looking at?
|
475 |
$current_page = $this->get_pagenum();
|
476 |
|
477 |
-
// Use offset for pagination
|
478 |
$offset = ( $current_page - 1 ) * $per_page;
|
479 |
|
480 |
-
// Get column headers
|
481 |
$columns = $this->get_columns();
|
482 |
-
$hidden
|
483 |
|
484 |
-
// Get sortable columns
|
485 |
$sortable = $this->get_sortable_columns();
|
486 |
|
487 |
-
// Build the column headers
|
488 |
-
$this->_column_headers = array($columns, $hidden, $sortable);
|
489 |
|
490 |
-
// Get entries search terms
|
491 |
-
$search_terms = ( !empty( $_POST['s'] ) ) ? explode( ' ', sanitize_text_field( $_POST['s'] ) ) : array();
|
492 |
|
493 |
$searchand = $search = '';
|
494 |
-
// Loop through search terms and build query
|
495 |
-
foreach( $search_terms as $term ) {
|
496 |
$term = esc_sql( $wpdb->esc_like( $term ) );
|
497 |
|
498 |
-
$search
|
499 |
$searchand = ' AND ';
|
500 |
}
|
501 |
|
502 |
-
$search = ( !empty($search) ) ? " AND ({$search}) " : '';
|
503 |
|
504 |
-
// Set our ORDER BY and ASC/DESC to sort the entries
|
505 |
-
$orderby = ( !empty( $_GET['orderby'] ) ) ? sanitize_text_field( $_GET['orderby'] ) : 'date';
|
506 |
-
$order = ( !empty( $_GET['order'] ) ) ? sanitize_text_field( $_GET['order'] ) : 'desc';
|
507 |
|
508 |
-
// Get the sorted entries
|
509 |
$entries = $this->get_entries( $orderby, $order, $per_page, $offset, $search );
|
510 |
|
511 |
$data = array();
|
512 |
|
513 |
-
// Loop trough the entries and setup the data to be displayed for each row
|
514 |
foreach ( $entries as $entry ) {
|
515 |
$data[] =
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
);
|
527 |
}
|
528 |
|
529 |
$where = '';
|
530 |
|
531 |
-
// If the form filter dropdown is used
|
532 |
-
if ( $this->current_filter_action() )
|
533 |
$where .= 'AND form_id = ' . $this->current_filter_action();
|
|
|
534 |
|
535 |
-
// Get the month/year from the dropdown
|
536 |
-
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
537 |
|
538 |
-
// Parse month/year and build the clause
|
539 |
if ( $m > 0 ) {
|
540 |
-
$year
|
541 |
$month = substr( $m, -2 );
|
542 |
|
543 |
$where .= " AND YEAR(date_submitted) = $year AND MONTH(date_submitted) = $month";
|
544 |
}
|
545 |
|
546 |
-
// Get the month/year from the dropdown
|
547 |
$today = isset( $_GET['today'] ) ? (int) $_GET['today'] : 0;
|
548 |
|
549 |
-
// Parse month/year and build the clause
|
550 |
-
if ( $today > 0 )
|
551 |
-
$where .=
|
|
|
552 |
|
553 |
-
// Entry type filter
|
554 |
$where .= ( $this->get_entry_status() && 'all' !== $this->get_entry_status() ) ? $wpdb->prepare( ' AND entries.entry_approved = %s', $this->get_entry_status() ) : '';
|
555 |
|
556 |
-
// Always display approved entries, unless an Entries Type filter is set
|
557 |
-
if (
|
558 |
$where .= $wpdb->prepare( ' AND entries.entry_approved = %d', 1 );
|
|
|
559 |
|
560 |
// How many entries do we have?
|
561 |
-
$total_items = $wpdb->get_var(
|
562 |
|
563 |
-
// Add sorted data to the items property
|
564 |
$this->items = $data;
|
565 |
|
566 |
-
// Register our pagination
|
567 |
-
$this->set_pagination_args(
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
/**
|
575 |
-
* Display the pagination.
|
576 |
-
* Customize default function to work with months and form drop down filters
|
577 |
-
*
|
578 |
-
* @since 3.1.0
|
579 |
-
* @access protected
|
580 |
-
*/
|
581 |
-
function pagination( $which ) {
|
582 |
-
if ( empty( $this->_pagination_args ) )
|
583 |
-
return;
|
584 |
-
|
585 |
-
extract( $this->_pagination_args, EXTR_SKIP );
|
586 |
-
|
587 |
-
$output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
|
588 |
-
|
589 |
-
$current = $this->get_pagenum();
|
590 |
-
|
591 |
-
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
592 |
-
|
593 |
-
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
594 |
-
|
595 |
-
$page_links = array();
|
596 |
-
|
597 |
-
// Added to pick up the months dropdown
|
598 |
-
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
599 |
-
|
600 |
-
$disable_first = $disable_last = '';
|
601 |
-
if ( $current == 1 )
|
602 |
-
$disable_first = ' disabled';
|
603 |
-
if ( $current == $total_pages )
|
604 |
-
$disable_last = ' disabled';
|
605 |
-
|
606 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
607 |
-
'first-page' . $disable_first,
|
608 |
-
esc_attr__( 'Go to the first page' ),
|
609 |
-
esc_url( remove_query_arg( 'paged', $current_url ) ),
|
610 |
-
'«'
|
611 |
-
);
|
612 |
-
|
613 |
-
// Modified the add_query_args to include my custom dropdowns
|
614 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
615 |
-
'prev-page' . $disable_first,
|
616 |
-
esc_attr__( 'Go to the previous page' ),
|
617 |
-
esc_url( add_query_arg( array( 'paged' => max( 1, $current-1 ), 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
618 |
-
'‹'
|
619 |
-
);
|
620 |
-
|
621 |
-
if ( 'bottom' == $which )
|
622 |
-
$html_current_page = $current;
|
623 |
-
else
|
624 |
-
$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
|
625 |
-
esc_attr__( 'Current page' ),
|
626 |
-
$current,
|
627 |
-
strlen( $total_pages )
|
628 |
-
);
|
629 |
-
|
630 |
-
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
|
631 |
-
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
|
632 |
-
|
633 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
634 |
-
'next-page' . $disable_last,
|
635 |
-
esc_attr__( 'Go to the next page' ),
|
636 |
-
esc_url( add_query_arg( array( 'paged' => min( $total_pages, $current+1 ), 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
637 |
-
'›'
|
638 |
-
);
|
639 |
-
|
640 |
-
// Modified the add_query_args to include my custom dropdowns
|
641 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
642 |
-
'last-page' . $disable_last,
|
643 |
-
esc_attr__( 'Go to the last page' ),
|
644 |
-
esc_url( add_query_arg( array( 'paged' => $total_pages, 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
645 |
-
'»'
|
646 |
);
|
647 |
-
|
648 |
-
$pagination_links_class = 'pagination-links';
|
649 |
-
if ( ! empty( $infinite_scroll ) )
|
650 |
-
$pagination_links_class = ' hide-if-js';
|
651 |
-
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
|
652 |
-
|
653 |
-
if ( $total_pages )
|
654 |
-
$page_class = $total_pages < 2 ? ' one-page' : '';
|
655 |
-
else
|
656 |
-
$page_class = ' no-pages';
|
657 |
-
|
658 |
-
$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
|
659 |
-
|
660 |
-
echo $this->_pagination;
|
661 |
}
|
662 |
}
|
4 |
*
|
5 |
* @since 1.2
|
6 |
*/
|
7 |
+
class Visual_Form_Builder_Entries_List extends WP_List_Table {
|
8 |
/**
|
9 |
* [__construct description]
|
10 |
*/
|
11 |
+
public function __construct() {
|
12 |
global $status, $page;
|
13 |
|
14 |
+
// CSV delimiter.
|
15 |
$this->delimiter = apply_filters( 'vfb_csv_delimiter', ',' );
|
16 |
|
17 |
+
// Set parent defaults.
|
18 |
+
parent::__construct(
|
19 |
+
array(
|
20 |
+
'singular' => 'entry',
|
21 |
+
'plural' => 'entries',
|
22 |
+
'ajax' => false,
|
23 |
+
)
|
24 |
+
);
|
25 |
|
26 |
+
// Handle our bulk actions.
|
27 |
$this->process_bulk_action();
|
28 |
+
|
29 |
+
// Handle row action links.
|
30 |
+
$this->process_row_action_links();
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
* Display column names. We'll handle the Form column separately.
|
35 |
*
|
36 |
+
* @param [type] $item [$item description].
|
37 |
+
* @param [type] $column_name [$column_name description].
|
38 |
+
*
|
39 |
+
* @return [type] [return description]
|
40 |
*/
|
41 |
+
public function column_default( $item, $column_name ) {
|
42 |
switch ( $column_name ) {
|
43 |
case 'subject':
|
44 |
case 'sender_name':
|
46 |
case 'emails_to':
|
47 |
case 'date':
|
48 |
case 'ip_address':
|
49 |
+
case 'entry_id':
|
50 |
return $item[ $column_name ];
|
51 |
}
|
52 |
}
|
54 |
/**
|
55 |
* Builds the on:hover links for the Form column
|
56 |
*
|
57 |
+
* @param [type] $item [$item description].
|
58 |
+
*
|
59 |
+
* @return [type] [return description]
|
60 |
*/
|
61 |
+
public function column_form( $item ) {
|
62 |
+
// Build row actions.
|
63 |
+
if ( ! $this->get_entry_status() || 'all' === $this->get_entry_status() ) {
|
64 |
+
$actions['view'] = sprintf( '<a href="%s&vfb-action=%s&entry=%s" id="%3$s" class="view-entry">View</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_view_entry' ), 'view', $item['entry_id'] );
|
65 |
+
}
|
66 |
|
67 |
+
if ( ! $this->get_entry_status() || 'all' === $this->get_entry_status() ) {
|
68 |
+
$actions['trash'] = sprintf( '<a href="%s&vfb-action=%s&entry=%s">Trash</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_trash_entry' ), 'trash', $item['entry_id'] );
|
69 |
+
} elseif ( $this->get_entry_status() && 'trash' === $this->get_entry_status() ) {
|
70 |
+
$actions['restore'] = sprintf( '<a href="%s&vfb-action=%s&entry=%s">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_undo_trash_entry' ), 'restore', $item['entry_id'], __( 'Restore', 'visual-form-builder' ) );
|
71 |
+
$actions['delete'] = sprintf( '<a href="%s&vfb-action=%s&entry=%s">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=vfb-entries' ), 'vfb_delete_entry' ), 'delete', $item['entry_id'], __( 'Delete Permanently', 'visual-form-builder' ) );
|
72 |
}
|
73 |
|
74 |
return sprintf( '%1$s %2$s', $item['form'], $this->row_actions( $actions ) );
|
77 |
/**
|
78 |
* Used for checkboxes and bulk editing
|
79 |
*
|
80 |
+
* @param [type] $item [$item description].
|
81 |
+
*
|
82 |
+
* @return [type] [return description]
|
83 |
*/
|
84 |
+
public function column_cb( $item ) {
|
85 |
return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['entry_id'] );
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
* Builds the actual columns
|
90 |
*
|
91 |
+
* @return [type] [return description]
|
92 |
*/
|
93 |
+
public function get_columns() {
|
94 |
$columns = array(
|
95 |
+
'cb' => '<input type="checkbox" />',
|
96 |
+
'form' => __( 'Form', 'visual-form-builder' ),
|
97 |
+
'subject' => __( 'Email Subject', 'visual-form-builder' ),
|
98 |
+
'sender_name' => __( 'Sender Name', 'visual-form-builder' ),
|
99 |
+
'sender_email' => __( 'Sender Email', 'visual-form-builder' ),
|
100 |
+
'emails_to' => __( 'Emailed To', 'visual-form-builder' ),
|
101 |
+
'ip_address' => __( 'IP Address', 'visual-form-builder' ),
|
102 |
+
'date' => __( 'Date Submitted', 'visual-form-builder' ),
|
103 |
+
'entry_id' => __( 'Entry ID', 'visual-form-builder' ),
|
104 |
);
|
105 |
|
106 |
return $columns;
|
109 |
/**
|
110 |
* A custom function to get the entries and sort them
|
111 |
*
|
112 |
+
* @param [type] $orderby [$orderby description].
|
113 |
+
* @param date $order [$order description].
|
114 |
+
* @param ASC $per_page [$per_page description].
|
115 |
+
* @param [type] $offset [$offset description].
|
116 |
+
* @param [type] $search [$search description].
|
117 |
+
*
|
118 |
+
* @return [type] [return description]
|
119 |
*/
|
120 |
+
public function get_entries( $orderby = 'date', $order = 'ASC', $per_page, $offset = 0, $search = '' ) {
|
121 |
global $wpdb;
|
122 |
|
123 |
+
// Set OFFSET for pagination.
|
124 |
$offset = ( $offset > 0 ) ? "OFFSET $offset" : '';
|
125 |
|
126 |
+
switch ( $orderby ) {
|
127 |
case 'date':
|
128 |
$order_col = 'date_submitted';
|
129 |
break;
|
139 |
$order_col = $orderby;
|
140 |
break;
|
141 |
|
142 |
+
case 'entry_id':
|
143 |
$order_col = 'entries_id';
|
144 |
break;
|
145 |
}
|
146 |
|
147 |
$where = '';
|
148 |
|
149 |
+
// If the form filter dropdown is used.
|
150 |
+
if ( $this->current_filter_action() ) {
|
151 |
$where .= $wpdb->prepare( 'AND forms.form_id = %d', $this->current_filter_action() );
|
152 |
+
}
|
153 |
|
154 |
+
// Get the month and year from the dropdown.
|
155 |
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
156 |
|
157 |
+
// If a month/year has been selected, parse out the month/year and build the clause.
|
158 |
if ( $m > 0 ) {
|
159 |
+
$year = substr( $m, 0, 4 );
|
160 |
+
$month = substr( $m, -2 );
|
161 |
|
162 |
+
$where .= $wpdb->prepare( ' AND YEAR(date_submitted) = %d AND MONTH(date_submitted) = %d', $year, $month );
|
163 |
}
|
164 |
|
165 |
+
// Get the month/year from the dropdown.
|
166 |
$today = isset( $_GET['today'] ) ? (int) $_GET['today'] : 0;
|
167 |
|
168 |
+
// Parse month/year and build the clause.
|
169 |
+
if ( $today > 0 ) {
|
170 |
+
$where .= ' AND entries.date_submitted >= curdate()';
|
171 |
+
}
|
172 |
|
173 |
+
// Entries type filter.
|
174 |
$where .= ( $this->get_entry_status() && 'all' !== $this->get_entry_status() ) ? $wpdb->prepare( ' AND entries.entry_approved = %s', $this->get_entry_status() ) : '';
|
175 |
|
176 |
+
// Always display approved entries, unless an Entries Type filter is set.
|
177 |
+
if ( ! $this->get_entry_status() || 'all' === $this->get_entry_status() ) {
|
178 |
$where .= $wpdb->prepare( ' AND entries.entry_approved = %d', 1 );
|
179 |
+
}
|
180 |
|
181 |
$sql_order = sanitize_sql_orderby( "$order_col $order" );
|
182 |
+
$cols = $wpdb->get_results( 'SELECT forms.form_title, entries.entries_id, entries.form_id, entries.subject, entries.sender_name, entries.sender_email, entries.emails_to, entries.date_submitted, entries.ip_address FROM ' . VFB_WP_FORMS_TABLE_NAME . ' AS forms INNER JOIN ' . VFB_WP_ENTRIES_TABLE_NAME . " AS entries ON entries.form_id = forms.form_id WHERE 1=1 $where $search ORDER BY $sql_order LIMIT $per_page $offset" );
|
183 |
|
184 |
return $cols;
|
185 |
}
|
187 |
/**
|
188 |
* Get the entry status: All, Spam, or Trash
|
189 |
*
|
190 |
+
* @since 2.1
|
191 |
* @returns string Entry status
|
192 |
*/
|
193 |
+
public function get_entry_status() {
|
194 |
+
if ( ! isset( $_GET['entry_status'] ) ) {
|
195 |
return false;
|
196 |
+
}
|
197 |
|
198 |
+
return esc_html( sanitize_text_field( wp_unslash( $_GET['entry_status'] ) ) );
|
199 |
}
|
200 |
|
201 |
/**
|
202 |
* Build the different views for the entries screen
|
203 |
*
|
204 |
+
* @return [type] [return description]
|
|
|
205 |
*/
|
206 |
+
public function get_views() {
|
207 |
$status_links = array();
|
208 |
+
$num_entries = $this->get_entries_count();
|
209 |
+
$class = '';
|
210 |
+
$link = '?page=vfb-entries';
|
211 |
|
212 |
$stati = array(
|
213 |
+
'all' => _n_noop( 'All <span class="count">(<span class="pending-count">%s</span>)</span>', 'All <span class="count">(<span class="pending-count">%s</span>)</span>' ),
|
214 |
+
'trash' => _n_noop( 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>' ),
|
215 |
);
|
216 |
|
217 |
$total_entries = (int) $num_entries->all;
|
218 |
+
$entry_status = isset( $_GET['entry_status'] ) ? esc_html( sanitize_text_field( wp_unslash( $_GET['entry_status'] ) ) ) : 'all';
|
219 |
|
220 |
foreach ( $stati as $status => $label ) {
|
221 |
+
$class = ( $status === $entry_status ) ? ' class="current"' : '';
|
222 |
|
223 |
+
if ( ! isset( $num_entries->$status ) ) {
|
224 |
$num_entries->$status = 10;
|
225 |
+
}
|
226 |
|
227 |
$link = add_query_arg( 'entry_status', $status, $link );
|
228 |
|
238 |
/**
|
239 |
* Get the number of entries for use with entry statuses
|
240 |
*
|
241 |
+
* @return [type] [return description]
|
|
|
242 |
*/
|
243 |
+
public function get_entries_count() {
|
244 |
global $wpdb;
|
245 |
|
246 |
$stats = array();
|
247 |
|
248 |
+
$entries = $wpdb->get_results( 'SELECT entries.entry_approved, COUNT( * ) AS num_entries FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' AS entries WHERE 1=1 GROUP BY entries.entry_approved', ARRAY_A );
|
249 |
|
250 |
+
$total = 0;
|
251 |
+
$approved = array(
|
252 |
+
'0' => 'moderated',
|
253 |
+
'1' => 'approved',
|
254 |
+
'spam' => 'spam',
|
255 |
+
'trash' => 'trash',
|
256 |
+
'post-trashed' => 'post-trashed',
|
257 |
+
);
|
258 |
foreach ( (array) $entries as $row ) {
|
259 |
+
// Don't count trashed toward totals.
|
260 |
+
if ( 'trash' !== $row['entry_approved'] ) {
|
261 |
$total += $row['num_entries'];
|
262 |
+
}
|
263 |
+
if ( isset( $approved[ $row['entry_approved'] ] ) ) {
|
264 |
+
$stats[ $approved[ $row['entry_approved'] ] ] = $row['num_entries'];
|
265 |
+
}
|
266 |
}
|
267 |
|
268 |
$stats['all'] = $total;
|
269 |
foreach ( $approved as $key ) {
|
270 |
+
if ( empty( $stats[ $key ] ) ) {
|
271 |
$stats[ $key ] = 0;
|
272 |
+
}
|
273 |
}
|
274 |
|
275 |
$stats = (object) $stats;
|
280 |
/**
|
281 |
* Setup which columns are sortable. Default is by Date.
|
282 |
*
|
283 |
+
* @return [type] [return description]
|
|
|
284 |
*/
|
285 |
+
public function get_sortable_columns() {
|
286 |
$sortable_columns = array(
|
287 |
+
'form' => array( 'form', false ),
|
288 |
+
'subject' => array( 'subject', false ),
|
289 |
+
'sender_name' => array( 'sender_name', false ),
|
290 |
+
'sender_email' => array( 'sender_email', false ),
|
291 |
+
'date' => array( 'date', true ),
|
292 |
+
'entry_id' => array( 'entry_id', true ),
|
293 |
);
|
294 |
|
295 |
return $sortable_columns;
|
298 |
/**
|
299 |
* Define our bulk actions
|
300 |
*
|
301 |
+
* @return [type] [return description]
|
|
|
302 |
*/
|
303 |
+
public function get_bulk_actions() {
|
304 |
+
if ( ! $this->get_entry_status() || 'all' === $this->get_entry_status() ) {
|
|
|
305 |
$actions['trash'] = __( 'Move to Trash', 'visual-form-builder' );
|
306 |
+
} elseif ( $this->get_entry_status() && 'trash' === $this->get_entry_status() ) {
|
307 |
$actions['restore'] = __( 'Restore', 'visual-form-builder' );
|
308 |
+
$actions['delete'] = __( 'Delete Permanently', 'visual-form-builder' );
|
309 |
}
|
310 |
|
311 |
return $actions;
|
314 |
/**
|
315 |
* Process our bulk actions
|
316 |
*
|
317 |
+
* @return void
|
318 |
*/
|
319 |
+
public function process_bulk_action() {
|
320 |
global $wpdb;
|
321 |
|
322 |
$entry_id = '';
|
323 |
|
324 |
+
if ( isset( $_POST['entry'] ) ) {
|
325 |
+
if ( is_array( $_POST['entry'] ) ) {
|
326 |
+
$entry_id = array_map( 'sanitize_text_field', wp_unslash( $_POST['entry'] ) );
|
327 |
+
} else {
|
328 |
+
$entry_id = array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['entry'] ) );
|
329 |
+
}
|
330 |
}
|
331 |
|
332 |
+
switch ( $this->current_action() ) {
|
333 |
+
case 'trash':
|
334 |
+
check_admin_referer( 'bulk-entries' );
|
335 |
|
336 |
foreach ( $entry_id as $id ) {
|
337 |
$id = absint( $id );
|
338 |
$wpdb->update( VFB_WP_ENTRIES_TABLE_NAME, array( 'entry_approved' => 'trash' ), array( 'entries_id' => $id ) );
|
339 |
}
|
340 |
+
break;
|
341 |
|
342 |
+
case 'restore':
|
343 |
+
check_admin_referer( 'bulk-entries' );
|
344 |
|
345 |
foreach ( $entry_id as $id ) {
|
346 |
$id = absint( $id );
|
347 |
+
$wpdb->update( VFB_WP_ENTRIES_TABLE_NAME, array( 'entry_approved' => 1 ), array( 'entries_id' => $id ) );
|
348 |
}
|
349 |
+
break;
|
350 |
|
351 |
+
case 'delete':
|
352 |
+
check_admin_referer( 'bulk-entries' );
|
353 |
|
354 |
foreach ( $entry_id as $id ) {
|
355 |
$id = absint( $id );
|
356 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' WHERE entries_id = %d', $id ) );
|
357 |
}
|
358 |
+
break;
|
359 |
+
}
|
360 |
+
}
|
361 |
|
362 |
+
/**
|
363 |
+
* Process action row links below form title
|
364 |
+
*
|
365 |
+
* This is different than bulk action processing
|
366 |
+
*
|
367 |
+
* @return [type] [return description]
|
368 |
+
*/
|
369 |
+
public function process_row_action_links() {
|
370 |
+
global $wpdb;
|
371 |
|
372 |
+
if ( ! isset( $_GET['vfb-action'] ) ) {
|
373 |
+
return;
|
374 |
+
}
|
375 |
|
376 |
+
if ( ! isset( $_GET['entry'] ) ) {
|
377 |
+
return;
|
378 |
+
}
|
379 |
|
380 |
+
$action = sanitize_text_field( wp_unslash( $_GET['vfb-action'] ) );
|
381 |
+
$entry_id = absint( $_GET['entry'] );
|
382 |
+
|
383 |
+
switch ( $action ) {
|
384 |
+
case 'trash':
|
385 |
+
check_admin_referer( 'vfb_trash_entry' );
|
386 |
+
$wpdb->update( VFB_WP_ENTRIES_TABLE_NAME, array( 'entry_approved' => 'trash' ), array( 'entries_id' => $entry_id ) );
|
387 |
+
|
388 |
+
break;
|
389 |
+
|
390 |
+
case 'restore':
|
391 |
+
check_admin_referer( 'vfb_undo_trash_entry' );
|
392 |
+
|
393 |
+
$wpdb->update( VFB_WP_ENTRIES_TABLE_NAME, array( 'entry_approved' => 1 ), array( 'entries_id' => $entry_id ) );
|
394 |
+
break;
|
395 |
+
|
396 |
+
case 'delete':
|
397 |
+
check_admin_referer( 'vfb_delete_entry' );
|
398 |
+
|
399 |
+
$wpdb->delete( VFB_WP_ENTRIES_TABLE_NAME, array( 'entries_id' => $entry_id ) );
|
400 |
+
break;
|
401 |
+
}
|
402 |
}
|
403 |
|
404 |
/**
|
405 |
* Adds our forms filter dropdown
|
406 |
*
|
407 |
+
* @param [type] $which [$which description].
|
408 |
+
*
|
409 |
+
* @return void
|
410 |
*/
|
411 |
+
public function extra_tablenav( $which ) {
|
412 |
global $wpdb;
|
413 |
|
414 |
+
$cols = $wpdb->get_results( 'SELECT DISTINCT forms.form_title, forms.form_id FROM ' . VFB_WP_FORMS_TABLE_NAME . ' AS forms ORDER BY forms.form_id ASC' );
|
415 |
|
416 |
+
// Only display the dropdown on the top of the table.
|
417 |
+
if ( 'top' === $which ) {
|
418 |
echo '<div class="alignleft actions">';
|
419 |
+
$this->months_dropdown();
|
420 |
echo '<select id="form-filter" name="form-filter">
|
421 |
+
<option value="-1"' . selected( $this->current_filter_action(), -1 ) . '>' . esc_html__( 'View all forms', 'visual-form-builder' ) . '</option>';
|
422 |
|
423 |
foreach ( $cols as $form ) {
|
424 |
+
printf(
|
425 |
+
'<option value="%1$d"%2$s>%1$d - %3$s</option>',
|
426 |
+
esc_html( $form->form_id ),
|
427 |
+
selected( $this->current_filter_action(), esc_html( $form->form_id ) ),
|
428 |
+
esc_html( $form->form_title )
|
429 |
);
|
430 |
}
|
431 |
|
432 |
echo '</select>
|
433 |
+
<input type="submit" value="' . esc_html__( 'Filter', 'visual-form-builder' ) . '" class="button-secondary" />
|
434 |
+
</div>';
|
435 |
}
|
436 |
}
|
437 |
|
438 |
/**
|
439 |
* Display Year/Month filter
|
440 |
*
|
441 |
+
* @param [type] $post_type [$post_type description].
|
442 |
+
*
|
443 |
+
* @return [type] [return description]
|
444 |
*/
|
445 |
+
public function months_dropdown( $post_type = '' ) {
|
446 |
global $wpdb, $wp_locale;
|
447 |
|
448 |
+
$months = $wpdb->get_results(
|
449 |
+
'
|
450 |
+
SELECT DISTINCT YEAR( forms.date_submitted ) AS year, MONTH( forms.date_submitted ) AS month
|
451 |
+
FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' AS forms
|
452 |
+
ORDER BY forms.date_submitted DESC
|
453 |
+
'
|
454 |
+
);
|
455 |
|
456 |
$month_count = count( $months );
|
457 |
|
458 |
+
if ( ! $month_count || ( 1 === $month_count && 0 === $months[0]->month ) ) {
|
459 |
return;
|
460 |
+
}
|
461 |
|
462 |
+
$m = isset( $_POST['m'] ) ? (int) sanitize_text_field( wp_unslash( $_POST['m'] ) ) : 0;
|
463 |
+
?>
|
464 |
+
<select name='m'>
|
465 |
+
<option<?php selected( $m, 0 ); ?> value='0'><?php esc_html_e( 'Show all dates' ); ?></option>
|
466 |
+
<?php
|
467 |
foreach ( $months as $arc_row ) {
|
468 |
+
if ( 0 == $arc_row->year ) {
|
469 |
continue;
|
470 |
+
}
|
471 |
|
472 |
$month = zeroise( $arc_row->month, 2 );
|
473 |
+
$year = $arc_row->year;
|
474 |
|
475 |
+
printf(
|
476 |
+
"<option %s value='%s'>%s</option>\n",
|
477 |
+
selected( esc_html( $m ), $year . $month, false ),
|
478 |
esc_attr( $arc_row->year . $month ),
|
479 |
+
sprintf( esc_html__( '%1$s %2$d' ), esc_html( $wp_locale->get_month( $month ) ), esc_html( $year ) )
|
480 |
);
|
481 |
}
|
482 |
+
?>
|
483 |
+
</select>
|
484 |
+
<?php
|
485 |
}
|
486 |
|
487 |
/**
|
488 |
* Set our forms filter action
|
489 |
*
|
490 |
+
* @return [type] [return description]
|
|
|
491 |
*/
|
492 |
+
public function current_filter_action() {
|
493 |
+
if ( isset( $_POST['form-filter'] ) && -1 !== $_POST['form-filter'] ) {
|
494 |
return absint( $_POST['form-filter'] );
|
495 |
+
}
|
496 |
|
497 |
return false;
|
498 |
}
|
499 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
500 |
/**
|
501 |
* Prepares our data for display
|
502 |
*
|
503 |
* @since 1.2
|
504 |
*/
|
505 |
+
public function prepare_items() {
|
506 |
global $wpdb;
|
507 |
|
508 |
+
// get the current user ID.
|
509 |
$user = get_current_user_id();
|
510 |
|
511 |
+
// get the current admin screen.
|
512 |
$screen = get_current_screen();
|
513 |
|
514 |
+
// retrieve the "per_page" option.
|
515 |
$screen_option = $screen->get_option( 'per_page', 'option' );
|
516 |
|
517 |
+
// retrieve the value of the option stored for the current user.
|
518 |
$per_page = get_user_meta( $user, $screen_option, true );
|
519 |
|
520 |
+
// get the default value if none is set.
|
521 |
+
if ( empty( $per_page ) || $per_page < 1 ) {
|
522 |
$per_page = 20;
|
523 |
+
}
|
524 |
|
525 |
+
// Get the date/time format that is saved in the options table.
|
526 |
$date_format = get_option( 'date_format' );
|
527 |
$time_format = get_option( 'time_format' );
|
528 |
|
529 |
// What page are we looking at?
|
530 |
$current_page = $this->get_pagenum();
|
531 |
|
532 |
+
// Use offset for pagination.
|
533 |
$offset = ( $current_page - 1 ) * $per_page;
|
534 |
|
535 |
+
// Get column headers.
|
536 |
$columns = $this->get_columns();
|
537 |
+
$hidden = get_hidden_columns( $this->screen );
|
538 |
|
539 |
+
// Get sortable columns.
|
540 |
$sortable = $this->get_sortable_columns();
|
541 |
|
542 |
+
// Build the column headers.
|
543 |
+
$this->_column_headers = array( $columns, $hidden, $sortable );
|
544 |
|
545 |
+
// Get entries search terms.
|
546 |
+
$search_terms = ( ! empty( $_POST['s'] ) ) ? explode( ' ', sanitize_text_field( wp_unslash( $_POST['s'] ) ) ) : array();
|
547 |
|
548 |
$searchand = $search = '';
|
549 |
+
// Loop through search terms and build query.
|
550 |
+
foreach ( $search_terms as $term ) {
|
551 |
$term = esc_sql( $wpdb->esc_like( $term ) );
|
552 |
|
553 |
+
$search .= "{$searchand}((entries.subject LIKE '%{$term}%') OR (entries.sender_name LIKE '%{$term}%') OR (entries.sender_email LIKE '%{$term}%') OR (entries.emails_to LIKE '%{$term}%') OR (entries.data LIKE '%{$term}%'))";
|
554 |
$searchand = ' AND ';
|
555 |
}
|
556 |
|
557 |
+
$search = ( ! empty( $search ) ) ? " AND ({$search}) " : '';
|
558 |
|
559 |
+
// Set our ORDER BY and ASC/DESC to sort the entries.
|
560 |
+
$orderby = ( ! empty( $_GET['orderby'] ) ) ? sanitize_text_field( wp_unslash( $_GET['orderby'] ) ) : 'date';
|
561 |
+
$order = ( ! empty( $_GET['order'] ) ) ? sanitize_text_field( wp_unslash( $_GET['order'] ) ) : 'desc';
|
562 |
|
563 |
+
// Get the sorted entries.
|
564 |
$entries = $this->get_entries( $orderby, $order, $per_page, $offset, $search );
|
565 |
|
566 |
$data = array();
|
567 |
|
568 |
+
// Loop trough the entries and setup the data to be displayed for each row.
|
569 |
foreach ( $entries as $entry ) {
|
570 |
$data[] =
|
571 |
+
array(
|
572 |
+
'entry_id' => $entry->entries_id,
|
573 |
+
'id' => $entry->entries_id,
|
574 |
+
'form' => wp_unslash( $entry->form_title ),
|
575 |
+
'subject' => wp_unslash( $entry->subject ),
|
576 |
+
'sender_name' => wp_unslash( $entry->sender_name ),
|
577 |
+
'sender_email' => wp_unslash( $entry->sender_email ),
|
578 |
+
'emails_to' => implode( ',', unserialize( wp_unslash( $entry->emails_to ) ) ),
|
579 |
+
'date' => gmdate( "$date_format $time_format", strtotime( $entry->date_submitted ) ),
|
580 |
+
'ip_address' => $entry->ip_address,
|
581 |
);
|
582 |
}
|
583 |
|
584 |
$where = '';
|
585 |
|
586 |
+
// If the form filter dropdown is used.
|
587 |
+
if ( $this->current_filter_action() ) {
|
588 |
$where .= 'AND form_id = ' . $this->current_filter_action();
|
589 |
+
}
|
590 |
|
591 |
+
// Get the month/year from the dropdown.
|
592 |
+
$m = isset( $_POST['m'] ) ? (int) sanitize_text_field( wp_unslash( $_POST['m'] ) ) : 0;
|
593 |
|
594 |
+
// Parse month/year and build the clause.
|
595 |
if ( $m > 0 ) {
|
596 |
+
$year = substr( $m, 0, 4 );
|
597 |
$month = substr( $m, -2 );
|
598 |
|
599 |
$where .= " AND YEAR(date_submitted) = $year AND MONTH(date_submitted) = $month";
|
600 |
}
|
601 |
|
602 |
+
// Get the month/year from the dropdown.
|
603 |
$today = isset( $_GET['today'] ) ? (int) $_GET['today'] : 0;
|
604 |
|
605 |
+
// Parse month/year and build the clause.
|
606 |
+
if ( $today > 0 ) {
|
607 |
+
$where .= ' AND entries.date_submitted >= curdate()';
|
608 |
+
}
|
609 |
|
610 |
+
// Entry type filter.
|
611 |
$where .= ( $this->get_entry_status() && 'all' !== $this->get_entry_status() ) ? $wpdb->prepare( ' AND entries.entry_approved = %s', $this->get_entry_status() ) : '';
|
612 |
|
613 |
+
// Always display approved entries, unless an Entries Type filter is set.
|
614 |
+
if ( ! $this->get_entry_status() || 'all' === $this->get_entry_status() ) {
|
615 |
$where .= $wpdb->prepare( ' AND entries.entry_approved = %d', 1 );
|
616 |
+
}
|
617 |
|
618 |
// How many entries do we have?
|
619 |
+
$total_items = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . VFB_WP_ENTRIES_TABLE_NAME . " AS entries WHERE 1=1 $where" );
|
620 |
|
621 |
+
// Add sorted data to the items property.
|
622 |
$this->items = $data;
|
623 |
|
624 |
+
// Register our pagination.
|
625 |
+
$this->set_pagination_args(
|
626 |
+
array(
|
627 |
+
'total_items' => $total_items,
|
628 |
+
'per_page' => $per_page,
|
629 |
+
'total_pages' => ceil( $total_items / $per_page ),
|
630 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
631 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
}
|
633 |
}
|
admin/class-export.php
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that controls the Export page view
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Export {
|
7 |
-
|
8 |
/**
|
9 |
* Default delimiter for CSV and Tab export
|
10 |
*
|
@@ -12,15 +11,15 @@ class Visual_Form_Builder_Export {
|
|
12 |
*
|
13 |
* (default value: ',')
|
14 |
*
|
15 |
-
* @var
|
16 |
* @access protected
|
17 |
*/
|
18 |
protected $delimiter = ',';
|
19 |
|
20 |
/**
|
21 |
-
*
|
22 |
*
|
23 |
-
* @var
|
24 |
* @access public
|
25 |
*/
|
26 |
public $default_cols;
|
@@ -29,22 +28,20 @@ class Visual_Form_Builder_Export {
|
|
29 |
* __construct function
|
30 |
*
|
31 |
* @access public
|
32 |
-
* @param mixed $id
|
33 |
* @return void
|
34 |
*/
|
35 |
public function __construct() {
|
36 |
-
// CSV delimiter
|
37 |
$this->delimiter = apply_filters( 'vfb_csv_delimiter', ',' );
|
38 |
|
39 |
-
// Setup our default columns
|
40 |
$this->default_cols = array(
|
41 |
-
'entries_id'
|
42 |
-
'date_submitted' =>
|
43 |
-
'ip_address'
|
44 |
-
'subject'
|
45 |
-
'sender_name'
|
46 |
-
'sender_email'
|
47 |
-
'emails_to'
|
48 |
);
|
49 |
|
50 |
add_action( 'admin_init', array( $this, 'export_action' ) );
|
@@ -52,7 +49,7 @@ class Visual_Form_Builder_Export {
|
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
-
*
|
56 |
*
|
57 |
* @access public
|
58 |
* @return void
|
@@ -61,93 +58,91 @@ class Visual_Form_Builder_Export {
|
|
61 |
$forms = $this->get_all_forms();
|
62 |
?>
|
63 |
<div class="wrap">
|
64 |
-
<h2><?php
|
65 |
<form method="post" id="vfbp-export" action="">
|
66 |
<input name="_vfb_action" type="hidden" value="export" />
|
67 |
-
<?php
|
68 |
-
wp_nonce_field( 'vfb_export' );
|
69 |
-
?>
|
70 |
|
71 |
-
<p><?php
|
72 |
-
<p><?php
|
73 |
-
<h3><?php
|
74 |
|
75 |
<p>
|
76 |
<label for="content-forms">
|
77 |
-
<input type="radio" id="content-forms" name="settings[content]" value="forms" disabled="disabled" /> <?php
|
78 |
</label>
|
79 |
</p>
|
80 |
-
<p class="description"><?php
|
81 |
|
82 |
<p>
|
83 |
<label for="content-entries">
|
84 |
-
<input type="radio" id="content-entries" name="settings[content]" value="entries" checked="checked" /> <?php
|
85 |
</label>
|
86 |
</p>
|
87 |
-
<p class="description"><?php
|
88 |
|
89 |
-
<h3><?php
|
90 |
-
|
91 |
<?php
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
}
|
105 |
}
|
|
|
106 |
?>
|
107 |
-
|
108 |
-
|
109 |
<div class="vfb-export-entries-options">
|
110 |
-
<h3><?php
|
111 |
|
112 |
<p>
|
113 |
-
<label class="vfb-export-label" for="format"><?php
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
|
121 |
<p>
|
122 |
-
<label class="vfb-export-label" for="start-date"><?php
|
123 |
<select name="settings[start-date]">
|
124 |
<option value="0">Start Date</option>
|
125 |
<?php $this->months_dropdown(); ?>
|
126 |
</select>
|
127 |
<select name="settings[end-date]">
|
128 |
-
|
129 |
-
|
130 |
</select>
|
131 |
</p>
|
132 |
|
133 |
-
<label class="vfb-export-label"><?php
|
134 |
|
135 |
<p>
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
|
140 |
<div id="vfb-export-entries-fields">
|
141 |
-
|
142 |
-
|
143 |
</div>
|
144 |
|
145 |
<?php
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
?>
|
152 |
</form>
|
153 |
</div>
|
@@ -161,19 +156,22 @@ class Visual_Form_Builder_Export {
|
|
161 |
* @return void
|
162 |
*/
|
163 |
public function export_action() {
|
164 |
-
|
165 |
-
if ( !isset( $_POST['_vfb_action'] ) || !isset( $_GET['page'] ) )
|
166 |
return;
|
|
|
167 |
|
168 |
-
if ( 'export' !== $_POST['_vfb_action'] )
|
169 |
return;
|
|
|
170 |
|
171 |
check_admin_referer( 'vfb_export' );
|
172 |
|
173 |
$data = array();
|
174 |
|
175 |
-
|
176 |
-
$
|
|
|
|
|
177 |
}
|
178 |
|
179 |
$data = stripslashes_deep( $data );
|
@@ -184,27 +182,32 @@ class Visual_Form_Builder_Export {
|
|
184 |
$end_date = isset( $data['end-date'] ) ? sanitize_text_field( $data['end-date'] ) : '';
|
185 |
$fields = isset( $data['fields'] ) ? $data['fields'] : '';
|
186 |
|
187 |
-
if ( 0 == $form_id )
|
188 |
return;
|
|
|
189 |
|
190 |
switch ( $content ) {
|
191 |
-
case 'entries'
|
192 |
-
// If no fields selected, exit because there's nothing to do
|
193 |
-
if ( empty( $fields ) )
|
194 |
return;
|
|
|
195 |
|
196 |
global $wpdb;
|
197 |
$where = '';
|
198 |
|
199 |
-
if ( 0 !== $form_id )
|
200 |
-
$where .= $wpdb->prepare(
|
|
|
201 |
|
202 |
-
if ( $start_date )
|
203 |
-
$where .= $wpdb->prepare(
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
-
if ( $end_date )
|
206 |
-
$where .= $wpdb->prepare( " AND date_submitted < %s", date( 'Y-m-d', strtotime( '+1 month', strtotime( $end_date ) ) ) );
|
207 |
-
|
208 |
$title = $wpdb->get_var( null, 1 );
|
209 |
|
210 |
$settings['format'] = $format;
|
@@ -213,33 +216,36 @@ class Visual_Form_Builder_Export {
|
|
213 |
|
214 |
$this->export_entries( $settings, $title );
|
215 |
|
216 |
-
die(1);
|
217 |
|
218 |
-
|
219 |
}
|
220 |
}
|
221 |
|
222 |
/**
|
223 |
* [export_entries description]
|
224 |
*
|
225 |
-
* @param
|
226 |
-
* @param
|
227 |
*
|
228 |
-
* @return
|
229 |
*/
|
230 |
public function export_entries( $data = array(), $title = '' ) {
|
231 |
-
if ( !is_array( $data ) || empty( $data ) )
|
232 |
return;
|
|
|
233 |
|
234 |
$format = $data['format'];
|
235 |
|
236 |
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
237 |
-
if ( ! empty($sitename) )
|
238 |
-
|
|
|
|
|
239 |
|
240 |
-
// Set content type based on file format
|
241 |
switch ( $format ) {
|
242 |
-
case 'csv'
|
243 |
$content_type = 'text/csv';
|
244 |
break;
|
245 |
}
|
@@ -254,68 +260,69 @@ class Visual_Form_Builder_Export {
|
|
254 |
header( 'Expires: 0' );
|
255 |
header( 'Pragma: public' );
|
256 |
|
257 |
-
if ( in_array( $format, array( 'csv', 'txt' ) ) )
|
258 |
$this->csv_tab( $data['fields'], $data['where'], $format, $file_path );
|
|
|
259 |
}
|
260 |
|
261 |
/**
|
262 |
* [csv_tab description]
|
263 |
*
|
264 |
-
* @param
|
265 |
-
* @param
|
266 |
-
* @param
|
267 |
-
* @param
|
268 |
*
|
269 |
-
* @return
|
270 |
*/
|
271 |
public function csv_tab( $fields, $where, $format, $file_path ) {
|
272 |
global $wpdb;
|
273 |
$file = fopen( $file_path, 'w' );
|
274 |
|
275 |
$headers = $rows = array();
|
276 |
-
$entries = $wpdb->get_results(
|
277 |
|
278 |
-
// Get columns
|
279 |
$columns = $this->get_cols( $entries );
|
280 |
|
281 |
-
// Get JSON data
|
282 |
$json = json_decode( $columns, true );
|
283 |
|
284 |
$rows = $fields_clean = $fields_header = array();
|
285 |
|
286 |
-
// Decode special characters
|
287 |
foreach ( $fields as $field ) {
|
288 |
-
// Strip unique ID for a clean header
|
289 |
-
$search
|
290 |
$fields_header[] = wp_specialchars_decode( $search, ENT_QUOTES );
|
291 |
|
292 |
-
// Field with unique ID to use as matching data
|
293 |
$fields_clean[] = wp_specialchars_decode( $field, ENT_QUOTES );
|
294 |
}
|
295 |
|
296 |
-
// Build headers
|
297 |
fputcsv( $file, $fields_header, $this->delimiter );
|
298 |
|
299 |
-
// Build table rows and cells
|
300 |
foreach ( $json as $row ) {
|
301 |
foreach ( $fields_clean as $label ) {
|
302 |
$label = wp_specialchars_decode( $label );
|
303 |
-
// Prepend a space to prevent CSV injection attacks
|
304 |
$value = ' ' . wp_specialchars_decode( $row[ $label ] );
|
305 |
|
306 |
-
$rows[ $label ] =
|
307 |
}
|
308 |
|
309 |
fputcsv( $file, $rows, $this->delimiter );
|
310 |
}
|
311 |
|
312 |
-
// Close the file
|
313 |
fclose( $file );
|
314 |
|
315 |
-
// Reads file in uploads folder and writes to output buffer
|
316 |
readfile( $file_path );
|
317 |
|
318 |
-
// Delete export file
|
319 |
wp_delete_file( $file_path );
|
320 |
|
321 |
exit();
|
@@ -324,26 +331,27 @@ class Visual_Form_Builder_Export {
|
|
324 |
/**
|
325 |
* [fields_list description]
|
326 |
*
|
327 |
-
* @param
|
328 |
*
|
329 |
-
* @return
|
330 |
*/
|
331 |
public function fields_list( $form_id ) {
|
332 |
-
$entries
|
333 |
$entries_count = $this->get_entries_count( $form_id );
|
334 |
|
335 |
-
if ( 0 == $entries_count )
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
339 |
$columns = $this->get_cols( $entries );
|
340 |
-
$data
|
341 |
|
342 |
$output = '';
|
343 |
|
344 |
$array = array();
|
345 |
foreach ( $data as $row ) {
|
346 |
-
|
347 |
}
|
348 |
|
349 |
$array = array_keys( $array );
|
@@ -353,20 +361,19 @@ class Visual_Form_Builder_Export {
|
|
353 |
foreach ( $array as $id => $value ) {
|
354 |
$selected = in_array( $value, $this->default_cols ) ? ' checked="checked"' : '';
|
355 |
|
356 |
-
// Strip unique ID for a clean list
|
357 |
$search = preg_replace( '/{{(\d+)}}/', '', $value );
|
358 |
-
|
359 |
?>
|
360 |
-
<label for="vfb-export-fields-val-<?php echo $id; ?>">
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
</label><br>
|
371 |
<?php
|
372 |
}
|
@@ -378,14 +385,14 @@ class Visual_Form_Builder_Export {
|
|
378 |
/**
|
379 |
* [get_entries description]
|
380 |
*
|
381 |
-
* @param
|
382 |
*
|
383 |
-
* @return
|
384 |
*/
|
385 |
public function get_entries( $form_id ) {
|
386 |
global $wpdb;
|
387 |
|
388 |
-
$entries = $wpdb->get_results( $wpdb->prepare(
|
389 |
return $entries;
|
390 |
}
|
391 |
|
@@ -394,15 +401,14 @@ class Visual_Form_Builder_Export {
|
|
394 |
*
|
395 |
* @since 1.7
|
396 |
*
|
397 |
-
* @param array $entries The resulting database query for entries
|
398 |
*/
|
399 |
public function get_cols( $entries ) {
|
400 |
-
|
401 |
-
|
402 |
-
$row = 0;
|
403 |
$output = array();
|
404 |
|
405 |
-
// Loop through all entries
|
406 |
foreach ( $entries as $entry ) {
|
407 |
foreach ( $entry as $key => $value ) {
|
408 |
switch ( $key ) {
|
@@ -413,66 +419,61 @@ class Visual_Form_Builder_Export {
|
|
413 |
case 'sender_name':
|
414 |
case 'sender_email':
|
415 |
$output[ $row ][ stripslashes( $this->default_cols[ $key ] ) ] = $value;
|
416 |
-
|
417 |
|
418 |
case 'emails_to':
|
419 |
$output[ $row ][ stripslashes( $this->default_cols[ $key ] ) ] = implode( ',', maybe_unserialize( $value ) );
|
420 |
-
|
421 |
|
422 |
case 'data':
|
423 |
-
// Unserialize value only if it was serialized
|
424 |
$fields = maybe_unserialize( $value );
|
425 |
|
426 |
-
// Make sure there are no errors with unserializing before proceeding
|
427 |
if ( is_array( $fields ) ) {
|
428 |
-
// Loop through our submitted data
|
429 |
foreach ( $fields as $field_key => $field_value ) {
|
430 |
-
// Cast each array as an object
|
431 |
$obj = (object) $field_value;
|
432 |
|
433 |
-
// Decode the values so HTML tags can be stripped
|
434 |
$val = wp_specialchars_decode( $obj->value, ENT_QUOTES );
|
435 |
|
436 |
switch ( $obj->type ) {
|
437 |
-
case 'fieldset'
|
438 |
-
case 'section'
|
439 |
-
case 'instructions'
|
440 |
-
case 'page-break'
|
441 |
-
case 'verification'
|
442 |
-
case 'secret'
|
443 |
-
case 'submit'
|
444 |
break;
|
445 |
|
446 |
-
case 'address'
|
447 |
-
|
448 |
$val = str_replace( array( '<p>', '</p>', '<br>' ), array( '', "\n", "\n" ), $val );
|
449 |
|
450 |
-
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] =
|
451 |
-
|
452 |
break;
|
453 |
|
454 |
-
case 'html'
|
455 |
-
|
456 |
-
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] = $val;
|
457 |
-
|
458 |
break;
|
459 |
|
460 |
-
default
|
461 |
-
|
462 |
$val = wp_strip_all_tags( $val );
|
463 |
-
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] =
|
464 |
-
|
465 |
break;
|
466 |
}
|
467 |
}
|
468 |
}
|
469 |
-
|
470 |
}
|
471 |
}
|
|
|
472 |
$row++;
|
473 |
}
|
474 |
|
475 |
-
return
|
476 |
}
|
477 |
|
478 |
/**
|
@@ -484,17 +485,18 @@ class Visual_Form_Builder_Export {
|
|
484 |
public function load_fields() {
|
485 |
global $wpdb;
|
486 |
|
487 |
-
// Check AJAX nonce set via wp_localize_script
|
488 |
check_ajax_referer( 'vfb_ajax', 'vfb_ajax_nonce' );
|
489 |
|
490 |
-
if ( isset( $_GET['action'] ) && 'vfb-export-fields' !== $_GET['action'] )
|
491 |
return;
|
|
|
492 |
|
493 |
$form_id = absint( $_GET['id'] );
|
494 |
|
495 |
$this->fields_list( $form_id );
|
496 |
|
497 |
-
die(1);
|
498 |
}
|
499 |
|
500 |
/**
|
@@ -508,44 +510,50 @@ class Visual_Form_Builder_Export {
|
|
508 |
$where = apply_filters( 'vfb_pre_get_entries', '' );
|
509 |
|
510 |
$months = $wpdb->get_results(
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
|
|
515 |
|
516 |
$month_count = count( $months );
|
517 |
|
518 |
-
if (
|
519 |
return;
|
|
|
520 |
|
521 |
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
522 |
|
523 |
foreach ( $months as $arc_row ) {
|
524 |
-
if ( 0 == $arc_row->year )
|
525 |
continue;
|
|
|
526 |
|
527 |
$month = zeroise( $arc_row->month, 2 );
|
528 |
-
$year
|
529 |
|
530 |
-
printf(
|
|
|
531 |
esc_attr( $arc_row->year . '-' . $month ),
|
532 |
-
sprintf(
|
533 |
);
|
534 |
}
|
535 |
}
|
536 |
|
537 |
/**
|
538 |
* [count_entries description]
|
539 |
-
*
|
|
|
540 |
* @return [type] [description]
|
541 |
*/
|
542 |
public function get_entries_count( $form_id ) {
|
543 |
global $wpdb;
|
544 |
|
545 |
-
$count = $wpdb->get_var( $wpdb->prepare(
|
546 |
|
547 |
-
if (
|
548 |
-
|
|
|
549 |
|
550 |
return $count;
|
551 |
}
|
@@ -553,15 +561,15 @@ class Visual_Form_Builder_Export {
|
|
553 |
/**
|
554 |
* [get_all_forms description]
|
555 |
*
|
556 |
-
* @return
|
557 |
*/
|
558 |
public function get_all_forms() {
|
559 |
global $wpdb;
|
560 |
|
561 |
-
// Query to get all forms
|
562 |
$order = sanitize_sql_orderby( 'form_id ASC' );
|
563 |
$where = apply_filters( 'vfb_pre_get_forms_export', '' );
|
564 |
-
$forms = $wpdb->get_results(
|
565 |
|
566 |
return $forms;
|
567 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that controls the Export page view
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Export {
|
6 |
+
|
7 |
/**
|
8 |
* Default delimiter for CSV and Tab export
|
9 |
*
|
11 |
*
|
12 |
* (default value: ',')
|
13 |
*
|
14 |
+
* @var string
|
15 |
* @access protected
|
16 |
*/
|
17 |
protected $delimiter = ',';
|
18 |
|
19 |
/**
|
20 |
+
* Default_cols
|
21 |
*
|
22 |
+
* @var mixed
|
23 |
* @access public
|
24 |
*/
|
25 |
public $default_cols;
|
28 |
* __construct function
|
29 |
*
|
30 |
* @access public
|
|
|
31 |
* @return void
|
32 |
*/
|
33 |
public function __construct() {
|
|
|
34 |
$this->delimiter = apply_filters( 'vfb_csv_delimiter', ',' );
|
35 |
|
36 |
+
// Setup our default columns.
|
37 |
$this->default_cols = array(
|
38 |
+
'entries_id' => esc_html__( 'Entries ID', 'visual-form-builder' ),
|
39 |
+
'date_submitted' => esc_html__( 'Date Submitted', 'visual-form-builder' ),
|
40 |
+
'ip_address' => esc_html__( 'IP Address', 'visual-form-builder' ),
|
41 |
+
'subject' => esc_html__( 'Subject', 'visual-form-builder' ),
|
42 |
+
'sender_name' => esc_html__( 'Sender Name', 'visual-form-builder' ),
|
43 |
+
'sender_email' => esc_html__( 'Sender Email', 'visual-form-builder' ),
|
44 |
+
'emails_to' => esc_html__( 'Emailed To', 'visual-form-builder' ),
|
45 |
);
|
46 |
|
47 |
add_action( 'admin_init', array( $this, 'export_action' ) );
|
49 |
}
|
50 |
|
51 |
/**
|
52 |
+
* Display function.
|
53 |
*
|
54 |
* @access public
|
55 |
* @return void
|
58 |
$forms = $this->get_all_forms();
|
59 |
?>
|
60 |
<div class="wrap">
|
61 |
+
<h2><?php esc_html_e( 'Export', 'visual-form-builder' ); ?></h2>
|
62 |
<form method="post" id="vfbp-export" action="">
|
63 |
<input name="_vfb_action" type="hidden" value="export" />
|
64 |
+
<?php wp_nonce_field( 'vfb_export' ); ?>
|
|
|
|
|
65 |
|
66 |
+
<p><?php esc_html_e( 'Backup and save some or all of your Visual Form Builder data.', 'visual-form-builder' ); ?></p>
|
67 |
+
<p><?php esc_html_e( 'Once you have saved the file, you will be able to import Visual Form Builder Pro data from this site into another site.', 'visual-form-builder' ); ?></p>
|
68 |
+
<h3><?php esc_html_e( 'Choose what to export', 'visual-form-builder' ); ?></h3>
|
69 |
|
70 |
<p>
|
71 |
<label for="content-forms">
|
72 |
+
<input type="radio" id="content-forms" name="settings[content]" value="forms" disabled="disabled" /> <?php esc_html_e( 'Forms', 'visual-form-builder' ); ?>
|
73 |
</label>
|
74 |
</p>
|
75 |
+
<p class="description"><?php esc_html_e( 'This will export a single form with all fields and settings for that form.', 'visual-form-builder' ); ?><br><strong>*<?php esc_html_e( 'Only available in VFB Pro', 'visual-form-builder' ); ?>*</strong></p>
|
76 |
|
77 |
<p>
|
78 |
<label for="content-entries">
|
79 |
+
<input type="radio" id="content-entries" name="settings[content]" value="entries" checked="checked" /> <?php esc_html_e( 'Entries', 'visual-form-builder' ); ?>
|
80 |
</label>
|
81 |
</p>
|
82 |
+
<p class="description"><?php esc_html_e( 'This will export entries in either .csv, .txt, or .xls and cannot be used with the Import.', 'visual-form-builder' ); ?></p>
|
83 |
|
84 |
+
<h3><?php esc_html_e( 'Select a form', 'vfb-pro' ); ?></h3>
|
85 |
+
<select name="settings[form-id]" id="vfb-export-forms-list">
|
86 |
<?php
|
87 |
+
$first_form = '';
|
88 |
+
$entries_count = 0;
|
89 |
+
|
90 |
+
if ( is_array( $forms ) && ! empty( $forms ) ) {
|
91 |
+
$first_form = $forms[0];
|
92 |
+
|
93 |
+
foreach ( $forms as $form ) {
|
94 |
+
printf(
|
95 |
+
'<option value="%1$d">%1$d - %2$s</option>',
|
96 |
+
esc_html( $form['form_id'] ),
|
97 |
+
esc_html( $form['form_title'] )
|
98 |
+
);
|
|
|
99 |
}
|
100 |
+
}
|
101 |
?>
|
102 |
+
</select>
|
103 |
+
|
104 |
<div class="vfb-export-entries-options">
|
105 |
+
<h3><?php esc_html_e( 'Customize your export', 'visual-form-builder' ); ?></h3>
|
106 |
|
107 |
<p>
|
108 |
+
<label class="vfb-export-label" for="format"><?php esc_html_e( 'Format:', 'visual-form-builder' ); ?></label>
|
109 |
+
<select name="settings[format]">
|
110 |
+
<option value="csv" selected="selected"><?php esc_html_e( 'Comma Separated (.csv)', 'visual-form-builder' ); ?></option>
|
111 |
+
<option value="txt" disabled="disabled"><?php esc_html_e( 'Tab Delimited (.txt)', 'visual-form-builder' ); ?></option>
|
112 |
+
<option value="xls" disabled="disabled"><?php esc_html_e( 'Excel (.xls)', 'visual-form-builder' ); ?></option>
|
113 |
+
</select>
|
114 |
+
</p>
|
115 |
|
116 |
<p>
|
117 |
+
<label class="vfb-export-label" for="start-date"><?php esc_html_e( 'Date Range:', 'visual-form-builder' ); ?></label>
|
118 |
<select name="settings[start-date]">
|
119 |
<option value="0">Start Date</option>
|
120 |
<?php $this->months_dropdown(); ?>
|
121 |
</select>
|
122 |
<select name="settings[end-date]">
|
123 |
+
<option value="0">End Date</option>
|
124 |
+
<?php $this->months_dropdown(); ?>
|
125 |
</select>
|
126 |
</p>
|
127 |
|
128 |
+
<label class="vfb-export-label"><?php esc_html_e( 'Fields:', 'visual-form-builder' ); ?></label>
|
129 |
|
130 |
<p>
|
131 |
+
<a id="vfb-export-select-all" href="#"><?php esc_html_e( 'Select All', 'visual-form-builder' ); ?></a>
|
132 |
+
<a id="vfb-export-unselect-all" href="#"><?php esc_html_e( 'Unselect All', 'visual-form-builder' ); ?></a>
|
133 |
+
</p>
|
134 |
|
135 |
<div id="vfb-export-entries-fields">
|
136 |
+
<?php $this->fields_list( $first_form['form_id'] ); ?>
|
137 |
+
</div>
|
138 |
</div>
|
139 |
|
140 |
<?php
|
141 |
+
submit_button(
|
142 |
+
esc_html__( 'Download Export File', 'visual-form-builder' ),
|
143 |
+
'primary',
|
144 |
+
'' // leave blank so "name" attribute will not be added.
|
145 |
+
);
|
146 |
?>
|
147 |
</form>
|
148 |
</div>
|
156 |
* @return void
|
157 |
*/
|
158 |
public function export_action() {
|
159 |
+
if ( ! isset( $_POST['_vfb_action'] ) || ! isset( $_GET['page'] ) ) {
|
|
|
160 |
return;
|
161 |
+
}
|
162 |
|
163 |
+
if ( 'export' !== $_POST['_vfb_action'] ) {
|
164 |
return;
|
165 |
+
}
|
166 |
|
167 |
check_admin_referer( 'vfb_export' );
|
168 |
|
169 |
$data = array();
|
170 |
|
171 |
+
if ( isset( $_POST['settings'] ) ) {
|
172 |
+
foreach ( sanitize_text_field( wp_unslash( $_POST['settings'] ) ) as $key => $val ) {
|
173 |
+
$data[ $key ] = $val;
|
174 |
+
}
|
175 |
}
|
176 |
|
177 |
$data = stripslashes_deep( $data );
|
182 |
$end_date = isset( $data['end-date'] ) ? sanitize_text_field( $data['end-date'] ) : '';
|
183 |
$fields = isset( $data['fields'] ) ? $data['fields'] : '';
|
184 |
|
185 |
+
if ( 0 == $form_id ) {
|
186 |
return;
|
187 |
+
}
|
188 |
|
189 |
switch ( $content ) {
|
190 |
+
case 'entries':
|
191 |
+
// If no fields selected, exit because there's nothing to do.
|
192 |
+
if ( empty( $fields ) ) {
|
193 |
return;
|
194 |
+
}
|
195 |
|
196 |
global $wpdb;
|
197 |
$where = '';
|
198 |
|
199 |
+
if ( 0 !== $form_id ) {
|
200 |
+
$where .= $wpdb->prepare( ' AND form_id = %d', $form_id );
|
201 |
+
}
|
202 |
|
203 |
+
if ( $start_date ) {
|
204 |
+
$where .= $wpdb->prepare( ' AND date_submitted >= %s', gmdate( 'Y-m-d', strtotime( $start_date ) ) );
|
205 |
+
}
|
206 |
+
|
207 |
+
if ( $end_date ) {
|
208 |
+
$where .= $wpdb->prepare( ' AND date_submitted < %s', gmdate( 'Y-m-d', strtotime( '+1 month', strtotime( $end_date ) ) ) );
|
209 |
+
}
|
210 |
|
|
|
|
|
|
|
211 |
$title = $wpdb->get_var( null, 1 );
|
212 |
|
213 |
$settings['format'] = $format;
|
216 |
|
217 |
$this->export_entries( $settings, $title );
|
218 |
|
219 |
+
die( 1 );
|
220 |
|
221 |
+
break;
|
222 |
}
|
223 |
}
|
224 |
|
225 |
/**
|
226 |
* [export_entries description]
|
227 |
*
|
228 |
+
* @param [type] $data [$data description].
|
229 |
+
* @param array $title [$title description].
|
230 |
*
|
231 |
+
* @return [type] [return description]
|
232 |
*/
|
233 |
public function export_entries( $data = array(), $title = '' ) {
|
234 |
+
if ( ! is_array( $data ) || empty( $data ) ) {
|
235 |
return;
|
236 |
+
}
|
237 |
|
238 |
$format = $data['format'];
|
239 |
|
240 |
$sitename = sanitize_key( get_bloginfo( 'name' ) );
|
241 |
+
if ( ! empty( $sitename ) ) {
|
242 |
+
$sitename .= '.';
|
243 |
+
}
|
244 |
+
$filename = "{$sitename}vfb-export.{$title}." . gmdate( 'Y-m-d-Hi' ) . ".{$format}";
|
245 |
|
246 |
+
// Set content type based on file format.
|
247 |
switch ( $format ) {
|
248 |
+
case 'csv':
|
249 |
$content_type = 'text/csv';
|
250 |
break;
|
251 |
}
|
260 |
header( 'Expires: 0' );
|
261 |
header( 'Pragma: public' );
|
262 |
|
263 |
+
if ( in_array( $format, array( 'csv', 'txt' ) ) ) {
|
264 |
$this->csv_tab( $data['fields'], $data['where'], $format, $file_path );
|
265 |
+
}
|
266 |
}
|
267 |
|
268 |
/**
|
269 |
* [csv_tab description]
|
270 |
*
|
271 |
+
* @param [type] $fields [$fields description].
|
272 |
+
* @param [type] $where [$where description].
|
273 |
+
* @param [type] $format [$format description].
|
274 |
+
* @param [type] $file_path [$file_path description].
|
275 |
*
|
276 |
+
* @return [type] [return description]
|
277 |
*/
|
278 |
public function csv_tab( $fields, $where, $format, $file_path ) {
|
279 |
global $wpdb;
|
280 |
$file = fopen( $file_path, 'w' );
|
281 |
|
282 |
$headers = $rows = array();
|
283 |
+
$entries = $wpdb->get_results( 'SELECT * FROM ' . VFB_WP_ENTRIES_TABLE_NAME . " WHERE entry_approved = 1 $where ORDER BY entries_id ASC" );
|
284 |
|
285 |
+
// Get columns.
|
286 |
$columns = $this->get_cols( $entries );
|
287 |
|
288 |
+
// Get JSON data.
|
289 |
$json = json_decode( $columns, true );
|
290 |
|
291 |
$rows = $fields_clean = $fields_header = array();
|
292 |
|
293 |
+
// Decode special characters.
|
294 |
foreach ( $fields as $field ) {
|
295 |
+
// Strip unique ID for a clean header.
|
296 |
+
$search = preg_replace( '/{{(\d+)}}/', '', $field );
|
297 |
$fields_header[] = wp_specialchars_decode( $search, ENT_QUOTES );
|
298 |
|
299 |
+
// Field with unique ID to use as matching data.
|
300 |
$fields_clean[] = wp_specialchars_decode( $field, ENT_QUOTES );
|
301 |
}
|
302 |
|
303 |
+
// Build headers.
|
304 |
fputcsv( $file, $fields_header, $this->delimiter );
|
305 |
|
306 |
+
// Build table rows and cells.
|
307 |
foreach ( $json as $row ) {
|
308 |
foreach ( $fields_clean as $label ) {
|
309 |
$label = wp_specialchars_decode( $label );
|
310 |
+
// Prepend a space to prevent CSV injection attacks.
|
311 |
$value = ' ' . wp_specialchars_decode( $row[ $label ] );
|
312 |
|
313 |
+
$rows[ $label ] = ( isset( $row[ $label ] ) && in_array( $label, $fields_clean ) ) ? $value : '';
|
314 |
}
|
315 |
|
316 |
fputcsv( $file, $rows, $this->delimiter );
|
317 |
}
|
318 |
|
319 |
+
// Close the file.
|
320 |
fclose( $file );
|
321 |
|
322 |
+
// Reads file in uploads folder and writes to output buffer.
|
323 |
readfile( $file_path );
|
324 |
|
325 |
+
// Delete export file.
|
326 |
wp_delete_file( $file_path );
|
327 |
|
328 |
exit();
|
331 |
/**
|
332 |
* [fields_list description]
|
333 |
*
|
334 |
+
* @param [type] $form_id [$form_id description].
|
335 |
*
|
336 |
+
* @return [type] [return description]
|
337 |
*/
|
338 |
public function fields_list( $form_id ) {
|
339 |
+
$entries = $this->get_entries( $form_id );
|
340 |
$entries_count = $this->get_entries_count( $form_id );
|
341 |
|
342 |
+
if ( 0 == $entries_count ) {
|
343 |
+
return esc_html_e( 'No entries.', 'visual-form-builder' );
|
344 |
+
}
|
345 |
+
|
346 |
+
if ( is_array( $entries ) && ! empty( $entries ) ) {
|
347 |
$columns = $this->get_cols( $entries );
|
348 |
+
$data = json_decode( $columns, true );
|
349 |
|
350 |
$output = '';
|
351 |
|
352 |
$array = array();
|
353 |
foreach ( $data as $row ) {
|
354 |
+
$array = array_merge( $row, $array );
|
355 |
}
|
356 |
|
357 |
$array = array_keys( $array );
|
361 |
foreach ( $array as $id => $value ) {
|
362 |
$selected = in_array( $value, $this->default_cols ) ? ' checked="checked"' : '';
|
363 |
|
364 |
+
// Strip unique ID for a clean list.
|
365 |
$search = preg_replace( '/{{(\d+)}}/', '', $value );
|
|
|
366 |
?>
|
367 |
+
<label for="vfb-export-fields-val-<?php echo esc_attr( $id ); ?>">
|
368 |
+
<input
|
369 |
+
name="settings[fields][<?php echo esc_attr( $id ); ?>]"
|
370 |
+
class="vfb-export-fields-vals"
|
371 |
+
id="vfb-export-fields-val-<?php echo esc_attr( $id ); ?>"
|
372 |
+
type="checkbox"
|
373 |
+
value="<?php echo esc_attr( $value ); ?>"
|
374 |
+
<?php echo esc_html( $selected ); ?>
|
375 |
+
>
|
376 |
+
<?php echo esc_html( $search ); ?>
|
377 |
</label><br>
|
378 |
<?php
|
379 |
}
|
385 |
/**
|
386 |
* [get_entries description]
|
387 |
*
|
388 |
+
* @param [type] $form_id [$form_id description].
|
389 |
*
|
390 |
+
* @return [type] [return description]
|
391 |
*/
|
392 |
public function get_entries( $form_id ) {
|
393 |
global $wpdb;
|
394 |
|
395 |
+
$entries = $wpdb->get_results( $wpdb->prepare( 'SELECT data FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' WHERE form_id = %d AND entry_approved = 1', $form_id ), ARRAY_A );
|
396 |
return $entries;
|
397 |
}
|
398 |
|
401 |
*
|
402 |
* @since 1.7
|
403 |
*
|
404 |
+
* @param array $entries The resulting database query for entries.
|
405 |
*/
|
406 |
public function get_cols( $entries ) {
|
407 |
+
// Initialize row index at 0.
|
408 |
+
$row = 0;
|
|
|
409 |
$output = array();
|
410 |
|
411 |
+
// Loop through all entries.
|
412 |
foreach ( $entries as $entry ) {
|
413 |
foreach ( $entry as $key => $value ) {
|
414 |
switch ( $key ) {
|
419 |
case 'sender_name':
|
420 |
case 'sender_email':
|
421 |
$output[ $row ][ stripslashes( $this->default_cols[ $key ] ) ] = $value;
|
422 |
+
break;
|
423 |
|
424 |
case 'emails_to':
|
425 |
$output[ $row ][ stripslashes( $this->default_cols[ $key ] ) ] = implode( ',', maybe_unserialize( $value ) );
|
426 |
+
break;
|
427 |
|
428 |
case 'data':
|
429 |
+
// Unserialize value only if it was serialized.
|
430 |
$fields = maybe_unserialize( $value );
|
431 |
|
432 |
+
// Make sure there are no errors with unserializing before proceeding.
|
433 |
if ( is_array( $fields ) ) {
|
434 |
+
// Loop through our submitted data.
|
435 |
foreach ( $fields as $field_key => $field_value ) {
|
436 |
+
// Cast each array as an object.
|
437 |
$obj = (object) $field_value;
|
438 |
|
439 |
+
// Decode the values so HTML tags can be stripped.
|
440 |
$val = wp_specialchars_decode( $obj->value, ENT_QUOTES );
|
441 |
|
442 |
switch ( $obj->type ) {
|
443 |
+
case 'fieldset':
|
444 |
+
case 'section':
|
445 |
+
case 'instructions':
|
446 |
+
case 'page-break':
|
447 |
+
case 'verification':
|
448 |
+
case 'secret':
|
449 |
+
case 'submit':
|
450 |
break;
|
451 |
|
452 |
+
case 'address':
|
|
|
453 |
$val = str_replace( array( '<p>', '</p>', '<br>' ), array( '', "\n", "\n" ), $val );
|
454 |
|
455 |
+
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] = $val;
|
|
|
456 |
break;
|
457 |
|
458 |
+
case 'html':
|
459 |
+
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] = $val;
|
|
|
|
|
460 |
break;
|
461 |
|
462 |
+
default:
|
|
|
463 |
$val = wp_strip_all_tags( $val );
|
464 |
+
$output[ $row ][ stripslashes( $obj->name ) . "{{{$obj->id}}}" ] = $val;
|
|
|
465 |
break;
|
466 |
}
|
467 |
}
|
468 |
}
|
469 |
+
break;
|
470 |
}
|
471 |
}
|
472 |
+
|
473 |
$row++;
|
474 |
}
|
475 |
|
476 |
+
return wp_json_encode( $output );
|
477 |
}
|
478 |
|
479 |
/**
|
485 |
public function load_fields() {
|
486 |
global $wpdb;
|
487 |
|
488 |
+
// Check AJAX nonce set via wp_localize_script.
|
489 |
check_ajax_referer( 'vfb_ajax', 'vfb_ajax_nonce' );
|
490 |
|
491 |
+
if ( isset( $_GET['action'] ) && 'vfb-export-fields' !== $_GET['action'] ) {
|
492 |
return;
|
493 |
+
}
|
494 |
|
495 |
$form_id = absint( $_GET['id'] );
|
496 |
|
497 |
$this->fields_list( $form_id );
|
498 |
|
499 |
+
die( 1 );
|
500 |
}
|
501 |
|
502 |
/**
|
510 |
$where = apply_filters( 'vfb_pre_get_entries', '' );
|
511 |
|
512 |
$months = $wpdb->get_results(
|
513 |
+
'SELECT DISTINCT YEAR( forms.date_submitted ) AS year, MONTH( forms.date_submitted ) AS month FROM ' . VFB_WP_ENTRIES_TABLE_NAME . " AS forms
|
514 |
+
WHERE 1=1 $where
|
515 |
+
ORDER BY forms.date_submitted DESC
|
516 |
+
"
|
517 |
+
);
|
518 |
|
519 |
$month_count = count( $months );
|
520 |
|
521 |
+
if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
|
522 |
return;
|
523 |
+
}
|
524 |
|
525 |
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
526 |
|
527 |
foreach ( $months as $arc_row ) {
|
528 |
+
if ( 0 == $arc_row->year ) {
|
529 |
continue;
|
530 |
+
}
|
531 |
|
532 |
$month = zeroise( $arc_row->month, 2 );
|
533 |
+
$year = $arc_row->year;
|
534 |
|
535 |
+
printf(
|
536 |
+
"<option value='%s'>%s</option>\n",
|
537 |
esc_attr( $arc_row->year . '-' . $month ),
|
538 |
+
sprintf( esc_html__( '%1$s %2$d' ), esc_html( $wp_locale->get_month( $month ) ), esc_html( $year ) )
|
539 |
);
|
540 |
}
|
541 |
}
|
542 |
|
543 |
/**
|
544 |
* [count_entries description]
|
545 |
+
*
|
546 |
+
* @param [type] $form_id [description].
|
547 |
* @return [type] [description]
|
548 |
*/
|
549 |
public function get_entries_count( $form_id ) {
|
550 |
global $wpdb;
|
551 |
|
552 |
+
$count = $wpdb->get_var( $wpdb->prepare( 'SELECT COUNT(*) FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' WHERE form_id = %d', $form_id ) );
|
553 |
|
554 |
+
if ( ! $count ) {
|
555 |
+
return 0;
|
556 |
+
}
|
557 |
|
558 |
return $count;
|
559 |
}
|
561 |
/**
|
562 |
* [get_all_forms description]
|
563 |
*
|
564 |
+
* @return [type] [return description]
|
565 |
*/
|
566 |
public function get_all_forms() {
|
567 |
global $wpdb;
|
568 |
|
569 |
+
// Query to get all forms.
|
570 |
$order = sanitize_sql_orderby( 'form_id ASC' );
|
571 |
$where = apply_filters( 'vfb_pre_get_forms_export', '' );
|
572 |
+
$forms = $wpdb->get_results( 'SELECT form_id, form_key, form_title FROM ' . VFB_WP_FORMS_TABLE_NAME . " WHERE 1=1 $where ORDER BY $order", ARRAY_A );
|
573 |
|
574 |
return $forms;
|
575 |
}
|
admin/class-fields.php
CHANGED
@@ -3,453 +3,462 @@
|
|
3 |
* [Visual_Form_Builder_Admin_Fields description]
|
4 |
*/
|
5 |
class Visual_Form_Builder_Admin_Fields {
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
global $wpdb;
|
8 |
|
9 |
-
$field_where = ( isset( $field_id ) && !is_null( $field_id ) ) ? "AND field_id = $field_id" : '';
|
10 |
-
// Display all fields for the selected form
|
11 |
-
$fields = $wpdb->get_results( $wpdb->prepare(
|
12 |
|
13 |
-
$depth
|
14 |
$parent = $last = 0;
|
15 |
ob_start();
|
16 |
|
17 |
-
// Loop through each field and display
|
18 |
foreach ( $fields as &$field ) :
|
19 |
-
// If we are at the root level
|
20 |
-
if (
|
21 |
-
// If we've been down a level, close out the list
|
22 |
while ( $depth > 1 ) {
|
23 |
echo '</li></ul>';
|
24 |
$depth--;
|
25 |
}
|
26 |
|
27 |
-
// Close out the root item
|
28 |
echo '</li>';
|
29 |
-
}
|
30 |
-
|
31 |
-
elseif ( $field->field_parent && $field->field_parent == $last ) {
|
32 |
echo '<ul class="parent">';
|
33 |
$depth++;
|
34 |
-
}
|
35 |
-
|
36 |
-
elseif ( $field->field_parent && $field->field_parent != $parent ) {
|
37 |
echo '</li></ul></li>';
|
38 |
$depth--;
|
39 |
-
}
|
40 |
-
|
41 |
-
elseif ( $field->field_parent && $field->field_parent == $parent )
|
42 |
echo '</li>';
|
|
|
43 |
|
44 |
-
// Store item ID and parent ID to test for nesting
|
45 |
-
$last
|
46 |
$parent = $field->field_parent;
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
<p class="description description-wide">
|
70 |
-
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
71 |
-
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
|
72 |
-
<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>
|
73 |
-
<br />
|
74 |
-
<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; ?>" />
|
75 |
-
</label>
|
76 |
-
</p>
|
77 |
-
|
78 |
-
<?php elseif( $field->field_type == 'instructions' ) : ?>
|
79 |
-
<!-- Instructions -->
|
80 |
-
<p class="description description-wide">
|
81 |
-
<label for="edit-form-item-name-<?php echo $field->field_id; ?>">
|
82 |
-
<?php _e( 'Name' , 'visual-form-builder'); ?>
|
83 |
-
<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>
|
84 |
-
<br />
|
85 |
-
<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" />
|
86 |
-
</label>
|
87 |
-
</p>
|
88 |
-
<!-- Description -->
|
89 |
<p class="description description-wide">
|
90 |
-
<label for="edit-form-item-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
<
|
95 |
</label>
|
96 |
</p>
|
97 |
-
<!-- CSS Classes -->
|
98 |
-
<p class="description description-thin">
|
99 |
-
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
100 |
-
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
|
101 |
-
<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>
|
102 |
-
<br />
|
103 |
-
<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; ?>" />
|
104 |
-
</label>
|
105 |
-
</p>
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
<
|
114 |
-
|
115 |
-
<option value="" <?php selected( $field->field_layout, '' ); ?>><?php _e( 'Default' , 'visual-form-builder'); ?></option>
|
116 |
-
<optgroup label="------------">
|
117 |
-
<option value="left-half" <?php selected( $field->field_layout, 'left-half' ); ?>><?php _e( 'Left Half' , 'visual-form-builder'); ?></option>
|
118 |
-
<option value="right-half" <?php selected( $field->field_layout, 'right-half' ); ?>><?php _e( 'Right Half' , 'visual-form-builder'); ?></option>
|
119 |
-
</optgroup>
|
120 |
-
<optgroup label="------------">
|
121 |
-
<option value="left-third" <?php selected( $field->field_layout, 'left-third' ); ?>><?php _e( 'Left Third' , 'visual-form-builder'); ?></option>
|
122 |
-
<option value="middle-third" <?php selected( $field->field_layout, 'middle-third' ); ?>><?php _e( 'Middle Third' , 'visual-form-builder'); ?></option>
|
123 |
-
<option value="right-third" <?php selected( $field->field_layout, 'right-third' ); ?>><?php _e( 'Right Third' , 'visual-form-builder'); ?></option>
|
124 |
-
</optgroup>
|
125 |
-
<optgroup label="------------">
|
126 |
-
<option value="left-two-thirds" <?php selected( $field->field_layout, 'left-two-thirds' ); ?>><?php _e( 'Left Two Thirds' , 'visual-form-builder'); ?></option>
|
127 |
-
<option value="right-two-thirds" <?php selected( $field->field_layout, 'right-two-thirds' ); ?>><?php _e( 'Right Two Thirds' , 'visual-form-builder'); ?></option>
|
128 |
-
</optgroup>
|
129 |
-
<?php apply_filters( 'vfb_admin_field_layout', $field->field_layout ); ?>
|
130 |
-
</select>
|
131 |
</label>
|
132 |
</p>
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
<p class="description description-wide">
|
138 |
-
<label for="edit-form-item-
|
139 |
-
<?php
|
140 |
-
|
141 |
-
|
142 |
-
<
|
143 |
</label>
|
144 |
</p>
|
145 |
-
<?php if ( $field->field_type == 'submit' ) : ?>
|
146 |
-
<!-- CSS Classes -->
|
147 |
-
<p class="description description-wide">
|
148 |
-
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
149 |
-
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
|
150 |
-
<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>
|
151 |
-
<br />
|
152 |
-
<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; ?>" />
|
153 |
-
</label>
|
154 |
-
</p>
|
155 |
-
<?php elseif ( $field->field_type !== 'submit' ) : ?>
|
156 |
-
<!-- Description -->
|
157 |
-
<p class="description description-wide">
|
158 |
-
<label for="edit-form-item-description-<?php echo $field->field_id; ?>">
|
159 |
-
<?php _e( 'Description' , 'visual-form-builder'); ?>
|
160 |
-
<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>
|
161 |
-
<br />
|
162 |
-
<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>
|
163 |
-
</label>
|
164 |
-
</p>
|
165 |
|
166 |
<?php
|
167 |
-
// Display the Options input only for radio, checkbox, and select fields
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
174 |
<?php
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
}
|
180 |
-
|
181 |
-
|
182 |
$opts_vals = array( 'Option 1', 'Option 2', 'Option 3' );
|
|
|
183 |
|
184 |
-
|
185 |
-
|
186 |
-
?>
|
187 |
-
<div class="vfb-cloned-options">
|
188 |
-
<?php foreach ( $opts_vals as $options ) : ?>
|
189 |
-
<div id="clone-<?php echo $field->field_id . '-' . $count; ?>" class="option">
|
190 |
-
<label for="edit-form-item-options-<?php echo $field->field_id . "-$count"; ?>" class="clonedOption">
|
191 |
-
<input type="radio" value="<?php echo esc_attr( $count ); ?>" name="field_default-<?php echo $field->field_id; ?>" <?php checked( $field->field_default, $count ); ?> />
|
192 |
-
<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"; ?>" />
|
193 |
-
</label>
|
194 |
-
|
195 |
-
<a href="#" class="deleteOption vfb-interface-icon vfb-interface-minus" title="Delete Option">
|
196 |
-
<?php _e( 'Delete', 'visual-form-builder' ); ?>
|
197 |
-
</a>
|
198 |
-
<span class="vfb-interface-icon vfb-interface-sort" title="<?php esc_attr_e( 'Drag and Drop to Sort Options', 'visual-form-builder' ); ?>"></span>
|
199 |
-
</div>
|
200 |
-
<?php
|
201 |
-
$count++;
|
202 |
-
endforeach;
|
203 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
endif;
|
218 |
?>
|
219 |
|
220 |
<?php if ( in_array( $field->field_type, array( 'file-upload' ) ) ) : ?>
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
}
|
|
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
<label for="edit-form-item-options-<?php echo $field->field_id; ?>">
|
236 |
-
<?php
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
</label>
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
// Unset the options for any following radio, checkboxes, or selects
|
245 |
unset( $opts_vals );
|
246 |
-
|
247 |
?>
|
248 |
|
249 |
<?php if ( in_array( $field->field_type, array( 'date' ) ) ) : ?>
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
// Unset the options for any following radio, checkboxes, or selects
|
265 |
unset( $opts_vals );
|
266 |
-
|
267 |
?>
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
|
|
301 |
break;
|
302 |
|
303 |
-
|
304 |
-
|
305 |
break;
|
306 |
|
307 |
-
|
308 |
-
|
309 |
break;
|
310 |
-
|
|
|
|
|
|
|
311 |
|
312 |
-
|
313 |
-
|
314 |
-
<?php endif; ?>
|
315 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
</label>
|
317 |
</p>
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
<
|
326 |
-
|
327 |
-
<option value="
|
|
|
|
|
|
|
328 |
</select>
|
329 |
</label>
|
330 |
</p>
|
331 |
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
<?php
|
352 |
-
|
353 |
-
|
354 |
-
<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"' : ''; ?>>
|
355 |
-
<option value="" <?php selected( $field->field_size, '' ); ?>><?php _e( 'One Column' , 'visual-form-builder'); ?></option>
|
356 |
-
<option value="two-column" <?php selected( $field->field_size, 'two-column' ); ?>><?php _e( 'Two Columns' , 'visual-form-builder'); ?></option>
|
357 |
-
<option value="three-column" <?php selected( $field->field_size, 'three-column' ); ?>><?php _e( 'Three Columns' , 'visual-form-builder'); ?></option>
|
358 |
-
<option value="auto-column" <?php selected( $field->field_size, 'auto-column' ); ?>><?php _e( 'Auto Width' , 'visual-form-builder'); ?></option>
|
359 |
-
</select>
|
360 |
-
</label>
|
361 |
-
</p>
|
362 |
-
|
363 |
-
<?php endif; ?>
|
364 |
-
<!-- Field Layout -->
|
365 |
-
<p class="description description-thin">
|
366 |
-
<label for="edit-form-item-layout">
|
367 |
-
<?php _e( 'Field Layout' , 'visual-form-builder'); ?>
|
368 |
-
<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>
|
369 |
-
<br />
|
370 |
-
<select name="field_layout-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-layout-<?php echo $field->field_id; ?>">
|
371 |
-
|
372 |
-
<option value="" <?php selected( $field->field_layout, '' ); ?>><?php _e( 'Default' , 'visual-form-builder'); ?></option>
|
373 |
-
<optgroup label="------------">
|
374 |
-
<option value="left-half" <?php selected( $field->field_layout, 'left-half' ); ?>><?php _e( 'Left Half' , 'visual-form-builder'); ?></option>
|
375 |
-
<option value="right-half" <?php selected( $field->field_layout, 'right-half' ); ?>><?php _e( 'Right Half' , 'visual-form-builder'); ?></option>
|
376 |
-
</optgroup>
|
377 |
-
<optgroup label="------------">
|
378 |
-
<option value="left-third" <?php selected( $field->field_layout, 'left-third' ); ?>><?php _e( 'Left Third' , 'visual-form-builder'); ?></option>
|
379 |
-
<option value="middle-third" <?php selected( $field->field_layout, 'middle-third' ); ?>><?php _e( 'Middle Third' , 'visual-form-builder'); ?></option>
|
380 |
-
<option value="right-third" <?php selected( $field->field_layout, 'right-third' ); ?>><?php _e( 'Right Third' , 'visual-form-builder'); ?></option>
|
381 |
-
</optgroup>
|
382 |
-
<optgroup label="------------">
|
383 |
-
<option value="left-two-thirds" <?php selected( $field->field_layout, 'left-two-thirds' ); ?>><?php _e( 'Left Two Thirds' , 'visual-form-builder'); ?></option>
|
384 |
-
<option value="right-two-thirds" <?php selected( $field->field_layout, 'right-two-thirds' ); ?>><?php _e( 'Right Two Thirds' , 'visual-form-builder'); ?></option>
|
385 |
-
</optgroup>
|
386 |
-
</select>
|
387 |
-
</label>
|
388 |
-
</p>
|
389 |
-
<?php if ( !in_array( $field->field_type, array( 'radio', 'select', 'checkbox', 'time', 'address' ) ) ) : ?>
|
390 |
-
<!-- Default Value -->
|
391 |
-
<p class="description description-wide">
|
392 |
-
<label for="edit-form-item-default-<?php echo $field->field_id; ?>">
|
393 |
-
<?php _e( 'Default Value' , 'visual-form-builder'); ?>
|
394 |
-
<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>
|
395 |
-
<br />
|
396 |
-
<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" />
|
397 |
-
</label>
|
398 |
-
</p>
|
399 |
-
<?php elseif( in_array( $field->field_type, array( 'address' ) ) ) : ?>
|
400 |
-
<!-- Default Country -->
|
401 |
-
<p class="description description-wide">
|
402 |
-
<label for="edit-form-item-default-<?php echo $field->field_id; ?>">
|
403 |
-
<?php _e( 'Default Country' , 'visual-form-builder'); ?>
|
404 |
-
<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>
|
405 |
-
<br />
|
406 |
-
<select name="field_default-<?php echo $field->field_id; ?>" class="widefat" id="edit-form-item-default-<?php echo $field->field_id; ?>">
|
407 |
-
<?php
|
408 |
-
$countries = include( VFB_WP_PLUGIN_DIR . '/inc/countries.php' );
|
409 |
-
foreach ( $countries as $country ) {
|
410 |
-
echo '<option value="' . $country . '" ' . selected( $field->field_default, $country, 0 ) . '>' . $country . '</option>';
|
411 |
-
}
|
412 |
-
?>
|
413 |
</select>
|
414 |
-
|
415 |
-
</p>
|
416 |
-
<?php endif; ?>
|
417 |
-
<!-- CSS Classes -->
|
418 |
-
<p class="description description-wide">
|
419 |
-
<label for="edit-form-item-css-<?php echo $field->field_id; ?>">
|
420 |
-
<?php _e( 'CSS Classes' , 'visual-form-builder'); ?>
|
421 |
-
<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>
|
422 |
-
<br />
|
423 |
-
<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" />
|
424 |
-
</label>
|
425 |
</p>
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
<?php endif; ?>
|
428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
429 |
|
430 |
-
<?php if ( !in_array( $field->field_type, array( 'verification', 'secret', 'submit' ) ) ) : ?>
|
431 |
-
<!-- Delete link -->
|
432 |
-
<a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=visual-form-builder&action=delete_field&form=' . $form_nav_selected_id . '&field=' . $field->field_id ), 'delete-field-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-delete item-delete submitdelete deletion">
|
433 |
-
<?php _e( 'Delete' , 'visual-form-builder'); ?>
|
434 |
-
<span class="vfb-interface-icon vfb-interface-trash"></span>
|
435 |
-
</a>
|
436 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
-
|
439 |
-
</div>
|
440 |
-
<?php
|
441 |
-
endforeach;
|
442 |
-
|
443 |
-
// This assures all of the <ul> and <li> are closed
|
444 |
if ( $depth > 1 ) {
|
445 |
-
while( $depth > 1 ) {
|
446 |
-
echo '</li>
|
447 |
-
</ul>';
|
448 |
$depth--;
|
449 |
}
|
450 |
}
|
451 |
|
452 |
-
// Close out last item
|
453 |
echo '</li>';
|
454 |
echo ob_get_clean();
|
455 |
}
|
3 |
* [Visual_Form_Builder_Admin_Fields description]
|
4 |
*/
|
5 |
class Visual_Form_Builder_Admin_Fields {
|
6 |
+
/**
|
7 |
+
* [field_output description]
|
8 |
+
*
|
9 |
+
* @param [type] $form_nav_selected_id [$form_nav_selected_id description].
|
10 |
+
* @param [type] $field_id [$field_id description].
|
11 |
+
*
|
12 |
+
* @return void
|
13 |
+
*/
|
14 |
+
public function field_output( $form_nav_selected_id, $field_id = null ) {
|
15 |
global $wpdb;
|
16 |
|
17 |
+
$field_where = ( isset( $field_id ) && ! is_null( $field_id ) ) ? "AND field_id = $field_id" : '';
|
18 |
+
// Display all fields for the selected form.
|
19 |
+
$fields = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FIELDS_TABLE_NAME . " WHERE form_id = %d $field_where ORDER BY field_sequence ASC", $form_nav_selected_id ) );
|
20 |
|
21 |
+
$depth = 1;
|
22 |
$parent = $last = 0;
|
23 |
ob_start();
|
24 |
|
25 |
+
// Loop through each field and display.
|
26 |
foreach ( $fields as &$field ) :
|
27 |
+
// If we are at the root level.
|
28 |
+
if ( ! $field->field_parent && $depth > 1 ) {
|
29 |
+
// If we've been down a level, close out the list.
|
30 |
while ( $depth > 1 ) {
|
31 |
echo '</li></ul>';
|
32 |
$depth--;
|
33 |
}
|
34 |
|
35 |
+
// Close out the root item.
|
36 |
echo '</li>';
|
37 |
+
} elseif ( $field->field_parent && $field->field_parent === $last ) {
|
38 |
+
// first item of <ul>, so move down a level.
|
|
|
39 |
echo '<ul class="parent">';
|
40 |
$depth++;
|
41 |
+
} elseif ( $field->field_parent && $field->field_parent !== $parent ) {
|
42 |
+
// Close up a <ul> and move up a level.
|
|
|
43 |
echo '</li></ul></li>';
|
44 |
$depth--;
|
45 |
+
} elseif ( $field->field_parent && $field->field_parent === $parent ) {
|
46 |
+
// Same level so close list item.
|
|
|
47 |
echo '</li>';
|
48 |
+
}
|
49 |
|
50 |
+
// Store item ID and parent ID to test for nesting.
|
51 |
+
$last = $field->field_id;
|
52 |
$parent = $field->field_parent;
|
53 |
+
?>
|
54 |
+
<li id="form_item_<?php echo esc_attr( $field->field_id ); ?>" class="form-item<?php echo ( in_array( $field->field_type, array( 'submit', 'secret', 'verification' ) ) ) ? ' ui-state-disabled' : ''; ?><?php echo ( ! in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) ) ? ' mjs-nestedSortable-no-nesting' : ''; ?>">
|
55 |
+
<dl class="menu-item-bar vfb-menu-item-inactive">
|
56 |
+
<dt class="vfb-menu-item-handle vfb-menu-item-type-<?php echo esc_attr( $field->field_type ); ?>">
|
57 |
+
<span class="item-title"><?php echo esc_html( wp_unslash( $field->field_name ) ); ?><?php echo ( 'yes' === $field->field_required ) ? ' <span class="is-field-required">*</span>' : ''; ?></span>
|
58 |
+
<span class="item-controls">
|
59 |
+
<span class="item-type"><?php echo esc_html( strtoupper( str_replace( '-', ' ', $field->field_type ) ) ); ?></span>
|
60 |
+
<a href="#" title="<?php esc_attr_e( 'Edit Field Item', 'visual-form-builder' ); ?>" id="edit-<?php echo esc_attr( $field->field_id ); ?>" class="item-edit"><?php esc_html_e( 'Edit Field Item', 'visual-form-builder' ); ?></a>
|
61 |
+
</span>
|
62 |
+
</dt>
|
63 |
+
</dl>
|
64 |
+
|
65 |
+
<div id="form-item-settings-<?php echo esc_attr( $field->field_id ); ?>" class="menu-item-settings field-type-<?php echo esc_attr( $field->field_type ); ?>" style="display: none;">
|
66 |
+
<?php if ( in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) ) : ?>
|
67 |
+
|
68 |
+
<p class="description description-wide">
|
69 |
+
<label for="edit-form-item-name-<?php echo esc_attr( $field->field_id ); ?>"><?php echo ( in_array( $field->field_type, array( 'fieldset', 'verification' ) ) ) ? 'Legend' : 'Name'; ?>
|
70 |
+
<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>
|
71 |
+
<br />
|
72 |
+
<input type="text" value="<?php echo esc_html( wp_unslash( $field->field_name ) ); ?>" name="field_name-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-name-<?php echo esc_attr( $field->field_id ); ?>" maxlength="255" />
|
73 |
+
</label>
|
74 |
+
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
<p class="description description-wide">
|
76 |
+
<label for="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>">
|
77 |
+
<?php esc_html_e( 'CSS Classes', 'visual-form-builder' ); ?>
|
78 |
+
<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>
|
79 |
+
<br />
|
80 |
+
<input type="text" value="<?php echo esc_html( $field->field_css ); ?>" name="field_css-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>" />
|
81 |
</label>
|
82 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
+
<?php elseif ( 'instructions' === $field->field_type ) : ?>
|
85 |
+
<!-- Instructions -->
|
86 |
+
<p class="description description-wide">
|
87 |
+
<label for="edit-form-item-name-<?php echo esc_attr( $field->field_id ); ?>">
|
88 |
+
<?php esc_html_e( 'Name', 'visual-form-builder' ); ?>
|
89 |
+
<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>
|
90 |
+
<br />
|
91 |
+
<input type="text" value="<?php echo esc_html( wp_unslash( $field->field_name ) ); ?>" name="field_name-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-name-<?php echo esc_attr( $field->field_id ); ?>" maxlength="255" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
</label>
|
93 |
</p>
|
94 |
+
<!-- Description -->
|
95 |
+
<p class="description description-wide">
|
96 |
+
<label for="edit-form-item-description-<?php echo esc_attr( $field->field_id ); ?>">
|
97 |
+
<?php esc_html_e( 'Description (HTML tags allowed)', 'visual-form-builder' ); ?>
|
98 |
+
<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>
|
99 |
+
<br />
|
100 |
+
<textarea name="field_description-<?php echo esc_attr( $field->field_id ); ?>" class="widefat edit-menu-item-description" cols="20" rows="3" id="edit-form-item-description-<?php echo esc_attr( $field->field_id ); ?>" /><?php echo esc_html( wp_unslash( $field->field_description ) ); ?></textarea>
|
101 |
+
</label>
|
102 |
+
</p>
|
103 |
+
<!-- CSS Classes -->
|
104 |
+
<p class="description description-thin">
|
105 |
+
<label for="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>">
|
106 |
+
<?php esc_html_e( 'CSS Classes', 'visual-form-builder' ); ?>
|
107 |
+
<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>
|
108 |
+
<br />
|
109 |
+
<input type="text" value="<?php echo esc_attr( $field->field_css ); ?>" name="field_css-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>" />
|
110 |
+
</label>
|
111 |
+
</p>
|
112 |
+
|
113 |
+
<!-- Field Layout -->
|
114 |
+
<p class="description description-thin">
|
115 |
+
<label for="edit-form-item-layout">
|
116 |
+
<?php esc_html_e( 'Field Layout', 'visual-form-builder' ); ?>
|
117 |
+
<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>
|
118 |
+
<br />
|
119 |
+
<select name="field_layout-<?php echo esc_html( $field->field_id ); ?>" class="widefat" id="edit-form-item-layout-<?php echo esc_attr( $field->field_id ); ?>">
|
120 |
+
<option value="" <?php selected( esc_html( $field->field_layout ), '' ); ?>><?php esc_html_e( 'Default', 'visual-form-builder' ); ?></option>
|
121 |
+
<optgroup label="------------">
|
122 |
+
<option value="left-half" <?php selected( $field->field_layout, 'left-half' ); ?>><?php esc_html_e( 'Left Half', 'visual-form-builder' ); ?></option>
|
123 |
+
<option value="right-half" <?php selected( $field->field_layout, 'right-half' ); ?>><?php esc_html_e( 'Right Half', 'visual-form-builder' ); ?></option>
|
124 |
+
</optgroup>
|
125 |
+
<optgroup label="------------">
|
126 |
+
<option value="left-third" <?php selected( $field->field_layout, 'left-third' ); ?>><?php esc_html_e( 'Left Third', 'visual-form-builder' ); ?></option>
|
127 |
+
<option value="middle-third" <?php selected( $field->field_layout, 'middle-third' ); ?>><?php esc_html_e( 'Middle Third', 'visual-form-builder' ); ?></option>
|
128 |
+
<option value="right-third" <?php selected( $field->field_layout, 'right-third' ); ?>><?php esc_html_e( 'Right Third', 'visual-form-builder' ); ?></option>
|
129 |
+
</optgroup>
|
130 |
+
<optgroup label="------------">
|
131 |
+
<option value="left-two-thirds" <?php selected( $field->field_layout, 'left-two-thirds' ); ?>><?php esc_html_e( 'Left Two Thirds', 'visual-form-builder' ); ?></option>
|
132 |
+
<option value="right-two-thirds" <?php selected( $field->field_layout, 'right-two-thirds' ); ?>><?php esc_html_e( 'Right Two Thirds', 'visual-form-builder' ); ?></option>
|
133 |
+
</optgroup>
|
134 |
+
<?php apply_filters( 'vfb_admin_field_layout', $field->field_layout ); ?>
|
135 |
+
</select>
|
136 |
+
</label>
|
137 |
+
</p>
|
138 |
+
|
139 |
+
<?php else : ?>
|
140 |
+
|
141 |
+
<!-- Name -->
|
142 |
+
<p class="description description-wide">
|
143 |
+
<label for="edit-form-item-name-<?php echo esc_attr( $field->field_id ); ?>">
|
144 |
+
<?php esc_html_e( 'Name', 'visual-form-builder' ); ?>
|
145 |
+
<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>
|
146 |
+
<br />
|
147 |
+
<input type="text" value="<?php echo esc_html( wp_unslash( $field->field_name ) ); ?>" name="field_name-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-name-<?php echo esc_attr( $field->field_id ); ?>" maxlength="255" />
|
148 |
+
</label>
|
149 |
+
</p>
|
150 |
+
<?php if ( 'submit' === $field->field_type ) : ?>
|
151 |
+
<!-- CSS Classes -->
|
152 |
+
<p class="description description-wide">
|
153 |
+
<label for="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>">
|
154 |
+
<?php esc_html_e( 'CSS Classes', 'visual-form-builder' ); ?>
|
155 |
+
<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>
|
156 |
+
<br />
|
157 |
+
<input type="text" value="<?php echo esc_html( $field->field_css ); ?>" name="field_css-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>" />
|
158 |
+
</label>
|
159 |
+
</p>
|
160 |
+
<?php elseif ( 'submit' !== $field->field_type ) : ?>
|
161 |
+
<!-- Description -->
|
162 |
<p class="description description-wide">
|
163 |
+
<label for="edit-form-item-description-<?php echo esc_attr( $field->field_id ); ?>">
|
164 |
+
<?php esc_html_e( 'Description', 'visual-form-builder' ); ?>
|
165 |
+
<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>
|
166 |
+
<br />
|
167 |
+
<textarea name="field_description-<?php echo esc_html( $field->field_id ); ?>" class="widefat edit-menu-item-description" cols="20" rows="3" id="edit-form-item-description-<?php echo esc_attr( $field->field_id ); ?>" /><?php echo esc_html( wp_unslash( $field->field_description ) ); ?></textarea>
|
168 |
</label>
|
169 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
<?php
|
172 |
+
// Display the Options input only for radio, checkbox, and select fields.
|
173 |
+
if ( in_array( $field->field_type, array( 'radio', 'checkbox', 'select' ) ) ) :
|
174 |
+
?>
|
175 |
+
<!-- Options -->
|
176 |
+
<p class="description description-wide">
|
177 |
+
<?php esc_html_e( 'Options', 'visual-form-builder' ); ?>
|
178 |
+
<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>
|
179 |
+
<br />
|
180 |
<?php
|
181 |
+
// If the options field isn't empty, unserialize and build array.
|
182 |
+
if ( ! empty( $field->field_options ) ) {
|
183 |
+
if ( is_serialized( $field->field_options ) ) {
|
184 |
+
$opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : explode( ',', unserialize( $field->field_options ) );
|
185 |
}
|
186 |
+
} else {
|
187 |
+
// Otherwise, present some default options.
|
188 |
$opts_vals = array( 'Option 1', 'Option 2', 'Option 3' );
|
189 |
+
}
|
190 |
|
191 |
+
// Basic count to keep track of multiple options.
|
192 |
+
$count = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
?>
|
194 |
+
<div class="vfb-cloned-options">
|
195 |
+
<?php foreach ( $opts_vals as $options ) : ?>
|
196 |
+
<div id="clone-<?php echo esc_attr( $field->field_id . '-' . $count ); ?>" class="option">
|
197 |
+
<label for="edit-form-item-options-<?php echo esc_attr( $field->field_id . "-$count" ); ?>" class="clonedOption">
|
198 |
+
<input type="radio" value="<?php echo esc_html( $count ); ?>" name="field_default-<?php echo esc_attr( $field->field_id ); ?>" <?php checked( $field->field_default, $count ); ?> />
|
199 |
+
<input type="text" value="<?php echo esc_html( wp_unslash( $options ) ); ?>" name="field_options-<?php echo esc_attr( $field->field_id ); ?>[]" class="widefat" id="edit-form-item-options-<?php echo esc_attr( $field->field_id . "-$count" ); ?>" />
|
200 |
+
</label>
|
201 |
|
202 |
+
<a href="#" class="deleteOption vfb-interface-icon vfb-interface-minus" title="Delete Option">
|
203 |
+
<?php esc_html_e( 'Delete', 'visual-form-builder' ); ?>
|
204 |
+
</a>
|
205 |
+
<span class="vfb-interface-icon vfb-interface-sort" title="<?php esc_attr_e( 'Drag and Drop to Sort Options', 'visual-form-builder' ); ?>"></span>
|
206 |
+
</div>
|
207 |
+
<?php
|
208 |
+
$count++;
|
209 |
+
endforeach;
|
210 |
+
?>
|
211 |
+
</div> <!-- .vfb-cloned-options -->
|
212 |
+
<div class="clear"></div>
|
213 |
+
<div class="vfb-add-options-group">
|
214 |
+
<a href="#" class="vfb-button vfb-add-option" title="Add Option">
|
215 |
+
<?php esc_html_e( 'Add Option', 'visual-form-builder' ); ?>
|
216 |
+
<span class="vfb-interface-icon vfb-interface-plus"></span>
|
217 |
+
</a>
|
218 |
+
</div>
|
219 |
+
</p>
|
220 |
+
<?php
|
221 |
+
// Unset the options for any following radio, checkboxes, or selects.
|
222 |
+
unset( $opts_vals );
|
223 |
endif;
|
224 |
?>
|
225 |
|
226 |
<?php if ( in_array( $field->field_type, array( 'file-upload' ) ) ) : ?>
|
227 |
+
<!-- File Upload Accepts -->
|
228 |
+
<p class="description description-wide">
|
229 |
+
<?php
|
230 |
+
$opts_vals = array( '' );
|
231 |
+
|
232 |
+
// If the options field isn't empty, unserialize and build array.
|
233 |
+
if ( ! empty( $field->field_options ) ) {
|
234 |
+
if ( is_serialized( $field->field_options ) ) {
|
235 |
+
$opts_vals = ( is_array( unserialize( $field->field_options ) ) ) ? unserialize( $field->field_options ) : unserialize( $field->field_options );
|
236 |
}
|
237 |
+
}
|
238 |
|
239 |
+
// Loop through the options.
|
240 |
+
foreach ( $opts_vals as $options ) {
|
241 |
+
?>
|
242 |
+
<label for="edit-form-item-options-<?php echo esc_attr( $field->field_id ); ?>">
|
243 |
+
<?php esc_html_e( 'Accepted File Extensions', 'visual-form-builder' ); ?>
|
244 |
+
<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>
|
245 |
+
<br />
|
246 |
+
<input type="text" value="<?php echo esc_attr( $options ); ?>" name="field_options-<?php echo esc_attr( $field->field_id ); ?>[]" class="widefat" id="edit-form-item-options-<?php echo esc_attr( $field->field_id ); ?>" />
|
247 |
</label>
|
248 |
+
</p>
|
249 |
+
<?php
|
250 |
+
}
|
251 |
+
// Unset the options for any following radio, checkboxes, or selects.
|
252 |
unset( $opts_vals );
|
253 |
+
endif;
|
254 |
?>
|
255 |
|
256 |
<?php if ( in_array( $field->field_type, array( 'date' ) ) ) : ?>
|
257 |
+
<!-- Date Format -->
|
258 |
+
<p class="description description-wide">
|
259 |
+
<?php
|
260 |
+
$opts_vals = maybe_unserialize( $field->field_options );
|
261 |
+
$date_format = ( isset( $opts_vals['dateFormat'] ) ) ? $opts_vals['dateFormat'] : 'mm/dd/yy';
|
262 |
+
?>
|
263 |
+
<label for="edit-form-item-date-dateFormat-<?php echo esc_attr( $field->field_id ); ?>">
|
264 |
+
<?php esc_html_e( 'Date Format', 'visual-form-builder' ); ?>
|
265 |
+
<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>
|
266 |
+
<br />
|
267 |
+
<input type="text" value="<?php echo esc_html( $date_format ); ?>" name="field_options-<?php echo esc_attr( $field->field_id ); ?>[dateFormat]" class="widefat" id="edit-form-item-date-dateFormat-<?php echo esc_attr( $field->field_id ); ?>" />
|
268 |
+
</label>
|
269 |
+
</p>
|
270 |
+
<?php
|
271 |
+
// Unset the options for any following radio, checkboxes, or selects.
|
272 |
unset( $opts_vals );
|
273 |
+
endif;
|
274 |
?>
|
275 |
+
<!-- Validation -->
|
276 |
+
<p class="description description-thin">
|
277 |
+
<label for="edit-form-item-validation">
|
278 |
+
<?php esc_html_e( 'Validation', 'visual-form-builder' ); ?>
|
279 |
+
<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>
|
280 |
+
<br />
|
281 |
+
|
282 |
+
<?php if ( in_array( $field->field_type, array( 'text', 'time', 'number' ) ) ) : ?>
|
283 |
+
<select name="field_validation-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-validation-<?php echo esc_attr( $field->field_id ); ?>">
|
284 |
+
<?php if ( 'time' === $field->field_type ) : ?>
|
285 |
+
<option value="time-12" <?php selected( $field->field_validation, 'time-12' ); ?>><?php esc_html_e( '12 Hour Format', 'visual-form-builder' ); ?></option>
|
286 |
+
<option value="time-24" <?php selected( $field->field_validation, 'time-24' ); ?>><?php esc_html_e( '24 Hour Format', 'visual-form-builder' ); ?></option>
|
287 |
+
<?php elseif ( in_array( $field->field_type, array( 'number' ) ) ) : ?>
|
288 |
+
<option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php esc_html_e( 'Number', 'visual-form-builder' ); ?></option>
|
289 |
+
<option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php esc_html_e( 'Digits', 'visual-form-builder' ); ?></option>
|
290 |
+
<?php else : ?>
|
291 |
+
<option value="" <?php selected( $field->field_validation, '' ); ?>><?php esc_html_e( 'None', 'visual-form-builder' ); ?></option>
|
292 |
+
<option value="email" <?php selected( $field->field_validation, 'email' ); ?>><?php esc_html_e( 'Email', 'visual-form-builder' ); ?></option>
|
293 |
+
<option value="url" <?php selected( $field->field_validation, 'url' ); ?>><?php esc_html_e( 'URL', 'visual-form-builder' ); ?></option>
|
294 |
+
<option value="date" <?php selected( $field->field_validation, 'date' ); ?>><?php esc_html_e( 'Date', 'visual-form-builder' ); ?></option>
|
295 |
+
<option value="number" <?php selected( $field->field_validation, 'number' ); ?>><?php esc_html_e( 'Number', 'visual-form-builder' ); ?></option>
|
296 |
+
<option value="digits" <?php selected( $field->field_validation, 'digits' ); ?>><?php esc_html_e( 'Digits', 'visual-form-builder' ); ?></option>
|
297 |
+
<option value="phone" <?php selected( $field->field_validation, 'phone' ); ?>><?php esc_html_e( 'Phone', 'visual-form-builder' ); ?></option>
|
298 |
+
<?php endif; ?>
|
299 |
+
</select>
|
300 |
+
<?php
|
301 |
+
else :
|
302 |
+
$field_validation = '';
|
303 |
+
|
304 |
+
switch ( $field->field_type ) {
|
305 |
+
case 'email':
|
306 |
+
case 'url':
|
307 |
+
case 'phone':
|
308 |
+
$field_validation = $field->field_type;
|
309 |
break;
|
310 |
|
311 |
+
case 'currency':
|
312 |
+
$field_validation = 'number';
|
313 |
break;
|
314 |
|
315 |
+
case 'number':
|
316 |
+
$field_validation = 'digits';
|
317 |
break;
|
318 |
+
}
|
319 |
+
?>
|
320 |
+
<input type="text" class="widefat" name="field_validation-<?php echo esc_attr( $field->field_id ); ?>" value="<?php echo esc_html( $field_validation ); ?>" readonly="readonly" />
|
321 |
+
<?php endif; ?>
|
322 |
|
323 |
+
</label>
|
324 |
+
</p>
|
|
|
325 |
|
326 |
+
<!-- Required -->
|
327 |
+
<p class="field-link-target description description-thin">
|
328 |
+
<label for="edit-form-item-required">
|
329 |
+
<?php esc_html_e( 'Required', 'visual-form-builder' ); ?>
|
330 |
+
<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>
|
331 |
+
<br />
|
332 |
+
<select name="field_required-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-required-<?php echo esc_attr( $field->field_id ); ?>">
|
333 |
+
<option value="no" <?php selected( esc_attr( $field->field_required ), 'no' ); ?>><?php esc_html_e( 'No', 'visual-form-builder' ); ?></option>
|
334 |
+
<option value="yes" <?php selected( esc_attr( $field->field_required ), 'yes' ); ?>><?php esc_html_e( 'Yes', 'visual-form-builder' ); ?></option>
|
335 |
+
</select>
|
336 |
+
</label>
|
337 |
+
</p>
|
338 |
+
|
339 |
+
<?php if ( ! in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
|
340 |
+
<!-- Size -->
|
341 |
+
<p class="description description-thin">
|
342 |
+
<label for="edit-form-item-size">
|
343 |
+
<?php esc_html_e( 'Size', 'visual-form-builder' ); ?>
|
344 |
+
<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>
|
345 |
+
<br />
|
346 |
+
<select name="field_size-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-size-<?php echo esc_attr( $field->field_id ); ?>">
|
347 |
+
<option value="small" <?php selected( $field->field_size, 'small' ); ?>><?php esc_html_e( 'Small', 'visual-form-builder' ); ?></option>
|
348 |
+
<option value="medium" <?php selected( $field->field_size, 'medium' ); ?>><?php esc_html_e( 'Medium', 'visual-form-builder' ); ?></option>
|
349 |
+
<option value="large" <?php selected( $field->field_size, 'large' ); ?>><?php esc_html_e( 'Large', 'visual-form-builder' ); ?></option>
|
350 |
+
</select>
|
351 |
</label>
|
352 |
</p>
|
353 |
|
354 |
+
<?php elseif ( in_array( $field->field_type, array( 'radio', 'checkbox', 'time' ) ) ) : ?>
|
355 |
+
<!-- Options Layout -->
|
356 |
+
<p class="description description-thin">
|
357 |
+
<label for="edit-form-item-size">
|
358 |
+
<?php esc_html_e( 'Options Layout', 'visual-form-builder' ); ?>
|
359 |
+
<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>
|
360 |
+
<br />
|
361 |
+
<select name="field_size-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-size-<?php echo esc_attr( $field->field_id ); ?>"<?php echo ( 'time' === $field->field_type ) ? ' disabled="disabled"' : ''; ?>>
|
362 |
+
<option value="" <?php selected( $field->field_size, '' ); ?>><?php esc_html_e( 'One Column', 'visual-form-builder' ); ?></option>
|
363 |
+
<option value="two-column" <?php selected( $field->field_size, 'two-column' ); ?>><?php esc_html_e( 'Two Columns', 'visual-form-builder' ); ?></option>
|
364 |
+
<option value="three-column" <?php selected( $field->field_size, 'three-column' ); ?>><?php esc_html_e( 'Three Columns', 'visual-form-builder' ); ?></option>
|
365 |
+
<option value="auto-column" <?php selected( $field->field_size, 'auto-column' ); ?>><?php esc_html_e( 'Auto Width', 'visual-form-builder' ); ?></option>
|
366 |
</select>
|
367 |
</label>
|
368 |
</p>
|
369 |
|
370 |
+
<?php endif; ?>
|
371 |
+
<!-- Field Layout -->
|
372 |
+
<p class="description description-thin">
|
373 |
+
<label for="edit-form-item-layout">
|
374 |
+
<?php esc_html_e( 'Field Layout', 'visual-form-builder' ); ?>
|
375 |
+
<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>
|
376 |
+
<br />
|
377 |
+
<select name="field_layout-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-layout-<?php echo esc_attr( $field->field_id ); ?>">
|
378 |
+
<option value="" <?php selected( $field->field_layout, '' ); ?>><?php esc_html_e( 'Default', 'visual-form-builder' ); ?></option>
|
379 |
+
<optgroup label="------------">
|
380 |
+
<option value="left-half" <?php selected( $field->field_layout, 'left-half' ); ?>><?php esc_html_e( 'Left Half', 'visual-form-builder' ); ?></option>
|
381 |
+
<option value="right-half" <?php selected( $field->field_layout, 'right-half' ); ?>><?php esc_html_e( 'Right Half', 'visual-form-builder' ); ?></option>
|
382 |
+
</optgroup>
|
383 |
+
<optgroup label="------------">
|
384 |
+
<option value="left-third" <?php selected( $field->field_layout, 'left-third' ); ?>><?php esc_html_e( 'Left Third', 'visual-form-builder' ); ?></option>
|
385 |
+
<option value="middle-third" <?php selected( $field->field_layout, 'middle-third' ); ?>><?php esc_html_e( 'Middle Third', 'visual-form-builder' ); ?></option>
|
386 |
+
<option value="right-third" <?php selected( $field->field_layout, 'right-third' ); ?>><?php esc_html_e( 'Right Third', 'visual-form-builder' ); ?></option>
|
387 |
+
</optgroup>
|
388 |
+
<optgroup label="------------">
|
389 |
+
<option value="left-two-thirds" <?php selected( $field->field_layout, 'left-two-thirds' ); ?>><?php esc_html_e( 'Left Two Thirds', 'visual-form-builder' ); ?></option>
|
390 |
+
<option value="right-two-thirds" <?php selected( $field->field_layout, 'right-two-thirds' ); ?>><?php esc_html_e( 'Right Two Thirds', 'visual-form-builder' ); ?></option>
|
391 |
+
</optgroup>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
</select>
|
393 |
+
</label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
</p>
|
395 |
+
<?php if ( ! in_array( $field->field_type, array( 'radio', 'select', 'checkbox', 'time', 'address' ) ) ) : ?>
|
396 |
+
<!-- Default Value -->
|
397 |
+
<p class="description description-wide">
|
398 |
+
<label for="edit-form-item-default-<?php echo esc_attr( $field->field_id ); ?>">
|
399 |
+
<?php esc_html_e( 'Default Value', 'visual-form-builder' ); ?>
|
400 |
+
<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>
|
401 |
+
<br />
|
402 |
+
<input type="text" value="<?php echo esc_html( $field->field_default ); ?>" name="field_default-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-default-<?php echo esc_attr( $field->field_id ); ?>" maxlength="255" />
|
403 |
+
</label>
|
404 |
+
</p>
|
405 |
+
<?php elseif ( in_array( $field->field_type, array( 'address' ) ) ) : ?>
|
406 |
+
<!-- Default Country -->
|
407 |
+
<p class="description description-wide">
|
408 |
+
<label for="edit-form-item-default-<?php echo esc_attr( $field->field_id ); ?>">
|
409 |
+
<?php esc_html_e( 'Default Country', 'visual-form-builder' ); ?>
|
410 |
+
<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>
|
411 |
+
<br />
|
412 |
+
<select name="field_default-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-default-<?php echo esc_attr( $field->field_id ); ?>">
|
413 |
+
<?php
|
414 |
+
$countries = include VFB_WP_PLUGIN_DIR . '/inc/countries.php';
|
415 |
+
foreach ( $countries as $country ) {
|
416 |
+
printf(
|
417 |
+
'<option value="%1$s"%2$s>%1$s</option>',
|
418 |
+
esc_attr( $country ),
|
419 |
+
selected( esc_html( $field->field_default ), $country, 0 )
|
420 |
+
);
|
421 |
+
}
|
422 |
+
?>
|
423 |
+
</select>
|
424 |
+
</label>
|
425 |
+
</p>
|
426 |
<?php endif; ?>
|
427 |
+
<!-- CSS Classes -->
|
428 |
+
<p class="description description-wide">
|
429 |
+
<label for="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>">
|
430 |
+
<?php esc_html_e( 'CSS Classes', 'visual-form-builder' ); ?>
|
431 |
+
<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>
|
432 |
+
<br />
|
433 |
+
<input type="text" value="<?php echo esc_html( $field->field_css ); ?>" name="field_css-<?php echo esc_attr( $field->field_id ); ?>" class="widefat" id="edit-form-item-css-<?php echo esc_attr( $field->field_id ); ?>" maxlength="255" />
|
434 |
+
</label>
|
435 |
+
</p>
|
436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
<?php endif; ?>
|
438 |
+
<?php endif; ?>
|
439 |
+
|
440 |
+
<?php if ( ! in_array( $field->field_type, array( 'verification', 'secret', 'submit' ) ) ) : ?>
|
441 |
+
<!-- Delete link -->
|
442 |
+
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder&action=delete_field&form=' . $form_nav_selected_id . '&field=' . $field->field_id ), 'delete-field-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-delete item-delete submitdelete deletion">
|
443 |
+
<?php esc_html_e( 'Delete', 'visual-form-builder' ); ?>
|
444 |
+
<span class="vfb-interface-icon vfb-interface-trash"></span>
|
445 |
+
</a>
|
446 |
+
<?php endif; ?>
|
447 |
+
|
448 |
+
<input type="hidden" name="field_id[<?php echo esc_attr( $field->field_id ); ?>]" value="<?php echo esc_html( $field->field_id ); ?>" />
|
449 |
+
</div>
|
450 |
+
<?php
|
451 |
+
endforeach;
|
452 |
|
453 |
+
// This assures all of the <ul> and <li> are closed.
|
|
|
|
|
|
|
|
|
|
|
454 |
if ( $depth > 1 ) {
|
455 |
+
while ( $depth > 1 ) {
|
456 |
+
echo '</li></ul>';
|
|
|
457 |
$depth--;
|
458 |
}
|
459 |
}
|
460 |
|
461 |
+
// Close out last item.
|
462 |
echo '</li>';
|
463 |
echo ob_get_clean();
|
464 |
}
|
admin/class-forms-edit.php
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that controls the Edit Form view
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Forms_Edit {
|
7 |
/**
|
8 |
-
*
|
9 |
*
|
10 |
* @access public
|
11 |
* @return void
|
@@ -13,500 +12,494 @@ class Visual_Form_Builder_Forms_Edit {
|
|
13 |
public function display() {
|
14 |
global $wpdb;
|
15 |
|
16 |
-
check_admin_referer( 'vfb_edit_form' );
|
17 |
-
|
18 |
$current_user = wp_get_current_user();
|
19 |
|
20 |
-
// Save current user ID
|
21 |
$user_id = $current_user instanceof WP_User ? $current_user->ID : 1;
|
22 |
|
23 |
-
// Set variables depending on which tab is selected
|
24 |
-
$form_nav_selected_id = isset( $_GET['form'] ) ? $_GET['form'] : '0';
|
25 |
|
26 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
27 |
-
$form
|
28 |
|
29 |
-
if (
|
30 |
wp_die( 'You must select a form' );
|
31 |
-
|
32 |
-
|
33 |
-
$
|
34 |
-
$
|
35 |
-
$
|
36 |
-
$
|
37 |
-
$
|
38 |
-
$
|
39 |
-
$
|
40 |
-
$
|
41 |
-
$
|
42 |
-
$
|
43 |
-
$
|
44 |
-
$
|
45 |
-
$
|
46 |
-
$
|
47 |
-
$
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
57 |
|
58 |
$screen = get_current_screen();
|
59 |
$class = 'columns-' . get_current_screen()->get_columns();
|
60 |
?>
|
61 |
-
|
62 |
-
|
63 |
<?php
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
echo '<span class="subtitle">' . sprintf(
|
|
|
76 |
|
77 |
-
|
78 |
?>
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
$this->standard_fields();
|
99 |
-
?>
|
100 |
-
</form>
|
101 |
-
</div> <!-- .vfb-accordion-section-content -->
|
102 |
-
</li>
|
103 |
-
<li class="vfb-control-section vfb-accordion-section">
|
104 |
-
<h3 class="vfb-accordion-section-title">
|
105 |
-
<?php _e( 'Shortcode', 'visual-form-builder' ); ?>
|
106 |
-
</h3>
|
107 |
-
<div class="vfb-accordion-section-content">
|
108 |
-
<p><?php _e( 'Add forms to your Posts or Pages by locating the <strong>Add Form</strong> button in the area above your post/page editor.', 'visual-form-builder' ); ?></p>
|
109 |
-
<p>
|
110 |
-
<?php _e( 'Shortcode', 'visual-form-builder' ); ?>
|
111 |
-
<input value="[vfb id=<?php echo $form_nav_selected_id; ?>]" readonly="readonly" />
|
112 |
-
</p>
|
113 |
-
</div> <!-- .vfb-accordion-section-content -->
|
114 |
-
</li>
|
115 |
-
</ul>
|
116 |
-
</div> <!-- .vfb-accordion-container -->
|
117 |
-
</div> <!-- .meta-box-sortables -->
|
118 |
-
</div> <!-- .vfb-postbox-container -->
|
119 |
-
|
120 |
-
<div id="vfb-postbox-container-2" class='vfb-postbox-container'>
|
121 |
-
<div id="vfb-form-builder-main">
|
122 |
-
<div id="vfb-form-builder-management">
|
123 |
-
<div class="form-edit">
|
124 |
-
<form method="post" id="visual-form-builder-update" action="">
|
125 |
-
<input name="action" type="hidden" value="update_form" />
|
126 |
-
<input name="form_id" type="hidden" value="<?php echo $form_nav_selected_id; ?>" />
|
127 |
-
<?php wp_nonce_field( 'vfb_update_form' ); ?>
|
128 |
-
<div id="form-editor-header">
|
129 |
-
<div id="submitpost" class="submitbox">
|
130 |
-
<div class="vfb-major-publishing-actions">
|
131 |
-
<label for="form-name" class="menu-name-label howto open-label">
|
132 |
-
<span class="sender-labels"><?php _e( 'Form Name' , 'visual-form-builder'); ?></span>
|
133 |
-
<input type="text" value="<?php echo ( isset( $form_title ) ) ? $form_title : ''; ?>" placeholder="<?php _e( 'Enter form name here' , 'visual-form-builder'); ?>" class="menu-name regular-text menu-item-textbox required" id="form-name" name="form_title" />
|
134 |
-
</label>
|
135 |
-
<br class="clear" />
|
136 |
-
|
137 |
-
<?php
|
138 |
-
// Get the Form Setting drop down and accordion settings, if any
|
139 |
-
$user_form_settings = get_user_meta( $user_id, 'vfb-form-settings' );
|
140 |
-
|
141 |
-
// Setup defaults for the Form Setting tab and accordion
|
142 |
-
$settings_tab = 'closed';
|
143 |
-
$settings_accordion = 'general-settings';
|
144 |
-
|
145 |
-
// Loop through the user_meta array
|
146 |
-
foreach( $user_form_settings as $set ) :
|
147 |
-
// If form settings exist for this form, use them instead of the defaults
|
148 |
-
if ( isset( $set[ $form_id ] ) ) :
|
149 |
-
$settings_tab = $set[ $form_id ]['form_setting_tab'];
|
150 |
-
$settings_accordion = $set[ $form_id ]['setting_accordion'];
|
151 |
-
endif;
|
152 |
-
endforeach;
|
153 |
-
|
154 |
-
// If tab is opened, set current class
|
155 |
-
$opened_tab = ( $settings_tab == 'opened' ) ? 'current' : '';
|
156 |
-
?>
|
157 |
-
|
158 |
-
|
159 |
-
<div class="vfb-button-group">
|
160 |
-
<a href="#form-settings" id="form-settings-button" class="vfb-button vfb-settings <?php echo $opened_tab; ?>">
|
161 |
-
<?php _e( 'Settings' , 'visual-form-builder'); ?>
|
162 |
-
<span class="vfb-interface-icon vfb-interface-settings"></span>
|
163 |
-
</a>
|
164 |
-
<a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=visual-form-builder&action=copy_form&form=' . $form_nav_selected_id ), 'copy-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-duplicate">
|
165 |
-
<?php _e( 'Duplicate' , 'visual-form-builder'); ?>
|
166 |
-
<span class="vfb-interface-icon vfb-interface-duplicate"></span>
|
167 |
-
</a>
|
168 |
-
<a href="<?php echo esc_url( wp_nonce_url( admin_url('admin.php?page=visual-form-builder&action=delete_form&form=' . $form_nav_selected_id ), 'delete-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-delete vfb-last menu-delete">
|
169 |
-
<?php _e( 'Delete' , 'visual-form-builder'); ?>
|
170 |
-
<span class="vfb-interface-icon vfb-interface-trash"></span>
|
171 |
-
</a>
|
172 |
-
|
173 |
-
<?php submit_button( __( 'Save', 'visual-form-builder' ), 'primary', 'save_form', false ); ?>
|
174 |
-
</div>
|
175 |
-
|
176 |
-
<div id="form-settings" class="<?php echo $opened_tab; ?>">
|
177 |
-
<!-- General settings section -->
|
178 |
-
<a href="#general-settings" class="settings-links<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>"><?php _e( 'General', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
|
179 |
-
<div id="general-settings" class="form-details<?php echo ( $settings_accordion == 'general-settings' ) ? ' on' : ''; ?>">
|
180 |
-
<!-- Label Alignment -->
|
181 |
-
<p class="description description-wide">
|
182 |
-
<label for="form-label-alignment">
|
183 |
-
<?php _e( 'Label Alignment' , 'visual-form-builder'); ?>
|
184 |
-
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Label Alignment', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set the field labels for this form to be aligned either on top, to the left, or to the right. By default, all labels are aligned on top of the inputs.' ); ?>">(?)</span>
|
185 |
-
<br />
|
186 |
-
</label>
|
187 |
-
<select name="form_label_alignment" id="form-label-alignment" class="widefat">
|
188 |
-
<option value="" <?php selected( $form_label_alignment, '' ); ?>><?php _e( 'Top Aligned' , 'visual-form-builder'); ?></option>
|
189 |
-
<option value="left-label" <?php selected( $form_label_alignment, 'left-label' ); ?>><?php _e( 'Left Aligned' , 'visual-form-builder'); ?></option>
|
190 |
-
<option value="right-label" <?php selected( $form_label_alignment, 'right-label' ); ?>><?php _e( 'Right Aligned' , 'visual-form-builder'); ?></option>
|
191 |
-
</select>
|
192 |
-
</p>
|
193 |
-
<br class="clear" />
|
194 |
-
</div> <!-- #general-settings -->
|
195 |
-
|
196 |
-
|
197 |
-
<!-- Email section -->
|
198 |
-
<a href="#email-details" class="settings-links<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>"><?php _e( 'Email', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
|
199 |
-
<div id="email-details" class="form-details<?php echo ( $settings_accordion == 'email-details' ) ? ' on' : ''; ?>">
|
200 |
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
|
|
|
|
|
|
210 |
</label>
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
<br />
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
<
|
224 |
-
<
|
225 |
-
<?php _e( "User's Name (optional)" , 'visual-form-builder'); ?>
|
226 |
-
<span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Name", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required text field from your form to use as the From display name in the email.', 'visual-form-builder' ); ?>">(?)</span>
|
227 |
-
<br />
|
228 |
-
<?php if ( empty( $senders ) ) : ?>
|
229 |
-
<span><?php _e( 'No required text fields detected', 'visual-form-builder' ); ?></span>
|
230 |
-
<?php else : ?>
|
231 |
-
<select name="form_email_from_name_override" id="form_email_from_name_override" class="widefat">
|
232 |
-
<option value="" <?php selected( $form_email_from_name_override, '' ); ?>></option>
|
233 |
<?php
|
234 |
-
foreach( $senders as $sender ) {
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
240 |
}
|
241 |
?>
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
<br />
|
254 |
-
<input type="text" value="<?php echo $form_email_from; ?>" class="widefat" id="form-email-sender" name="form_email_from"<?php echo ( $form_email_from_override != '' ) ? ' readonly="readonly"' : ''; ?> />
|
255 |
-
</label>
|
256 |
-
</p>
|
257 |
-
<p class="description description-thin">
|
258 |
-
<label for="form_email_from_override">
|
259 |
-
<?php _e( "User's E-mail (optional)" , 'visual-form-builder'); ?>
|
260 |
-
<span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Email", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to use as the Reply-To email.', 'visual-form-builder' ); ?>">(?)</span>
|
261 |
-
<br />
|
262 |
<?php if ( empty( $emails ) ) : ?>
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
<?php
|
268 |
-
foreach( $emails as $email ) {
|
269 |
-
echo sprintf(
|
270 |
-
$
|
|
|
271 |
selected( $form_email_from_override, $email->field_id, 0 ),
|
272 |
-
|
273 |
);
|
274 |
}
|
275 |
?>
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
|
282 |
-
|
283 |
<?php
|
284 |
-
|
285 |
-
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
<?php
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
$count++;
|
311 |
-
|
312 |
?>
|
313 |
-
|
314 |
-
|
315 |
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
<?php
|
335 |
$default_text = '';
|
336 |
|
337 |
-
|
338 |
-
if ( $form_success_message
|
339 |
-
$default_text = sprintf( '<p id="form_success">%s</p>',
|
|
|
340 |
?>
|
341 |
-
|
342 |
|
343 |
<?php
|
344 |
-
|
345 |
-
wp_dropdown_pages(
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
|
|
|
|
352 |
?>
|
353 |
-
|
354 |
-
|
355 |
<br class="clear" />
|
|
|
356 |
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
<
|
361 |
-
<
|
362 |
-
<
|
363 |
-
|
364 |
-
|
365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
</label>
|
|
|
367 |
<br class="clear" />
|
368 |
-
<
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
<
|
379 |
-
|
380 |
-
<?php
|
381 |
-
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Reply-To Email', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Manually set the email address that users will reply to.', 'visual-form-builder' ); ?>">(?)</span>
|
382 |
<br />
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
<label for="form-notification-email">
|
389 |
-
<?php _e( 'E-mail To' , 'visual-form-builder'); ?>
|
390 |
-
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail To', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to send the notification email to.', 'visual-form-builder' ); ?>">(?)</span>
|
391 |
-
<br />
|
392 |
-
<?php if ( empty( $emails ) ) : ?>
|
393 |
-
<span><?php _e( 'No required email fields detected', 'visual-form-builder' ); ?></span>
|
394 |
-
<?php else : ?>
|
395 |
-
<select name="form_notification_email" id="form-notification-email" class="widefat">
|
396 |
-
<option value="" <?php selected( $form_notification_email, '' ); ?>></option>
|
397 |
<?php
|
398 |
-
foreach( $emails as $email ) {
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
|
|
404 |
}
|
405 |
?>
|
406 |
-
|
407 |
-
|
408 |
-
</label>
|
409 |
-
</p>
|
410 |
-
<br class="clear" />
|
411 |
-
<p class="description description-wide">
|
412 |
-
<label for="form-notification-subject">
|
413 |
-
<?php _e( 'E-mail Subject' , 'visual-form-builder'); ?>
|
414 |
-
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail Subject', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the subject of the email that is sent to the emails you have set in the E-mail To field.', 'visual-form-builder' ); ?>">(?)</span>
|
415 |
-
<br />
|
416 |
-
<input type="text" value="<?php echo $form_notification_subject; ?>" class="widefat" id="form-notification-subject" name="form_notification_subject" />
|
417 |
</label>
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
|
|
423 |
<br />
|
424 |
-
<
|
425 |
-
</p>
|
426 |
-
<br class="clear" />
|
427 |
-
<label for="form-notification-entry">
|
428 |
-
<input type="checkbox" value="1" id="form-notification-entry" class="form-notification" name="form_notification_entry" <?php checked( $form_notification_entry, '1' ); ?> style="margin-top:-1px;margin-left:0;"/>
|
429 |
-
<?php _e( "Include a Copy of the User's Entry" , 'visual-form-builder'); ?>
|
430 |
</label>
|
|
|
431 |
<br class="clear" />
|
432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
</div>
|
434 |
</div>
|
435 |
</div>
|
436 |
</div>
|
437 |
</div>
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
|
|
443 |
<?php echo $this->edit_field( $form_nav_selected_id ); ?>
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
</div> <!-- vfb-form-builder-main -->
|
460 |
-
</div> <!-- .vfb-postbox-container -->
|
461 |
-
</div> <!-- #vfb-form-builder-frame -->
|
462 |
-
</div> <!-- .wrap -->
|
463 |
-
<?php
|
464 |
-
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
465 |
-
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
466 |
}
|
467 |
|
468 |
/**
|
469 |
* [form_items description]
|
470 |
-
*
|
|
|
471 |
*/
|
472 |
public function standard_fields() {
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
}
|
503 |
|
504 |
/**
|
505 |
* A wrapper function to output the Edit Field box
|
506 |
*
|
507 |
-
* @
|
508 |
-
*
|
509 |
-
* @return
|
510 |
*/
|
511 |
public function edit_field( $id ) {
|
512 |
$field = new Visual_Form_Builder_Admin_Fields();
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that controls the Edit Form view
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Forms_Edit {
|
6 |
/**
|
7 |
+
* Display function.
|
8 |
*
|
9 |
* @access public
|
10 |
* @return void
|
12 |
public function display() {
|
13 |
global $wpdb;
|
14 |
|
|
|
|
|
15 |
$current_user = wp_get_current_user();
|
16 |
|
17 |
+
// Save current user ID.
|
18 |
$user_id = $current_user instanceof WP_User ? $current_user->ID : 1;
|
19 |
|
20 |
+
// Set variables depending on which tab is selected.
|
21 |
+
$form_nav_selected_id = isset( $_GET['form'] ) ? sanitize_text_field( wp_unslash( $_GET['form'] ) ) : '0';
|
22 |
|
23 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
24 |
+
$form = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FORMS_TABLE_NAME . " WHERE form_id = %d ORDER BY $order", $form_nav_selected_id ) );
|
25 |
|
26 |
+
if ( ! $form || $form->form_id !== $form_nav_selected_id ) {
|
27 |
wp_die( 'You must select a form' );
|
28 |
+
}
|
29 |
+
|
30 |
+
$form_id = $form->form_id;
|
31 |
+
$form_title = esc_html( $form->form_title );
|
32 |
+
$form_subject = esc_html( $form->form_email_subject );
|
33 |
+
$form_email_from_name = esc_html( $form->form_email_from_name );
|
34 |
+
$form_email_from = esc_html( $form->form_email_from );
|
35 |
+
$form_email_from_override = esc_html( $form->form_email_from_override );
|
36 |
+
$form_email_from_name_override = wp_unslash( $form->form_email_from_name_override );
|
37 |
+
$form_email_to = is_array( unserialize( $form->form_email_to ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) );
|
38 |
+
$form_success_type = wp_unslash( $form->form_success_type );
|
39 |
+
$form_success_message = wp_unslash( $form->form_success_message );
|
40 |
+
$form_notification_setting = wp_unslash( $form->form_notification_setting );
|
41 |
+
$form_notification_email_name = wp_unslash( $form->form_notification_email_name );
|
42 |
+
$form_notification_email_from = wp_unslash( $form->form_notification_email_from );
|
43 |
+
$form_notification_email = wp_unslash( $form->form_notification_email );
|
44 |
+
$form_notification_subject = wp_unslash( $form->form_notification_subject );
|
45 |
+
$form_notification_message = wp_unslash( $form->form_notification_message );
|
46 |
+
$form_notification_entry = wp_unslash( $form->form_notification_entry );
|
47 |
+
|
48 |
+
$form_label_alignment = wp_unslash( $form->form_label_alignment );
|
49 |
+
|
50 |
+
// Only show required text fields for the sender name override.
|
51 |
+
$senders = $wpdb->get_results( $wpdb->prepare( 'SELECT field_id, field_name FROM ' . VFB_WP_FIELDS_TABLE_NAME . " WHERE form_id = %d AND field_type IN( 'text', 'name' ) AND field_validation = '' AND field_required = 'yes'", $form_nav_selected_id ) );
|
52 |
+
|
53 |
+
// Only show required email fields for the email override.
|
54 |
+
$emails = $wpdb->get_results( $wpdb->prepare( 'SELECT field_id, field_name FROM ' . VFB_WP_FIELDS_TABLE_NAME . " WHERE (form_id = %d AND field_type='text' AND field_validation = 'email' AND field_required = 'yes') OR (form_id = %d AND field_type='email' AND field_validation = 'email' AND field_required = 'yes')", $form_nav_selected_id, $form_nav_selected_id ) );
|
55 |
|
56 |
$screen = get_current_screen();
|
57 |
$class = 'columns-' . get_current_screen()->get_columns();
|
58 |
?>
|
59 |
+
<div class="wrap">
|
60 |
+
<h1>
|
61 |
<?php
|
62 |
+
esc_html_e( 'Visual Form Builder', 'visual-form-builder' );
|
63 |
|
64 |
+
// Add New link.
|
65 |
+
printf(
|
66 |
+
' <a href="%1$s" class="page-title-action">%2$s</a>',
|
67 |
+
esc_url( admin_url( 'admin.php?page=vfb-add-new' ) ),
|
68 |
+
esc_html__( 'Add New', 'visual-form-builder' )
|
69 |
+
);
|
70 |
|
71 |
+
// If searched, output the query.
|
72 |
+
if ( isset( $_POST['s'] ) && ! empty( $_POST['s'] ) ) {
|
73 |
+
echo '<span class="subtitle">' . sprintf( esc_html__( 'Search results for "%s"', 'visual-form-builder' ), esc_html( sanitize_text_field( wp_unslash( $_POST['s'] ) ) ) );
|
74 |
+
}
|
75 |
|
76 |
+
$form_nav_selected_id = isset( $_GET['form'] ) ? absint( $_GET['form'] ) : '0';
|
77 |
?>
|
78 |
+
</h1>
|
79 |
+
<div id="vfb-form-builder-frame" class="metabox-holder <?php echo esc_attr( $class ); ?>">
|
80 |
+
<div id="vfb-postbox-container-1" class='vfb-postbox-container'>
|
81 |
+
<div id="side-sortables" class="meta-box-sortables">
|
82 |
+
<div class="vfb-accordion-container">
|
83 |
+
<ul class="outer-border">
|
84 |
+
<li class="vfb-control-section vfb-accordion-section open">
|
85 |
+
<h3 class="vfb-accordion-section-title">
|
86 |
+
<?php esc_html_e( 'Fields', 'visual-form-builder' ); ?>
|
87 |
+
</h3>
|
88 |
+
<div class="vfb-accordion-section-content">
|
89 |
+
<p><?php esc_html_e( 'Click to add fields', 'visual-form-builder' ); ?><span class="spinner"></span></p>
|
90 |
+
|
91 |
+
<form id="vfb-form-items" method="post" action="">
|
92 |
+
<input name="action" type="hidden" value="create_field" />
|
93 |
+
<input name="form_id" type="hidden" value="<?php echo esc_attr( $form_nav_selected_id ); ?>" />
|
94 |
+
<?php
|
95 |
+
wp_nonce_field( 'create-field-' . $form_nav_selected_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
+
$this->standard_fields();
|
98 |
+
?>
|
99 |
+
</form>
|
100 |
+
</div> <!-- .vfb-accordion-section-content -->
|
101 |
+
</li>
|
102 |
+
<li class="vfb-control-section vfb-accordion-section">
|
103 |
+
<h3 class="vfb-accordion-section-title">
|
104 |
+
<?php esc_html_e( 'Shortcode', 'visual-form-builder' ); ?>
|
105 |
+
</h3>
|
106 |
+
<div class="vfb-accordion-section-content">
|
107 |
+
<p><?php esc_html_e( 'Add forms to your Posts or Pages by locating the <strong>Add Form</strong> button in the area above your post/page editor.', 'visual-form-builder' ); ?></p>
|
108 |
+
<p>
|
109 |
+
<?php esc_html_e( 'Shortcode', 'visual-form-builder' ); ?>
|
110 |
+
<input value="[vfb id=<?php echo esc_attr( $form_nav_selected_id ); ?>]" readonly="readonly" />
|
111 |
+
</p>
|
112 |
+
</div> <!-- .vfb-accordion-section-content -->
|
113 |
+
</li>
|
114 |
+
</ul>
|
115 |
+
</div> <!-- .vfb-accordion-container -->
|
116 |
+
</div> <!-- .meta-box-sortables -->
|
117 |
+
</div> <!-- .vfb-postbox-container -->
|
118 |
+
|
119 |
+
<div id="vfb-postbox-container-2" class='vfb-postbox-container'>
|
120 |
+
<div id="vfb-form-builder-main">
|
121 |
+
<div id="vfb-form-builder-management">
|
122 |
+
<div class="form-edit">
|
123 |
+
<form method="post" id="visual-form-builder-update" action="">
|
124 |
+
<input name="action" type="hidden" value="update_form" />
|
125 |
+
<input name="form_id" type="hidden" value="<?php echo esc_attr( $form_nav_selected_id ); ?>" />
|
126 |
+
<?php wp_nonce_field( 'vfb_update_form' ); ?>
|
127 |
+
<div id="form-editor-header">
|
128 |
+
<div id="submitpost" class="submitbox">
|
129 |
+
<div class="vfb-major-publishing-actions">
|
130 |
+
<label for="form-name" class="menu-name-label howto open-label">
|
131 |
+
<span class="sender-labels"><?php esc_html_e( 'Form Name', 'visual-form-builder' ); ?></span>
|
132 |
+
<input type="text" value="<?php echo ( isset( $form_title ) ) ? esc_attr( $form_title ) : ''; ?>" placeholder="<?php esc_attr_e( 'Enter form name here', 'visual-form-builder' ); ?>" class="menu-name regular-text menu-item-textbox required" id="form-name" name="form_title" />
|
133 |
+
</label>
|
134 |
+
<br class="clear" />
|
135 |
+
|
136 |
+
<?php
|
137 |
+
// Get the Form Setting drop down and accordion settings, if any.
|
138 |
+
$user_form_settings = get_user_meta( $user_id, 'vfb-form-settings' );
|
139 |
+
|
140 |
+
// Setup defaults for the Form Setting tab and accordion.
|
141 |
+
$settings_tab = 'closed';
|
142 |
+
$settings_accordion = 'general-settings';
|
143 |
+
|
144 |
+
// Loop through the user_meta array.
|
145 |
+
foreach ( $user_form_settings as $set ) {
|
146 |
+
// If form settings exist for this form, use them instead of the defaults.
|
147 |
+
if ( isset( $set[ $form_id ] ) ) {
|
148 |
+
$settings_tab = $set[ $form_id ]['form_setting_tab'];
|
149 |
+
$settings_accordion = $set[ $form_id ]['setting_accordion'];
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
// If tab is opened, set current class.
|
154 |
+
$opened_tab = ( 'opened' === $settings_tab ) ? 'current' : '';
|
155 |
+
?>
|
156 |
+
<div class="vfb-button-group">
|
157 |
+
<a href="#form-settings" id="form-settings-button" class="vfb-button vfb-settings <?php echo esc_attr( $opened_tab ); ?>">
|
158 |
+
<?php esc_html_e( 'Settings', 'visual-form-builder' ); ?>
|
159 |
+
<span class="vfb-interface-icon vfb-interface-settings"></span>
|
160 |
+
</a>
|
161 |
+
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder&action=copy_form&form=' . $form_nav_selected_id ), 'copy-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-duplicate">
|
162 |
+
<?php esc_html_e( 'Duplicate', 'visual-form-builder' ); ?>
|
163 |
+
<span class="vfb-interface-icon vfb-interface-duplicate"></span>
|
164 |
+
</a>
|
165 |
+
<a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder&action=delete_form&form=' . $form_nav_selected_id ), 'delete-form-' . $form_nav_selected_id ) ); ?>" class="vfb-button vfb-delete vfb-last menu-delete">
|
166 |
+
<?php esc_html_e( 'Delete', 'visual-form-builder' ); ?>
|
167 |
+
<span class="vfb-interface-icon vfb-interface-trash"></span>
|
168 |
+
</a>
|
169 |
+
|
170 |
+
<?php submit_button( esc_html__( 'Save', 'visual-form-builder' ), 'primary', 'save_form', false ); ?>
|
171 |
+
</div>
|
172 |
|
173 |
+
<div id="form-settings" class="<?php echo esc_attr( $opened_tab ); ?>">
|
174 |
+
<!-- General settings section -->
|
175 |
+
<a href="#general-settings" class="settings-links<?php echo ( 'general-settings' === $settings_accordion ) ? ' on' : ''; ?>"><?php esc_html_e( 'General', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
|
176 |
+
<div id="general-settings" class="form-details<?php echo ( 'general-settings' === $settings_accordion ) ? ' on' : ''; ?>">
|
177 |
+
<!-- Label Alignment -->
|
178 |
+
<p class="description description-wide">
|
179 |
+
<label for="form-label-alignment">
|
180 |
+
<?php esc_html_e( 'Label Alignment', 'visual-form-builder' ); ?>
|
181 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Label Alignment', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Set the field labels for this form to be aligned either on top, to the left, or to the right. By default, all labels are aligned on top of the inputs.' ); ?>">(?)</span>
|
182 |
+
<br />
|
183 |
</label>
|
184 |
+
<select name="form_label_alignment" id="form-label-alignment" class="widefat">
|
185 |
+
<option value="" <?php selected( $form_label_alignment, '' ); ?>><?php esc_html_e( 'Top Aligned', 'visual-form-builder' ); ?></option>
|
186 |
+
<option value="left-label" <?php selected( $form_label_alignment, 'left-label' ); ?>><?php esc_html_e( 'Left Aligned', 'visual-form-builder' ); ?></option>
|
187 |
+
<option value="right-label" <?php selected( $form_label_alignment, 'right-label' ); ?>><?php esc_html_e( 'Right Aligned', 'visual-form-builder' ); ?></option>
|
188 |
+
</select>
|
189 |
+
</p>
|
190 |
+
<br class="clear" />
|
191 |
+
</div> <!-- #general-settings -->
|
192 |
+
<!-- Email section -->
|
193 |
+
<a href="#email-details" class="settings-links<?php echo ( 'email-details' === $settings_accordion ) ? ' on' : ''; ?>"><?php esc_html_e( 'Email', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
|
194 |
+
<div id="email-details" class="form-details<?php echo ( 'email-details' === $settings_accordion ) ? ' on' : ''; ?>">
|
195 |
+
<p><em><?php esc_html_e( 'The forms you build here will send information to one or more email addresses when submitted by a user on your site. Use the fields below to customize the details of that email.', 'visual-form-builder' ); ?></em></p>
|
196 |
+
|
197 |
+
<!-- E-mail Subject -->
|
198 |
+
<p class="description description-wide">
|
199 |
+
<label for="form-email-subject">
|
200 |
+
<?php esc_html_e( 'E-mail Subject', 'visual-form-builder' ); ?>
|
201 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail Subject', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the subject of the email that is sent to the emails you have set in the E-mail(s) To field.', 'visual-form-builder' ); ?>">(?)</span>
|
202 |
+
<br />
|
203 |
+
<input type="text" value="<?php echo esc_attr( $form_subject ); ?>" class="widefat" id="form-email-subject" name="form_email_subject" />
|
204 |
+
</label>
|
205 |
+
</p>
|
206 |
+
<br class="clear" />
|
207 |
|
208 |
+
<!-- Sender Name -->
|
209 |
+
<p class="description description-thin">
|
210 |
+
<label for="form-email-sender-name">
|
211 |
+
<?php esc_html_e( 'Your Name or Company', 'visual-form-builder' ); ?>
|
212 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Your Name or Company', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the From display name of the email that is sent to the emails you have set in the E-mail(s) To field.', 'visual-form-builder' ); ?>">(?)</span>
|
213 |
+
<br />
|
214 |
+
<input type="text" value="<?php echo esc_attr( $form_email_from_name ); ?>" class="widefat" id="form-email-sender-name" name="form_email_from_name"<?php echo ( '' !== $form_email_from_name_override ) ? ' readonly="readonly"' : ''; ?> />
|
215 |
+
</label>
|
216 |
+
</p>
|
217 |
+
<p class="description description-thin">
|
218 |
+
<label for="form_email_from_name_override">
|
219 |
+
<?php esc_html_e( "User's Name (optional)", 'visual-form-builder' ); ?>
|
220 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Name", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required text field from your form to use as the From display name in the email.', 'visual-form-builder' ); ?>">(?)</span>
|
221 |
<br />
|
222 |
+
<?php if ( empty( $senders ) ) : ?>
|
223 |
+
<span><?php esc_html_e( 'No required text fields detected', 'visual-form-builder' ); ?></span>
|
224 |
+
<?php else : ?>
|
225 |
+
<select name="form_email_from_name_override" id="form_email_from_name_override" class="widefat">
|
226 |
+
<option value="" <?php selected( $form_email_from_name_override, '' ); ?>></option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
<?php
|
228 |
+
foreach ( $senders as $sender ) {
|
229 |
+
echo sprintf(
|
230 |
+
'<option value="%1$d"%2$s>%3$s</option>',
|
231 |
+
esc_html( $sender->field_id ),
|
232 |
+
selected( $form_email_from_name_override, $sender->field_id, 0 ),
|
233 |
+
esc_html( $sender->field_name )
|
234 |
+
);
|
235 |
}
|
236 |
?>
|
237 |
+
</select>
|
238 |
+
<?php endif; ?>
|
239 |
+
</label>
|
240 |
+
</p>
|
241 |
+
<br class="clear" />
|
242 |
|
243 |
+
<!-- Sender E-mail -->
|
244 |
+
<p class="description description-thin">
|
245 |
+
<label for="form-email-sender">
|
246 |
+
<?php esc_html_e( 'Reply-To E-mail', 'visual-form-builder' ); ?>
|
247 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Reply-To Email', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Manually set the email address that users will reply to.', 'visual-form-builder' ); ?>">(?)</span>
|
248 |
+
<br />
|
249 |
+
<input type="text" value="<?php echo esc_attr( $form_email_from ); ?>" class="widefat" id="form-email-sender" name="form_email_from"<?php echo ( '' !== $form_email_from_override ) ? ' readonly="readonly"' : ''; ?> />
|
250 |
+
</label>
|
251 |
+
</p>
|
252 |
+
<p class="description description-thin">
|
253 |
+
<label for="form_email_from_override">
|
254 |
+
<?php esc_html_e( "User's E-mail (optional)", 'visual-form-builder' ); ?>
|
255 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( "About User's Email", 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to use as the Reply-To email.', 'visual-form-builder' ); ?>">(?)</span>
|
256 |
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
<?php if ( empty( $emails ) ) : ?>
|
258 |
+
<span><?php esc_html_e( 'No required email fields detected', 'visual-form-builder' ); ?></span>
|
259 |
+
<?php else : ?>
|
260 |
+
<select name="form_email_from_override" id="form_email_from_override" class="widefat">
|
261 |
+
<option value="" <?php selected( $form_email_from_override, '' ); ?>></option>
|
262 |
<?php
|
263 |
+
foreach ( $emails as $email ) {
|
264 |
+
echo sprintf(
|
265 |
+
'<option value="%1$d"%2$s>%3$s</option>',
|
266 |
+
esc_html( $email->field_id ),
|
267 |
selected( $form_email_from_override, $email->field_id, 0 ),
|
268 |
+
esc_html( $email->field_name )
|
269 |
);
|
270 |
}
|
271 |
?>
|
272 |
+
</select>
|
273 |
+
<?php endif; ?>
|
274 |
+
</label>
|
275 |
+
</p>
|
276 |
+
<br class="clear" />
|
277 |
|
278 |
+
<!-- E-mail(s) To -->
|
279 |
<?php
|
280 |
+
// Basic count to keep track of multiple options.
|
281 |
+
$count = 1;
|
282 |
|
283 |
+
// Loop through the options.
|
284 |
+
foreach ( $form_email_to as $email_to ) :
|
285 |
+
?>
|
286 |
+
<div id="clone-email-<?php echo esc_attr( $count ); ?>" class="option">
|
287 |
+
<p class="description description-wide">
|
288 |
+
<label for="form-email-to-<?php echo esc_attr( $count ); ?>" class="clonedOption">
|
289 |
+
<?php esc_html_e( 'E-mail(s) To', 'visual-form-builder' ); ?>
|
290 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail(s) To', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets single or multiple emails to send the submitted form data to. At least one email is required.', 'visual-form-builder' ); ?>">(?)</span>
|
291 |
+
<br />
|
292 |
+
<input type="email" value="<?php echo esc_html( $email_to ); ?>" name="form_email_to[]" class="widefat" id="form-email-to-<?php echo esc_attr( $count ); ?>" />
|
293 |
+
</label>
|
294 |
+
|
295 |
+
<a href="#" class="addEmail vfb-interface-icon vfb-interface-plus" title="<?php esc_attr_e( 'Add an Email', 'visua-form-builder' ); ?>">
|
296 |
+
<?php esc_html_e( 'Add', 'visual-form-builder' ); ?>
|
297 |
+
</a>
|
298 |
+
<a href="#" class="deleteEmail vfb-interface-icon vfb-interface-minus" title="<?php esc_attr_e( 'Delete Email', 'visual-form-builder' ); ?>">
|
299 |
+
<?php esc_html_e( 'Delete', 'visual-form-builder' ); ?>
|
300 |
+
</a>
|
301 |
+
|
302 |
+
</p>
|
303 |
+
<br class="clear" />
|
304 |
+
</div>
|
305 |
+
<?php
|
306 |
$count++;
|
307 |
+
endforeach;
|
308 |
?>
|
309 |
+
<div class="clear"></div>
|
310 |
+
</div>
|
311 |
|
312 |
+
<!-- Confirmation section -->
|
313 |
+
<a href="#confirmation" class="settings-links<?php echo ( 'confirmation' === $settings_accordion ) ? ' on' : ''; ?>"><?php esc_html_e( 'Confirmation', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
|
314 |
+
<div id="confirmation-message" class="form-details<?php echo ( 'confirmation' === $settings_accordion ) ? ' on' : ''; ?>">
|
315 |
+
<p><em><?php esc_html_e( "After someone submits a form, you can control what is displayed. By default, it's a message but you can send them to another WordPress Page or a custom URL.", 'visual-form-builder' ); ?></em></p>
|
316 |
+
<label for="form-success-type-text" class="menu-name-label open-label">
|
317 |
+
<input type="radio" value="text" id="form-success-type-text" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'text' ); ?> />
|
318 |
+
<span><?php esc_html_e( 'Text', 'visual-form-builder' ); ?></span>
|
319 |
+
</label>
|
320 |
+
<label for="form-success-type-page" class="menu-name-label open-label">
|
321 |
+
<input type="radio" value="page" id="form-success-type-page" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'page' ); ?>/>
|
322 |
+
<span><?php esc_html_e( 'Page', 'visual-form-builder' ); ?></span>
|
323 |
+
</label>
|
324 |
+
<label for="form-success-type-redirect" class="menu-name-label open-label">
|
325 |
+
<input type="radio" value="redirect" id="form-success-type-redirect" class="form-success-type" name="form_success_type" <?php checked( $form_success_type, 'redirect' ); ?>/>
|
326 |
+
<span><?php esc_html_e( 'Redirect', 'visual-form-builder' ); ?></span>
|
327 |
+
</label>
|
328 |
+
<br class="clear" />
|
329 |
+
<p class="description description-wide">
|
330 |
<?php
|
331 |
$default_text = '';
|
332 |
|
333 |
+
// If there's no text message, make sure there is something displayed by setting a default.
|
334 |
+
if ( empty( $form_success_message ) ) {
|
335 |
+
$default_text = sprintf( '<p id="form_success">%s</p>', esc_html__( 'Your form was successfully submitted. Thank you for contacting us.', 'visual-form-builder' ) );
|
336 |
+
}
|
337 |
?>
|
338 |
+
<textarea id="form-success-message-text" class="form-success-message<?php echo ( 'text' === $form_success_type ) ? ' active' : ''; ?>" name="form_success_message_text"><?php echo esc_html( $default_text ); ?><?php echo ( 'text' === $form_success_type ) ? esc_html( $form_success_message ) : ''; ?></textarea>
|
339 |
|
340 |
<?php
|
341 |
+
// Display all Pages.
|
342 |
+
wp_dropdown_pages(
|
343 |
+
array(
|
344 |
+
'name' => 'form_success_message_page',
|
345 |
+
'id' => 'form-success-message-page',
|
346 |
+
'class' => 'widefat',
|
347 |
+
'show_option_none' => esc_html__( 'Select a Page', 'visual-form-builder' ),
|
348 |
+
'selected' => esc_html( $form_success_message ),
|
349 |
+
)
|
350 |
+
);
|
351 |
?>
|
352 |
+
<input type="text" value="<?php echo ( 'redirect' == $form_success_type ) ? esc_attr( $form_success_message ) : ''; ?>" id="form-success-message-redirect" class="form-success-message regular-text<?php echo ( 'redirect' == $form_success_type ) ? ' active' : ''; ?>" name="form_success_message_redirect" placeholder="http://" />
|
353 |
+
</p>
|
354 |
<br class="clear" />
|
355 |
+
</div>
|
356 |
|
357 |
+
<!-- Notification section -->
|
358 |
+
<a href="#notification" class="settings-links<?php echo ( 'notification' === $settings_accordion ) ? ' on' : ''; ?>"><?php esc_html_e( 'Notification', 'visual-form-builder' ); ?><span class="vfb-large-arrow"></span></a>
|
359 |
+
<div id="notification" class="form-details<?php echo ( 'notification' === $settings_accordion ) ? ' on' : ''; ?>">
|
360 |
+
<p><em><?php esc_html_e( 'When a user submits their entry, you can send a customizable notification email.', 'visual-form-builder' ); ?></em></p>
|
361 |
+
<label for="form-notification-setting">
|
362 |
+
<input type="checkbox" value="1" id="form-notification-setting" class="form-notification" name="form_notification_setting" <?php checked( $form_notification_setting, '1' ); ?> style="margin-top:-1px;margin-left:0;"/>
|
363 |
+
<?php esc_html_e( 'Send Confirmation Email to User', 'visual-form-builder' ); ?>
|
364 |
+
</label>
|
365 |
+
<br class="clear" />
|
366 |
+
<div id="notification-email">
|
367 |
+
<p class="description description-wide">
|
368 |
+
<label for="form-notification-email-name">
|
369 |
+
<?php esc_html_e( 'Sender Name or Company', 'visual-form-builder' ); ?>
|
370 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Sender Name or Company', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Enter the name you would like to use for the email notification.', 'visual-form-builder' ); ?>">(?)</span>
|
371 |
+
<br />
|
372 |
+
<input type="text" value="<?php echo esc_attr( $form_notification_email_name ); ?>" class="widefat" id="form-notification-email-name" name="form_notification_email_name" />
|
373 |
</label>
|
374 |
+
</p>
|
375 |
<br class="clear" />
|
376 |
+
<p class="description description-wide">
|
377 |
+
<label for="form-notification-email-from">
|
378 |
+
<?php esc_html_e( 'Reply-To E-mail', 'visual-form-builder' ); ?>
|
379 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Reply-To Email', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Manually set the email address that users will reply to.', 'visual-form-builder' ); ?>">(?)</span>
|
380 |
+
<br />
|
381 |
+
<input type="text" value="<?php echo esc_attr( $form_notification_email_from ); ?>" class="widefat" id="form-notification-email-from" name="form_notification_email_from" />
|
382 |
+
</label>
|
383 |
+
</p>
|
384 |
+
<br class="clear" />
|
385 |
+
<p class="description description-wide">
|
386 |
+
<label for="form-notification-email">
|
387 |
+
<?php esc_html_e( 'E-mail To', 'visual-form-builder' ); ?>
|
388 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail To', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Select a required email field from your form to send the notification email to.', 'visual-form-builder' ); ?>">(?)</span>
|
|
|
389 |
<br />
|
390 |
+
<?php if ( empty( $emails ) ) : ?>
|
391 |
+
<span><?php esc_html_e( 'No required email fields detected', 'visual-form-builder' ); ?></span>
|
392 |
+
<?php else : ?>
|
393 |
+
<select name="form_notification_email" id="form-notification-email" class="widefat">
|
394 |
+
<option value="" <?php selected( $form_notification_email, '' ); ?>></option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
<?php
|
396 |
+
foreach ( $emails as $email ) {
|
397 |
+
echo sprintf(
|
398 |
+
'<option value="%1$d"%2$s>%3$s</option>',
|
399 |
+
esc_html( $email->field_id ),
|
400 |
+
selected( $form_notification_email, $email->field_id, 0 ),
|
401 |
+
esc_html( $email->field_name )
|
402 |
+
);
|
403 |
}
|
404 |
?>
|
405 |
+
</select>
|
406 |
+
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
</label>
|
408 |
+
</p>
|
409 |
+
<br class="clear" />
|
410 |
+
<p class="description description-wide">
|
411 |
+
<label for="form-notification-subject">
|
412 |
+
<?php esc_html_e( 'E-mail Subject', 'visual-form-builder' ); ?>
|
413 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About E-mail Subject', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'This option sets the subject of the email that is sent to the emails you have set in the E-mail To field.', 'visual-form-builder' ); ?>">(?)</span>
|
414 |
<br />
|
415 |
+
<input type="text" value="<?php echo esc_html( $form_notification_subject ); ?>" class="widefat" id="form-notification-subject" name="form_notification_subject" />
|
|
|
|
|
|
|
|
|
|
|
416 |
</label>
|
417 |
+
</p>
|
418 |
<br class="clear" />
|
419 |
+
<p class="description description-wide">
|
420 |
+
<label for="form-notification-message"><?php esc_html_e( 'Message', 'visual-form-builder' ); ?></label>
|
421 |
+
<span class="vfb-tooltip" title="<?php esc_attr_e( 'About Message', 'visual-form-builder' ); ?>" rel="<?php esc_attr_e( 'Insert a message to the user. This will be inserted into the beginning of the email body.', 'visual-form-builder' ); ?>">(?)</span>
|
422 |
+
<br />
|
423 |
+
<textarea id="form-notification-message" class="form-notification-message widefat" name="form_notification_message"><?php echo esc_html( $form_notification_message ); ?></textarea>
|
424 |
+
</p>
|
425 |
+
<br class="clear" />
|
426 |
+
<label for="form-notification-entry">
|
427 |
+
<input type="checkbox" value="1" id="form-notification-entry" class="form-notification" name="form_notification_entry" <?php checked( $form_notification_entry, '1' ); ?> style="margin-top:-1px;margin-left:0;"/>
|
428 |
+
<?php esc_html_e( "Include a Copy of the User's Entry", 'visual-form-builder' ); ?>
|
429 |
+
</label>
|
430 |
+
<br class="clear" />
|
431 |
</div>
|
432 |
</div>
|
433 |
</div>
|
434 |
</div>
|
435 |
</div>
|
436 |
+
</div>
|
437 |
+
<div id="post-body">
|
438 |
+
<div id="post-body-content">
|
439 |
+
<div id="vfb-fieldset-first-warning" class="error"><?php printf( '<p><strong>%1$s </strong><br>%2$s</p>', esc_html__( 'Warning — Missing Fieldset', 'visual-form-builder' ), esc_html__( 'Your form may not function or display correctly. Please be sure to add or move a Fieldset to the beginning of your form.', 'visual-form-builder' ) ); ?></div>
|
440 |
+
<!-- !Field Items output -->
|
441 |
+
<ul id="vfb-menu-to-edit" class="menu ui-sortable droppable">
|
442 |
<?php echo $this->edit_field( $form_nav_selected_id ); ?>
|
443 |
+
</ul>
|
444 |
+
</div>
|
445 |
+
<br class="clear" />
|
446 |
+
</div>
|
447 |
+
<br class="clear" />
|
448 |
+
</form>
|
449 |
+
</div> <!-- .form-edit -->
|
450 |
+
</div> <!-- #vfb-form-builder-management -->
|
451 |
+
</div> <!-- vfb-form-builder-main -->
|
452 |
+
</div> <!-- .vfb-postbox-container -->
|
453 |
+
</div> <!-- #vfb-form-builder-frame -->
|
454 |
+
</div> <!-- .wrap -->
|
455 |
+
<?php
|
456 |
+
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
457 |
+
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
}
|
459 |
|
460 |
/**
|
461 |
* [form_items description]
|
462 |
+
*
|
463 |
+
* @return void
|
464 |
*/
|
465 |
public function standard_fields() {
|
466 |
+
?>
|
467 |
+
<div id="vfb-standard-fields">
|
468 |
+
<ul class="vfb-fields-col-1">
|
469 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-fieldset">Fieldset</a></li>
|
470 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-text"><b></b>Text</a></li>
|
471 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-checkbox"><b></b>Checkbox</a></li>
|
472 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-select"><b></b>Select</a></li>
|
473 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-datepicker"><b></b>Date</a></li>
|
474 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-url"><b></b>URL</a></li>
|
475 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-digits"><b></b>Number</a></li>
|
476 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-phone"><b></b>Phone</a></li>
|
477 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-file"><b></b>File Upload</a></li>
|
478 |
+
</ul>
|
479 |
+
<ul class="vfb-fields-col-2">
|
480 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-section">Section</a></li>
|
481 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-textarea"><b></b>Textarea</a></li>
|
482 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-radio"><b></b>Radio</a></li>
|
483 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-address"><b></b>Address</a></li>
|
484 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-email"><b></b>Email</a></li>
|
485 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-currency"><b></b>Currency</a></li>
|
486 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-time"><b></b>Time</a></li>
|
487 |
+
|
488 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-html"><b></b>HTML</a></li>
|
489 |
+
|
490 |
+
<li><a href="#" class="vfb-draggable-form-items" id="form-element-instructions"><b></b>Instructions</a></li>
|
491 |
+
</ul>
|
492 |
+
<div class="clear"></div>
|
493 |
+
</div> <!-- #standard-fields -->
|
494 |
+
<?php
|
495 |
}
|
496 |
|
497 |
/**
|
498 |
* A wrapper function to output the Edit Field box
|
499 |
*
|
500 |
+
* @param mixed $id [$id description].
|
501 |
+
*
|
502 |
+
* @return void [return description]
|
503 |
*/
|
504 |
public function edit_field( $id ) {
|
505 |
$field = new Visual_Form_Builder_Admin_Fields();
|
admin/class-forms-list.php
CHANGED
@@ -4,39 +4,48 @@
|
|
4 |
*
|
5 |
* @since 1.2
|
6 |
*/
|
7 |
-
class Visual_Form_Builder_Forms_List extends
|
8 |
/**
|
9 |
-
*
|
10 |
*
|
11 |
-
* @var
|
12 |
* @access public
|
13 |
*/
|
14 |
public $errors;
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
global $status, $page;
|
18 |
|
19 |
-
// Set parent defaults
|
20 |
-
parent::__construct(
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
-
// Handle our bulk actions
|
27 |
$this->process_bulk_action();
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
* Display column names
|
32 |
*
|
33 |
-
* @
|
34 |
-
* @
|
|
|
|
|
35 |
*/
|
36 |
-
function column_default( $item, $column_name ){
|
37 |
switch ( $column_name ) {
|
38 |
case 'id':
|
39 |
-
case 'form_id'
|
40 |
return $item[ $column_name ];
|
41 |
}
|
42 |
}
|
@@ -44,72 +53,86 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
44 |
/**
|
45 |
* Builds the on:hover links for the Form column
|
46 |
*
|
47 |
-
* @
|
|
|
|
|
48 |
*/
|
49 |
-
function column_form_title( $item ){
|
50 |
-
|
51 |
$actions = array();
|
52 |
|
53 |
-
// Edit Form
|
54 |
-
$edit_link
|
55 |
-
$form_title
|
56 |
-
$actions['edit'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', $edit_link, 'edit', $item['form_id'],
|
57 |
|
58 |
-
// Duplicate Form
|
59 |
-
$actions['copy'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder' ), 'copy-form-' . $item['form_id'] ), 'copy_form', $item['form_id'],
|
60 |
|
61 |
-
// Delete Form
|
62 |
-
$actions['delete'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder' ), 'delete-form-' . $item['form_id'] ), 'delete_form', $item['form_id'],
|
63 |
|
64 |
return sprintf( '%1$s %2$s', $form_title, $this->row_actions( $actions ) );
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* [column_entries description]
|
69 |
-
*
|
70 |
-
* @
|
|
|
71 |
*/
|
72 |
-
function column_entries( $item ) {
|
73 |
$this->comments_bubble( $item['form_id'], $item['entries'] );
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
* [comments_bubble description]
|
78 |
-
*
|
79 |
-
* @param [type] $
|
80 |
-
* @
|
|
|
81 |
*/
|
82 |
-
function comments_bubble( $form_id, $count ) {
|
83 |
-
|
84 |
-
echo sprintf(
|
85 |
'<div class="entries-count-wrapper"><a href="%1$s" title="%2$s" class="vfb-meta-entries-total"><span class="entries-count">%4$s</span></a> %3$s</div>',
|
86 |
esc_url( add_query_arg( array( 'form-filter' => $form_id ), admin_url( 'admin.php?page=vfb-entries' ) ) ),
|
87 |
esc_attr__( 'Entries Total', 'visual-form-builder' ),
|
88 |
-
|
89 |
-
number_format_i18n( $count['total'] )
|
90 |
);
|
91 |
|
92 |
-
if ( $count['today'] )
|
93 |
echo '<strong>';
|
|
|
94 |
|
95 |
-
|
96 |
'<div class="entries-count-wrapper"><a href="%1$s" title="%2$s" class="vfb-meta-entries-total"><span class="entries-count">%4$s</span></a> %3$s</div>',
|
97 |
-
esc_url(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
esc_attr__( 'Entries Today', 'visual-form-builder' ),
|
99 |
-
|
100 |
-
number_format_i18n( $count['today'] )
|
101 |
);
|
102 |
|
103 |
-
if ( $count['today'] )
|
104 |
echo '</strong>';
|
|
|
105 |
}
|
106 |
|
107 |
/**
|
108 |
* Used for checkboxes and bulk editing
|
109 |
*
|
110 |
-
* @
|
|
|
|
|
111 |
*/
|
112 |
-
function column_cb( $item ){
|
113 |
return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['form_id'] );
|
114 |
}
|
115 |
|
@@ -118,12 +141,12 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
118 |
*
|
119 |
* @since 1.2
|
120 |
*/
|
121 |
-
function get_columns(){
|
122 |
$columns = array(
|
123 |
-
'cb'
|
124 |
-
'form_title'
|
125 |
-
'form_id'
|
126 |
-
'entries'
|
127 |
);
|
128 |
|
129 |
return $columns;
|
@@ -132,23 +155,29 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
132 |
/**
|
133 |
* A custom function to get the entries and sort them
|
134 |
*
|
135 |
-
* @
|
136 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
137 |
*/
|
138 |
-
function get_forms( $orderby = 'form_id', $order = 'ASC', $per_page, $offset = 0, $search = '' ){
|
139 |
global $wpdb;
|
140 |
|
141 |
-
// Set OFFSET for pagination
|
142 |
$offset = ( $offset > 0 ) ? "OFFSET $offset" : '';
|
143 |
|
144 |
$where = apply_filters( 'vfb_pre_get_forms', '' );
|
145 |
|
146 |
-
// If the form filter dropdown is used
|
147 |
-
if ( $this->current_filter_action() )
|
148 |
$where .= ' AND forms.form_id = ' . $this->current_filter_action();
|
|
|
149 |
|
150 |
$sql_order = sanitize_sql_orderby( "$orderby $order" );
|
151 |
-
$cols
|
152 |
|
153 |
return $cols;
|
154 |
}
|
@@ -156,27 +185,28 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
156 |
/**
|
157 |
* Build the different views for the entries screen
|
158 |
*
|
159 |
-
* @since
|
160 |
* @returns array $status_links Status links with counts
|
161 |
*/
|
162 |
-
function get_views() {
|
163 |
$status_links = array();
|
164 |
-
$num_forms
|
165 |
-
$class
|
166 |
-
$link
|
167 |
|
168 |
$stati = array(
|
169 |
-
'all'
|
170 |
);
|
171 |
|
172 |
$total_entries = (int) $num_forms->all;
|
173 |
-
$entry_status
|
174 |
|
175 |
foreach ( $stati as $status => $label ) {
|
176 |
-
$class = ( $status
|
177 |
|
178 |
-
if ( !isset( $num_forms->$status ) )
|
179 |
$num_forms->$status = 10;
|
|
|
180 |
|
181 |
$link = add_query_arg( 'form_status', $status, $link );
|
182 |
|
@@ -192,19 +222,20 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
192 |
/**
|
193 |
* Get the number of entries for use with entry statuses
|
194 |
*
|
195 |
-
* @since
|
196 |
* @returns array $stats Counts of different entry types
|
197 |
*/
|
198 |
-
function get_entries_count() {
|
199 |
global $wpdb;
|
200 |
|
201 |
$total_entries = array();
|
202 |
|
203 |
-
$entries = $wpdb->get_results(
|
204 |
|
205 |
if ( $entries ) {
|
206 |
-
foreach ( $entries as $entry )
|
207 |
$total_entries[ $entry['form_id'] ] = absint( $entry['num_entries'] );
|
|
|
208 |
|
209 |
return $total_entries;
|
210 |
}
|
@@ -215,19 +246,20 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
215 |
/**
|
216 |
* Get the number of entries for use with entry statuses
|
217 |
*
|
218 |
-
* @since
|
219 |
* @returns array $stats Counts of different entry types
|
220 |
*/
|
221 |
-
function get_entries_today_count() {
|
222 |
global $wpdb;
|
223 |
|
224 |
$total_entries = array();
|
225 |
|
226 |
-
$entries = $wpdb->get_results(
|
227 |
|
228 |
if ( $entries ) {
|
229 |
-
foreach ( $entries as $entry )
|
230 |
$total_entries[ $entry['form_id'] ] = absint( $entry['num_entries'] );
|
|
|
231 |
|
232 |
return $total_entries;
|
233 |
}
|
@@ -238,15 +270,15 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
238 |
/**
|
239 |
* Get the number of forms
|
240 |
*
|
241 |
-
* @since
|
242 |
* @returns int $count Form count
|
243 |
*/
|
244 |
-
function get_forms_count() {
|
245 |
global $wpdb;
|
246 |
|
247 |
$stats = array();
|
248 |
|
249 |
-
$count = $wpdb->get_var(
|
250 |
|
251 |
$stats['all'] = $count;
|
252 |
|
@@ -258,15 +290,15 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
258 |
/**
|
259 |
* Setup which columns are sortable. Default is by Date.
|
260 |
*
|
261 |
-
* @since
|
262 |
* @returns array() $sortable_columns Sortable columns
|
263 |
*/
|
264 |
-
function get_sortable_columns() {
|
265 |
$sortable_columns = array(
|
266 |
-
'id'
|
267 |
-
'form_id'
|
268 |
-
'form_title'
|
269 |
-
'entries'
|
270 |
);
|
271 |
|
272 |
return $sortable_columns;
|
@@ -275,14 +307,14 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
275 |
/**
|
276 |
* Define our bulk actions
|
277 |
*
|
278 |
-
* @since
|
279 |
* @returns array() $actions Bulk actions
|
280 |
*/
|
281 |
-
function get_bulk_actions() {
|
282 |
$actions = array();
|
283 |
|
284 |
-
// Build the row actions
|
285 |
-
$actions['delete'] =
|
286 |
|
287 |
return $actions;
|
288 |
}
|
@@ -292,140 +324,136 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
292 |
*
|
293 |
* @since 1.2
|
294 |
*/
|
295 |
-
function process_bulk_action() {
|
296 |
global $wpdb;
|
297 |
|
298 |
$form_id = '';
|
299 |
|
300 |
-
// Set the Entry ID array
|
301 |
if ( isset( $_POST['form'] ) ) {
|
302 |
-
if ( is_array( $_POST['form'] ) )
|
303 |
-
$form_id = $_POST['form'];
|
304 |
-
else
|
305 |
-
$form_id = (array) $_POST['form'];
|
|
|
306 |
}
|
307 |
|
308 |
-
switch( $this->current_action() ) {
|
309 |
-
case 'trash'
|
|
|
|
|
310 |
foreach ( $form_id as $id ) {
|
311 |
$id = absint( $id );
|
312 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, array( 'form_approved' => 'trash' ), array( 'form_id' => $id ) );
|
313 |
}
|
314 |
-
|
|
|
|
|
|
|
315 |
|
316 |
-
case 'delete' :
|
317 |
foreach ( $form_id as $id ) {
|
318 |
$id = absint( $id );
|
319 |
-
$wpdb->query( $wpdb->prepare(
|
320 |
-
$wpdb->query( $wpdb->prepare(
|
321 |
-
$wpdb->query( $wpdb->prepare(
|
322 |
}
|
323 |
-
|
324 |
-
|
325 |
}
|
326 |
}
|
327 |
|
328 |
/**
|
329 |
* Set our forms filter action
|
330 |
*
|
331 |
-
* @since
|
332 |
* @returns int Form ID
|
333 |
*/
|
334 |
-
function current_filter_action() {
|
335 |
-
if ( isset( $_POST['form-filter'] ) && -1 != $_POST['form-filter'] )
|
336 |
return absint( $_POST['form-filter'] );
|
|
|
337 |
|
338 |
return false;
|
339 |
}
|
340 |
|
341 |
-
/**
|
342 |
-
* Display Search box
|
343 |
-
*
|
344 |
-
* @since 1.4
|
345 |
-
* @returns html Search Form
|
346 |
-
*/
|
347 |
-
function search_box( $text, $input_id ) {
|
348 |
-
parent::search_box( $text, $input_id );
|
349 |
-
}
|
350 |
-
|
351 |
/**
|
352 |
* Prepares our data for display
|
353 |
*
|
354 |
* @since 1.2
|
355 |
*/
|
356 |
-
function prepare_items() {
|
357 |
global $wpdb;
|
358 |
|
359 |
-
// get the current user ID
|
360 |
$user = get_current_user_id();
|
361 |
|
362 |
-
// get the current admin screen
|
363 |
$screen = get_current_screen();
|
364 |
|
365 |
-
// retrieve the "per_page" option
|
366 |
$screen_option = $screen->get_option( 'per_page', 'option' );
|
367 |
|
368 |
-
// retrieve the value of the option stored for the current user
|
369 |
$per_page = get_user_meta( $user, $screen_option, true );
|
370 |
|
371 |
-
// get the default value if none is set
|
372 |
-
if ( empty
|
373 |
$per_page = 20;
|
|
|
374 |
|
375 |
-
// Get the date/time format that is saved in the options table
|
376 |
$date_format = get_option( 'date_format' );
|
377 |
$time_format = get_option( 'time_format' );
|
378 |
|
379 |
// What page are we looking at?
|
380 |
$current_page = $this->get_pagenum();
|
381 |
|
382 |
-
// Use offset for pagination
|
383 |
$offset = ( $current_page - 1 ) * $per_page;
|
384 |
|
385 |
-
// Get column headers
|
386 |
-
$columns
|
387 |
-
$hidden
|
388 |
|
389 |
-
// Get sortable columns
|
390 |
$sortable = $this->get_sortable_columns();
|
391 |
|
392 |
-
// Build the column headers
|
393 |
-
$this->_column_headers = array($columns, $hidden, $sortable);
|
394 |
|
395 |
-
// Get entries search terms
|
396 |
-
$search_terms = ( !empty( $_POST['s'] ) ) ? explode( ' ', $_POST['s'] ) : array();
|
397 |
|
398 |
$searchand = $search = '';
|
399 |
-
// Loop through search terms and build query
|
400 |
-
foreach( $search_terms as $term ) {
|
401 |
$term = esc_sql( $wpdb->esc_like( $term ) );
|
402 |
|
403 |
-
$search
|
404 |
$searchand = ' AND ';
|
405 |
}
|
406 |
|
407 |
-
$search = ( !empty($search) ) ? " AND ({$search}) " : '';
|
408 |
|
409 |
-
// Set our ORDER BY and ASC/DESC to sort the entries
|
410 |
-
$orderby
|
411 |
-
$order
|
412 |
|
413 |
-
// Get the sorted entries
|
414 |
$forms = $this->get_forms( $orderby, $order, $per_page, $offset, $search );
|
415 |
|
416 |
-
// Get entries totals
|
417 |
$entries_total = $this->get_entries_count();
|
418 |
$entries_today = $this->get_entries_today_count();
|
419 |
|
420 |
$data = array();
|
421 |
|
422 |
-
// Loop trough the entries and setup the data to be displayed for each row
|
423 |
foreach ( $forms as $form ) :
|
424 |
|
425 |
-
// Check if index exists first, not every form has entries
|
426 |
$entries_total[ $form->form_id ] = isset( $entries_total[ $form->form_id ] ) ? $entries_total[ $form->form_id ] : 0;
|
427 |
|
428 |
-
// Check if index exists first, not every form has entries today
|
429 |
$entries_today[ $form->form_id ] = isset( $entries_today[ $form->form_id ] ) ? $entries_today[ $form->form_id ] : 0;
|
430 |
|
431 |
$entries_counts = array(
|
@@ -434,114 +462,26 @@ class Visual_Form_Builder_Forms_List extends Visual_Form_Builder_List_Table {
|
|
434 |
);
|
435 |
|
436 |
$data[] = array(
|
437 |
-
'id'
|
438 |
-
'form_id'
|
439 |
-
'form_title'
|
440 |
-
'entries'
|
441 |
);
|
442 |
endforeach;
|
443 |
|
444 |
// How many forms do we have?
|
445 |
$total_items = $this->get_forms_count();
|
446 |
|
447 |
-
// Add sorted data to the items property
|
448 |
$this->items = $data;
|
449 |
|
450 |
-
// Register our pagination
|
451 |
-
$this->set_pagination_args(
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
/**
|
459 |
-
* Display the pagination.
|
460 |
-
* Customize default function to work with months and form drop down filters
|
461 |
-
*
|
462 |
-
* @since 3.1.0
|
463 |
-
* @access protected
|
464 |
-
*/
|
465 |
-
function pagination( $which ) {
|
466 |
-
|
467 |
-
if ( empty( $this->_pagination_args ) )
|
468 |
-
return;
|
469 |
-
|
470 |
-
extract( $this->_pagination_args, EXTR_SKIP );
|
471 |
-
|
472 |
-
$output = '<span class="displaying-num">' . sprintf( _n( '1 form', '%s forms', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
|
473 |
-
|
474 |
-
$current = $this->get_pagenum();
|
475 |
-
|
476 |
-
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
477 |
-
|
478 |
-
$current_url = remove_query_arg( array( 'hotkeys_highlight_last', 'hotkeys_highlight_first' ), $current_url );
|
479 |
-
|
480 |
-
$page_links = array();
|
481 |
-
|
482 |
-
// Added to pick up the months dropdown
|
483 |
-
$m = isset( $_POST['m'] ) ? (int) $_POST['m'] : 0;
|
484 |
-
|
485 |
-
$disable_first = $disable_last = '';
|
486 |
-
if ( $current == 1 )
|
487 |
-
$disable_first = ' disabled';
|
488 |
-
if ( $current == $total_pages )
|
489 |
-
$disable_last = ' disabled';
|
490 |
-
|
491 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
492 |
-
'first-page' . $disable_first,
|
493 |
-
esc_attr__( 'Go to the first page' ),
|
494 |
-
esc_url( remove_query_arg( 'paged', $current_url ) ),
|
495 |
-
'«'
|
496 |
-
);
|
497 |
-
|
498 |
-
// Modified the add_query_args to include my custom dropdowns
|
499 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
500 |
-
'prev-page' . $disable_first,
|
501 |
-
esc_attr__( 'Go to the previous page' ),
|
502 |
-
esc_url( add_query_arg( array( 'paged' => max( 1, $current-1 ), 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
503 |
-
'‹'
|
504 |
);
|
505 |
-
|
506 |
-
if ( 'bottom' == $which )
|
507 |
-
$html_current_page = $current;
|
508 |
-
else
|
509 |
-
$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
|
510 |
-
esc_attr__( 'Current page' ),
|
511 |
-
$current,
|
512 |
-
strlen( $total_pages )
|
513 |
-
);
|
514 |
-
|
515 |
-
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
|
516 |
-
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
|
517 |
-
|
518 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
519 |
-
'next-page' . $disable_last,
|
520 |
-
esc_attr__( 'Go to the next page' ),
|
521 |
-
esc_url( add_query_arg( array( 'paged' => min( $total_pages, $current+1 ), 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
522 |
-
'›'
|
523 |
-
);
|
524 |
-
|
525 |
-
// Modified the add_query_args to include my custom dropdowns
|
526 |
-
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
527 |
-
'last-page' . $disable_last,
|
528 |
-
esc_attr__( 'Go to the last page' ),
|
529 |
-
esc_url( add_query_arg( array( 'paged' => $total_pages, 'm' => $m, 'form-filter' => $this->current_filter_action() ), $current_url ) ),
|
530 |
-
'»'
|
531 |
-
);
|
532 |
-
|
533 |
-
$pagination_links_class = 'pagination-links';
|
534 |
-
if ( ! empty( $infinite_scroll ) )
|
535 |
-
$pagination_links_class = ' hide-if-js';
|
536 |
-
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
|
537 |
-
|
538 |
-
if ( $total_pages )
|
539 |
-
$page_class = $total_pages < 2 ? ' one-page' : '';
|
540 |
-
else
|
541 |
-
$page_class = ' no-pages';
|
542 |
-
|
543 |
-
$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
|
544 |
-
|
545 |
-
echo $this->_pagination;
|
546 |
}
|
547 |
}
|
4 |
*
|
5 |
* @since 1.2
|
6 |
*/
|
7 |
+
class Visual_Form_Builder_Forms_List extends WP_List_Table {
|
8 |
/**
|
9 |
+
* Errors
|
10 |
*
|
11 |
+
* @var mixed
|
12 |
* @access public
|
13 |
*/
|
14 |
public $errors;
|
15 |
|
16 |
+
/**
|
17 |
+
* [__construct description]
|
18 |
+
*
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
public function __construct() {
|
22 |
global $status, $page;
|
23 |
|
24 |
+
// Set parent defaults.
|
25 |
+
parent::__construct(
|
26 |
+
array(
|
27 |
+
'singular' => 'form',
|
28 |
+
'plural' => 'forms',
|
29 |
+
'ajax' => false,
|
30 |
+
)
|
31 |
+
);
|
32 |
|
33 |
+
// Handle our bulk actions.
|
34 |
$this->process_bulk_action();
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
* Display column names
|
39 |
*
|
40 |
+
* @param [type] $item [$item description].
|
41 |
+
* @param [type] $column_name [$column_name description].
|
42 |
+
*
|
43 |
+
* @return [type] [return description]
|
44 |
*/
|
45 |
+
public function column_default( $item, $column_name ) {
|
46 |
switch ( $column_name ) {
|
47 |
case 'id':
|
48 |
+
case 'form_id':
|
49 |
return $item[ $column_name ];
|
50 |
}
|
51 |
}
|
53 |
/**
|
54 |
* Builds the on:hover links for the Form column
|
55 |
*
|
56 |
+
* @param [type] $item [$item description].
|
57 |
+
*
|
58 |
+
* @return [type] [return description]
|
59 |
*/
|
60 |
+
public function column_form_title( $item ) {
|
|
|
61 |
$actions = array();
|
62 |
|
63 |
+
// Edit Form.
|
64 |
+
$edit_link = admin_url( 'admin.php?page=visual-form-builder' );
|
65 |
+
$form_title = sprintf( '<strong><a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a></strong>', $edit_link, 'edit', $item['form_id'], $item['form_title'] );
|
66 |
+
$actions['edit'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', $edit_link, 'edit', $item['form_id'], esc_html__( 'Edit', 'visual-form-builder' ) );
|
67 |
|
68 |
+
// Duplicate Form.
|
69 |
+
$actions['copy'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder' ), 'copy-form-' . $item['form_id'] ), 'copy_form', $item['form_id'], esc_html__( 'Duplicate', 'visual-form-builder' ) );
|
70 |
|
71 |
+
// Delete Form.
|
72 |
+
$actions['delete'] = sprintf( '<a href="%s&action=%s&form=%s" id="%3$s" class="view-form">%s</a>', wp_nonce_url( admin_url( 'admin.php?page=visual-form-builder' ), 'delete-form-' . $item['form_id'] ), 'delete_form', $item['form_id'], esc_html__( 'Delete', 'visual-form-builder' ) );
|
73 |
|
74 |
return sprintf( '%1$s %2$s', $form_title, $this->row_actions( $actions ) );
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
* [column_entries description]
|
79 |
+
*
|
80 |
+
* @param [type] $item [description].
|
81 |
+
* @return void
|
82 |
*/
|
83 |
+
public function column_entries( $item ) {
|
84 |
$this->comments_bubble( $item['form_id'], $item['entries'] );
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
* [comments_bubble description]
|
89 |
+
*
|
90 |
+
* @param [type] $form_id [description].
|
91 |
+
* @param [type] $count [description].
|
92 |
+
* @return void
|
93 |
*/
|
94 |
+
public function comments_bubble( $form_id, $count ) {
|
95 |
+
printf(
|
|
|
96 |
'<div class="entries-count-wrapper"><a href="%1$s" title="%2$s" class="vfb-meta-entries-total"><span class="entries-count">%4$s</span></a> %3$s</div>',
|
97 |
esc_url( add_query_arg( array( 'form-filter' => $form_id ), admin_url( 'admin.php?page=vfb-entries' ) ) ),
|
98 |
esc_attr__( 'Entries Total', 'visual-form-builder' ),
|
99 |
+
esc_html__( 'Total', 'visual-form-builder' ),
|
100 |
+
esc_html( number_format_i18n( $count['total'] ) )
|
101 |
);
|
102 |
|
103 |
+
if ( $count['today'] ) {
|
104 |
echo '<strong>';
|
105 |
+
}
|
106 |
|
107 |
+
printf(
|
108 |
'<div class="entries-count-wrapper"><a href="%1$s" title="%2$s" class="vfb-meta-entries-total"><span class="entries-count">%4$s</span></a> %3$s</div>',
|
109 |
+
esc_url(
|
110 |
+
add_query_arg(
|
111 |
+
array(
|
112 |
+
'form-filter' => $form_id,
|
113 |
+
'today' => 1,
|
114 |
+
),
|
115 |
+
admin_url( 'admin.php?page=vfb-entries' )
|
116 |
+
)
|
117 |
+
),
|
118 |
esc_attr__( 'Entries Today', 'visual-form-builder' ),
|
119 |
+
esc_html__( 'Today', 'visual-form-builder' ),
|
120 |
+
esc_html( number_format_i18n( $count['today'] ) )
|
121 |
);
|
122 |
|
123 |
+
if ( $count['today'] ) {
|
124 |
echo '</strong>';
|
125 |
+
}
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
* Used for checkboxes and bulk editing
|
130 |
*
|
131 |
+
* @param [type] $item [$item description].
|
132 |
+
*
|
133 |
+
* @return [type] [return description]
|
134 |
*/
|
135 |
+
public function column_cb( $item ) {
|
136 |
return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['form_id'] );
|
137 |
}
|
138 |
|
141 |
*
|
142 |
* @since 1.2
|
143 |
*/
|
144 |
+
public function get_columns() {
|
145 |
$columns = array(
|
146 |
+
'cb' => '<input type="checkbox" />',
|
147 |
+
'form_title' => esc_html__( 'Form', 'visual-form-builder' ),
|
148 |
+
'form_id' => esc_html__( 'Form ID', 'visual-form-builder' ),
|
149 |
+
'entries' => esc_html__( 'Entries', 'visual-form-builder' ),
|
150 |
);
|
151 |
|
152 |
return $columns;
|
155 |
/**
|
156 |
* A custom function to get the entries and sort them
|
157 |
*
|
158 |
+
* @param [type] $orderby [$orderby description].
|
159 |
+
* @param form_id $order [$order description].
|
160 |
+
* @param ASC $per_page [$per_page description].
|
161 |
+
* @param [type] $offset [$offset description].
|
162 |
+
* @param [type] $search [$search description].
|
163 |
+
*
|
164 |
+
* @return [type] [return description]
|
165 |
*/
|
166 |
+
public function get_forms( $orderby = 'form_id', $order = 'ASC', $per_page, $offset = 0, $search = '' ) {
|
167 |
global $wpdb;
|
168 |
|
169 |
+
// Set OFFSET for pagination.
|
170 |
$offset = ( $offset > 0 ) ? "OFFSET $offset" : '';
|
171 |
|
172 |
$where = apply_filters( 'vfb_pre_get_forms', '' );
|
173 |
|
174 |
+
// If the form filter dropdown is used.
|
175 |
+
if ( $this->current_filter_action() ) {
|
176 |
$where .= ' AND forms.form_id = ' . $this->current_filter_action();
|
177 |
+
}
|
178 |
|
179 |
$sql_order = sanitize_sql_orderby( "$orderby $order" );
|
180 |
+
$cols = $wpdb->get_results( 'SELECT forms.form_id, forms.form_title FROM ' . VFB_WP_FORMS_TABLE_NAME . " AS forms WHERE 1=1 $where $search ORDER BY $sql_order LIMIT $per_page $offset" );
|
181 |
|
182 |
return $cols;
|
183 |
}
|
185 |
/**
|
186 |
* Build the different views for the entries screen
|
187 |
*
|
188 |
+
* @since 2.7.6
|
189 |
* @returns array $status_links Status links with counts
|
190 |
*/
|
191 |
+
public function get_views() {
|
192 |
$status_links = array();
|
193 |
+
$num_forms = $this->get_forms_count();
|
194 |
+
$class = '';
|
195 |
+
$link = '?page=visual-form-builder';
|
196 |
|
197 |
$stati = array(
|
198 |
+
'all' => _n_noop( 'All <span class="count">(<span class="pending-count">%s</span>)</span>', 'All <span class="count">(<span class="pending-count">%s</span>)</span>' ),
|
199 |
);
|
200 |
|
201 |
$total_entries = (int) $num_forms->all;
|
202 |
+
$entry_status = isset( $_GET['form_status'] ) ? sanitize_text_field( wp_unslash( $_GET['form_status'] ) ) : 'all';
|
203 |
|
204 |
foreach ( $stati as $status => $label ) {
|
205 |
+
$class = ( $status === $entry_status ) ? ' class="current"' : '';
|
206 |
|
207 |
+
if ( ! isset( $num_forms->$status ) ) {
|
208 |
$num_forms->$status = 10;
|
209 |
+
}
|
210 |
|
211 |
$link = add_query_arg( 'form_status', $status, $link );
|
212 |
|
222 |
/**
|
223 |
* Get the number of entries for use with entry statuses
|
224 |
*
|
225 |
+
* @since 2.1
|
226 |
* @returns array $stats Counts of different entry types
|
227 |
*/
|
228 |
+
public function get_entries_count() {
|
229 |
global $wpdb;
|
230 |
|
231 |
$total_entries = array();
|
232 |
|
233 |
+
$entries = $wpdb->get_results( 'SELECT form_id, COUNT(form_id) as num_entries FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' AS entries WHERE entries.entry_approved = 1 GROUP BY form_id', ARRAY_A );
|
234 |
|
235 |
if ( $entries ) {
|
236 |
+
foreach ( $entries as $entry ) {
|
237 |
$total_entries[ $entry['form_id'] ] = absint( $entry['num_entries'] );
|
238 |
+
}
|
239 |
|
240 |
return $total_entries;
|
241 |
}
|
246 |
/**
|
247 |
* Get the number of entries for use with entry statuses
|
248 |
*
|
249 |
+
* @since 2.1
|
250 |
* @returns array $stats Counts of different entry types
|
251 |
*/
|
252 |
+
public function get_entries_today_count() {
|
253 |
global $wpdb;
|
254 |
|
255 |
$total_entries = array();
|
256 |
|
257 |
+
$entries = $wpdb->get_results( 'SELECT form_id, COUNT(form_id) as num_entries FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' AS entries WHERE entries.entry_approved = 1 AND date_submitted >= curdate() GROUP BY form_id', ARRAY_A );
|
258 |
|
259 |
if ( $entries ) {
|
260 |
+
foreach ( $entries as $entry ) {
|
261 |
$total_entries[ $entry['form_id'] ] = absint( $entry['num_entries'] );
|
262 |
+
}
|
263 |
|
264 |
return $total_entries;
|
265 |
}
|
270 |
/**
|
271 |
* Get the number of forms
|
272 |
*
|
273 |
+
* @since 2.2.7
|
274 |
* @returns int $count Form count
|
275 |
*/
|
276 |
+
public function get_forms_count() {
|
277 |
global $wpdb;
|
278 |
|
279 |
$stats = array();
|
280 |
|
281 |
+
$count = $wpdb->get_var( 'SELECT COUNT(*) FROM ' . VFB_WP_FORMS_TABLE_NAME );
|
282 |
|
283 |
$stats['all'] = $count;
|
284 |
|
290 |
/**
|
291 |
* Setup which columns are sortable. Default is by Date.
|
292 |
*
|
293 |
+
* @since 1.2
|
294 |
* @returns array() $sortable_columns Sortable columns
|
295 |
*/
|
296 |
+
public function get_sortable_columns() {
|
297 |
$sortable_columns = array(
|
298 |
+
'id' => array( 'id', false ),
|
299 |
+
'form_id' => array( 'form_id', false ),
|
300 |
+
'form_title' => array( 'form_title', true ),
|
301 |
+
'entries' => array( 'entries_count', false ),
|
302 |
);
|
303 |
|
304 |
return $sortable_columns;
|
307 |
/**
|
308 |
* Define our bulk actions
|
309 |
*
|
310 |
+
* @since 1.2
|
311 |
* @returns array() $actions Bulk actions
|
312 |
*/
|
313 |
+
public function get_bulk_actions() {
|
314 |
$actions = array();
|
315 |
|
316 |
+
// Build the row actions.
|
317 |
+
$actions['delete'] = esc_html__( 'Delete Permanently', 'visual-form-builder' );
|
318 |
|
319 |
return $actions;
|
320 |
}
|
324 |
*
|
325 |
* @since 1.2
|
326 |
*/
|
327 |
+
public function process_bulk_action() {
|
328 |
global $wpdb;
|
329 |
|
330 |
$form_id = '';
|
331 |
|
332 |
+
// Set the Entry ID array.
|
333 |
if ( isset( $_POST['form'] ) ) {
|
334 |
+
if ( is_array( $_POST['form'] ) ) {
|
335 |
+
$form_id = array_map( 'sanitize_text_field', wp_unslash( $_POST['form'] ) );
|
336 |
+
} else {
|
337 |
+
$form_id = array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['form'] ) );
|
338 |
+
}
|
339 |
}
|
340 |
|
341 |
+
switch ( $this->current_action() ) {
|
342 |
+
case 'trash':
|
343 |
+
check_admin_referer( 'bulk-forms' );
|
344 |
+
|
345 |
foreach ( $form_id as $id ) {
|
346 |
$id = absint( $id );
|
347 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, array( 'form_approved' => 'trash' ), array( 'form_id' => $id ) );
|
348 |
}
|
349 |
+
break;
|
350 |
+
|
351 |
+
case 'delete':
|
352 |
+
check_admin_referer( 'bulk-forms' );
|
353 |
|
|
|
354 |
foreach ( $form_id as $id ) {
|
355 |
$id = absint( $id );
|
356 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_FORMS_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
357 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_FIELDS_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
358 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
359 |
}
|
360 |
+
break;
|
|
|
361 |
}
|
362 |
}
|
363 |
|
364 |
/**
|
365 |
* Set our forms filter action
|
366 |
*
|
367 |
+
* @since 1.2
|
368 |
* @returns int Form ID
|
369 |
*/
|
370 |
+
public function current_filter_action() {
|
371 |
+
if ( isset( $_POST['form-filter'] ) && -1 != $_POST['form-filter'] ) {
|
372 |
return absint( $_POST['form-filter'] );
|
373 |
+
}
|
374 |
|
375 |
return false;
|
376 |
}
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
/**
|
379 |
* Prepares our data for display
|
380 |
*
|
381 |
* @since 1.2
|
382 |
*/
|
383 |
+
public function prepare_items() {
|
384 |
global $wpdb;
|
385 |
|
386 |
+
// get the current user ID.
|
387 |
$user = get_current_user_id();
|
388 |
|
389 |
+
// get the current admin screen.
|
390 |
$screen = get_current_screen();
|
391 |
|
392 |
+
// retrieve the "per_page" option.
|
393 |
$screen_option = $screen->get_option( 'per_page', 'option' );
|
394 |
|
395 |
+
// retrieve the value of the option stored for the current user.
|
396 |
$per_page = get_user_meta( $user, $screen_option, true );
|
397 |
|
398 |
+
// get the default value if none is set.
|
399 |
+
if ( empty( $per_page ) || $per_page < 1 ) {
|
400 |
$per_page = 20;
|
401 |
+
}
|
402 |
|
403 |
+
// Get the date/time format that is saved in the options table.
|
404 |
$date_format = get_option( 'date_format' );
|
405 |
$time_format = get_option( 'time_format' );
|
406 |
|
407 |
// What page are we looking at?
|
408 |
$current_page = $this->get_pagenum();
|
409 |
|
410 |
+
// Use offset for pagination.
|
411 |
$offset = ( $current_page - 1 ) * $per_page;
|
412 |
|
413 |
+
// Get column headers.
|
414 |
+
$columns = $this->get_columns();
|
415 |
+
$hidden = get_hidden_columns( $this->screen );
|
416 |
|
417 |
+
// Get sortable columns.
|
418 |
$sortable = $this->get_sortable_columns();
|
419 |
|
420 |
+
// Build the column headers.
|
421 |
+
$this->_column_headers = array( $columns, $hidden, $sortable );
|
422 |
|
423 |
+
// Get entries search terms.
|
424 |
+
$search_terms = ( ! empty( $_POST['s'] ) ) ? explode( ' ', sanitize_text_field( wp_unslash( $_POST['s'] ) ) ) : array();
|
425 |
|
426 |
$searchand = $search = '';
|
427 |
+
// Loop through search terms and build query.
|
428 |
+
foreach ( $search_terms as $term ) {
|
429 |
$term = esc_sql( $wpdb->esc_like( $term ) );
|
430 |
|
431 |
+
$search .= "{$searchand}((forms.form_title LIKE '%{$term}%') OR (forms.form_key LIKE '%{$term}%') OR (forms.form_email_subject LIKE '%{$term}%'))";
|
432 |
$searchand = ' AND ';
|
433 |
}
|
434 |
|
435 |
+
$search = ( ! empty( $search ) ) ? " AND ({$search}) " : '';
|
436 |
|
437 |
+
// Set our ORDER BY and ASC/DESC to sort the entries.
|
438 |
+
$orderby = ! empty( $_GET['orderby'] ) ? sanitize_text_field( wp_unslash( $_GET['orderby'] ) ) : 'form_id';
|
439 |
+
$order = ! empty( $_GET['order'] ) ? sanitize_text_field( wp_unslash( $_GET['order'] ) ) : 'desc';
|
440 |
|
441 |
+
// Get the sorted entries.
|
442 |
$forms = $this->get_forms( $orderby, $order, $per_page, $offset, $search );
|
443 |
|
444 |
+
// Get entries totals.
|
445 |
$entries_total = $this->get_entries_count();
|
446 |
$entries_today = $this->get_entries_today_count();
|
447 |
|
448 |
$data = array();
|
449 |
|
450 |
+
// Loop trough the entries and setup the data to be displayed for each row.
|
451 |
foreach ( $forms as $form ) :
|
452 |
|
453 |
+
// Check if index exists first, not every form has entries.
|
454 |
$entries_total[ $form->form_id ] = isset( $entries_total[ $form->form_id ] ) ? $entries_total[ $form->form_id ] : 0;
|
455 |
|
456 |
+
// Check if index exists first, not every form has entries today.
|
457 |
$entries_today[ $form->form_id ] = isset( $entries_today[ $form->form_id ] ) ? $entries_today[ $form->form_id ] : 0;
|
458 |
|
459 |
$entries_counts = array(
|
462 |
);
|
463 |
|
464 |
$data[] = array(
|
465 |
+
'id' => $form->form_id,
|
466 |
+
'form_id' => $form->form_id,
|
467 |
+
'form_title' => wp_unslash( $form->form_title ),
|
468 |
+
'entries' => $entries_counts,
|
469 |
);
|
470 |
endforeach;
|
471 |
|
472 |
// How many forms do we have?
|
473 |
$total_items = $this->get_forms_count();
|
474 |
|
475 |
+
// Add sorted data to the items property.
|
476 |
$this->items = $data;
|
477 |
|
478 |
+
// Register our pagination.
|
479 |
+
$this->set_pagination_args(
|
480 |
+
array(
|
481 |
+
'total_items' => $total_items->all,
|
482 |
+
'per_page' => $per_page,
|
483 |
+
'total_pages' => ceil( $total_items->all / $per_page ),
|
484 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
}
|
487 |
}
|
admin/class-forms-new.php
CHANGED
@@ -1,76 +1,75 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that controls the Add New Form view
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Forms_New {
|
7 |
-
|
8 |
/**
|
9 |
-
*
|
10 |
*
|
11 |
* @access public
|
12 |
* @return void
|
13 |
*/
|
14 |
public function display() {
|
15 |
-
|
16 |
<form method="post" id="visual-form-builder-new-form" action="">
|
17 |
<input name="action" type="hidden" value="create_form" />
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
25 |
|
26 |
<table class="form-table">
|
27 |
<tbody>
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
|
70 |
</tbody>
|
71 |
</table>
|
72 |
-
<?php submit_button(
|
73 |
</form>
|
74 |
-
|
75 |
}
|
76 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that controls the Add New Form view
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Forms_New {
|
|
|
6 |
/**
|
7 |
+
* Display function.
|
8 |
*
|
9 |
* @access public
|
10 |
* @return void
|
11 |
*/
|
12 |
public function display() {
|
13 |
+
?>
|
14 |
<form method="post" id="visual-form-builder-new-form" action="">
|
15 |
<input name="action" type="hidden" value="create_form" />
|
16 |
+
<?php
|
17 |
+
wp_nonce_field( 'create_form' );
|
18 |
|
19 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
20 |
+
wp_die( esc_html__( 'You do not have sufficient permissions to create a new form.', 'visual-form-builder' ) );
|
21 |
+
}
|
22 |
+
?>
|
23 |
+
<h3><?php esc_html_e( 'Create a form', 'visual-form-builder' ); ?></h3>
|
24 |
|
25 |
<table class="form-table">
|
26 |
<tbody>
|
27 |
+
<!-- Form Name -->
|
28 |
+
<tr valign="top">
|
29 |
+
<th scope="row"><label for="form-name"><?php esc_html_e( 'Name the form', 'visual-form-builder' ); ?></label></th>
|
30 |
+
<td>
|
31 |
+
<input type="text" autofocus="autofocus" class="regular-text required" id="form-name" name="form_title" />
|
32 |
+
<p class="description"><?php esc_html_e( 'Required. This name is used for admin purposes.', 'visual-form-builder' ); ?></p>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<!-- Sender Name -->
|
36 |
+
<tr valign="top">
|
37 |
+
<th scope="row"><label for="form-email-sender-name"><?php esc_html_e( 'Your Name or Company', 'visual-form-builder' ); ?></label></th>
|
38 |
+
<td>
|
39 |
+
<input type="text" value="" placeholder="" class="regular-text required" id="form-email-sender-name" name="form_email_from_name" />
|
40 |
+
<p class="description"><?php esc_html_e( 'Required. This option sets the "From" display name of the email that is sent.', 'visual-form-builder' ); ?></p>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
<!-- Reply-to Email -->
|
44 |
+
<tr valign="top">
|
45 |
+
<th scope="row"><label for="form-email-from"><?php esc_html_e( 'Reply-To E-mail', 'visual-form-builder' ); ?></label></th>
|
46 |
+
<td>
|
47 |
+
<input type="text" value="" placeholder="" class="regular-text required" id="form-email-from" name="form_email_from" />
|
48 |
+
<p class="description"><?php esc_html_e( 'Required. Replies to your email will go here.', 'visual-form-builder' ); ?></p>
|
49 |
+
<p class="description"><?php esc_html_e( 'Tip: for best results, use an email that exists on this domain.', 'visual-form-builder' ); ?></p>
|
50 |
+
</td>
|
51 |
+
</tr>
|
52 |
+
<!-- Email Subject -->
|
53 |
+
<tr valign="top">
|
54 |
+
<th scope="row"><label for="form-email-subject"><?php esc_html_e( 'E-mail Subject', 'visual-form-builder' ); ?></label></th>
|
55 |
+
<td>
|
56 |
+
<input type="text" value="" placeholder="" class="regular-text" id="form-email-subject" name="form_email_subject" />
|
57 |
+
<p class="description"><?php esc_html_e( 'This sets the subject of the email that is sent.', 'visual-form-builder' ); ?></p>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<!-- E-mail To -->
|
61 |
+
<tr valign="top">
|
62 |
+
<th scope="row"><label for="form-email-to"><?php esc_html_e( 'E-mail To', 'visual-form-builder' ); ?></label></th>
|
63 |
+
<td>
|
64 |
+
<input type="text" value="" placeholder="" class="regular-text" id="form-email-to" name="form_email_to[]" />
|
65 |
+
<p class="description"><?php esc_html_e( 'Who to send the submitted data to. You can add more after creating the form.', 'visual-form-builder' ); ?></p>
|
66 |
+
</td>
|
67 |
+
</tr>
|
68 |
|
69 |
</tbody>
|
70 |
</table>
|
71 |
+
<?php submit_button( esc_html__( 'Create Form', 'visual-form-builder' ) ); ?>
|
72 |
</form>
|
73 |
+
<?php
|
74 |
}
|
75 |
}
|
admin/class-load-css-js.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*
|
6 |
* This class should be called when the menu is added
|
7 |
* so the CSS and JS is added to ONLY our VFB pages.
|
8 |
-
*
|
9 |
*/
|
10 |
class Visual_Form_Builder_Admin_Scripts_Loader {
|
11 |
/**
|
@@ -17,8 +16,8 @@ class Visual_Form_Builder_Admin_Scripts_Loader {
|
|
17 |
* @return void
|
18 |
*/
|
19 |
public function add_css() {
|
20 |
-
|
21 |
-
wp_enqueue_style( 'visual-form-builder-style', VFB_WP_PLUGIN_URL .
|
22 |
}
|
23 |
|
24 |
/**
|
@@ -33,9 +32,8 @@ class Visual_Form_Builder_Admin_Scripts_Loader {
|
|
33 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
34 |
wp_enqueue_script( 'postbox' );
|
35 |
wp_enqueue_script( 'jquery-form-validation', VFB_WP_PLUGIN_URL . 'admin/assets/js/jquery.validate.min.js', array( 'jquery' ), '1.9.0', true );
|
36 |
-
wp_enqueue_script( 'vfb-admin', VFB_WP_PLUGIN_URL . 'admin/assets/js/vfb-admin.min.js', array( 'jquery', 'jquery-form-validation' ), '
|
37 |
-
wp_enqueue_script( 'nested-sortable', VFB_WP_PLUGIN_URL . 'admin/assets/js/jquery.ui.nestedSortable.min.js', array( 'jquery', 'jquery-ui-sortable' ), '1.3.5', true );
|
38 |
|
39 |
-
wp_localize_script( 'vfb-admin', 'vfb_settings', array( 'vfb_ajax_nonce' => wp_create_nonce( 'vfb_ajax') ) );
|
40 |
}
|
41 |
}
|
5 |
*
|
6 |
* This class should be called when the menu is added
|
7 |
* so the CSS and JS is added to ONLY our VFB pages.
|
|
|
8 |
*/
|
9 |
class Visual_Form_Builder_Admin_Scripts_Loader {
|
10 |
/**
|
16 |
* @return void
|
17 |
*/
|
18 |
public function add_css() {
|
19 |
+
wp_enqueue_style( 'thickbox' );
|
20 |
+
wp_enqueue_style( 'visual-form-builder-style', VFB_WP_PLUGIN_URL . 'admin/assets/css/visual-form-builder-admin.min.css', array(), '2021.03.22' );
|
21 |
}
|
22 |
|
23 |
/**
|
32 |
wp_enqueue_script( 'jquery-ui-sortable' );
|
33 |
wp_enqueue_script( 'postbox' );
|
34 |
wp_enqueue_script( 'jquery-form-validation', VFB_WP_PLUGIN_URL . 'admin/assets/js/jquery.validate.min.js', array( 'jquery' ), '1.9.0', true );
|
35 |
+
wp_enqueue_script( 'vfb-admin', VFB_WP_PLUGIN_URL . 'admin/assets/js/vfb-admin.min.js', array( 'jquery', 'jquery-form-validation' ), '2022.05.11', true );
|
|
|
36 |
|
37 |
+
wp_localize_script( 'vfb-admin', 'vfb_settings', array( 'vfb_ajax_nonce' => wp_create_nonce( 'vfb_ajax' ) ) );
|
38 |
}
|
39 |
}
|
admin/class-media-button.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that handles the Media Button display
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Media_Button {
|
7 |
/**
|
@@ -22,9 +21,10 @@ class Visual_Form_Builder_Media_Button {
|
|
22 |
* @return void
|
23 |
*/
|
24 |
public function add_button() {
|
25 |
-
// Check permission before display
|
26 |
-
if ( !current_user_can( 'manage_options' ) )
|
27 |
return;
|
|
|
28 |
|
29 |
$button_url = add_query_arg(
|
30 |
array(
|
@@ -35,12 +35,12 @@ class Visual_Form_Builder_Media_Button {
|
|
35 |
),
|
36 |
wp_nonce_url( admin_url( 'admin-ajax.php' ), 'vfb_media_button' )
|
37 |
);
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
}
|
45 |
|
46 |
/**
|
@@ -54,43 +54,43 @@ class Visual_Form_Builder_Media_Button {
|
|
54 |
|
55 |
check_admin_referer( 'vfb_media_button' );
|
56 |
|
57 |
-
// Sanitize the sql orderby
|
58 |
$order = sanitize_sql_orderby( 'form_id ASC' );
|
59 |
|
60 |
-
// Build our forms as an object
|
61 |
-
$forms = $wpdb->get_results(
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
});
|
73 |
});
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
95 |
}
|
96 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Class that handles the Media Button display
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Media_Button {
|
6 |
/**
|
21 |
* @return void
|
22 |
*/
|
23 |
public function add_button() {
|
24 |
+
// Check permission before display.
|
25 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
26 |
return;
|
27 |
+
}
|
28 |
|
29 |
$button_url = add_query_arg(
|
30 |
array(
|
35 |
),
|
36 |
wp_nonce_url( admin_url( 'admin-ajax.php' ), 'vfb_media_button' )
|
37 |
);
|
38 |
+
?>
|
39 |
+
<a href="<?php echo esc_url( $button_url ); ?>" class="button add_media thickbox" title="<?php esc_attr_e( 'Add Visual Form Builder form', 'visual-form-builder' ); ?>">
|
40 |
+
<span class="dashicons dashicons-feedback" style="color:#888; display: inline-block; width: 18px; height: 18px; vertical-align: text-top; margin: 0 4px 0 0;"></span>
|
41 |
+
<?php esc_html_e( 'Add Form', 'visual-form-builder' ); ?>
|
42 |
+
</a>
|
43 |
+
<?php
|
44 |
}
|
45 |
|
46 |
/**
|
54 |
|
55 |
check_admin_referer( 'vfb_media_button' );
|
56 |
|
57 |
+
// Sanitize the sql orderby.
|
58 |
$order = sanitize_sql_orderby( 'form_id ASC' );
|
59 |
|
60 |
+
// Build our forms as an object.
|
61 |
+
$forms = $wpdb->get_results( 'SELECT form_id, form_title FROM ' . VFB_WP_FORMS_TABLE_NAME . " ORDER BY $order" );
|
62 |
|
63 |
+
?>
|
64 |
+
<script type="text/javascript">
|
65 |
+
jQuery(document).ready(function($) {
|
66 |
+
$( '#add_vfb_form' ).submit(function(e){
|
67 |
+
e.preventDefault();
|
68 |
|
69 |
+
window.send_to_editor( '[vfb id=' + $( '#vfb_forms' ).val() + ']' );
|
70 |
|
71 |
+
window.tb_remove();
|
|
|
72 |
});
|
73 |
+
});
|
74 |
+
</script>
|
75 |
+
<div>
|
76 |
+
<form id="add_vfb_form" class="media-upload-form type-form validate">
|
77 |
+
<h3><?php esc_html_e( 'Insert Visual Form Builder form', 'visual-form-builder' ); ?></h3>
|
78 |
+
<p><?php esc_html_e( 'Select a form below to insert into any Post or Page.', 'visual-form-builder' ); ?></p>
|
79 |
+
<select id="vfb_forms" name="vfb_forms">
|
80 |
+
<?php foreach ( $forms as $form ) : ?>
|
81 |
+
<option value="<?php echo esc_attr( $form->form_id ); ?>"><?php echo esc_html( $form->form_title ); ?></option>
|
82 |
+
<?php endforeach; ?>
|
83 |
+
</select>
|
84 |
+
<?php
|
85 |
+
submit_button(
|
86 |
+
esc_html__( 'Add Form', 'visual-form-builder' ),
|
87 |
+
'primary',
|
88 |
+
'' // leave blank so "name" attribute will not be added.
|
89 |
+
);
|
90 |
+
?>
|
91 |
+
</form>
|
92 |
+
</div>
|
93 |
+
<?php
|
94 |
+
die( 1 );
|
95 |
}
|
96 |
}
|
admin/class-page-settings.php
CHANGED
@@ -2,149 +2,149 @@
|
|
2 |
|
3 |
/**
|
4 |
* Class that controls the Settings page view
|
5 |
-
*
|
6 |
*/
|
7 |
class Visual_Form_Builder_Page_Settings {
|
8 |
/**
|
9 |
* [display description]
|
10 |
-
*
|
|
|
11 |
*/
|
12 |
public function display() {
|
13 |
$vfb_settings = get_option( 'vfb-settings' );
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
<?php wp_nonce_field( 'vfb-update-settings' ); ?>
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
<?php endforeach; ?>
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
<?php endforeach; ?>
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
?>
|
81 |
-
<
|
82 |
-
|
83 |
-
|
84 |
-
<br>
|
85 |
<?php endforeach; ?>
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
$sitename = substr( $sitename, 4 );
|
|
|
117 |
|
118 |
-
|
119 |
-
|
120 |
|
121 |
-
|
122 |
-
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
<?php
|
136 |
submit_button(
|
137 |
-
|
138 |
'delete',
|
139 |
'visual-form-builder-uninstall',
|
140 |
false
|
141 |
);
|
142 |
?>
|
143 |
-
|
144 |
|
145 |
-
<?php submit_button(
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
}
|
150 |
}
|
2 |
|
3 |
/**
|
4 |
* Class that controls the Settings page view
|
|
|
5 |
*/
|
6 |
class Visual_Form_Builder_Page_Settings {
|
7 |
/**
|
8 |
* [display description]
|
9 |
+
*
|
10 |
+
* @return void
|
11 |
*/
|
12 |
public function display() {
|
13 |
$vfb_settings = get_option( 'vfb-settings' );
|
14 |
+
?>
|
15 |
+
<div class="wrap">
|
16 |
+
<h2><?php esc_html_e( 'Settings', 'visual-form-builder' ); ?></h2>
|
17 |
+
<form id="vfb-settings" method="post">
|
18 |
+
<input name="action" type="hidden" value="vfb_settings" />
|
19 |
<?php wp_nonce_field( 'vfb-update-settings' ); ?>
|
20 |
+
<h3><?php esc_html_e( 'Global Settings', 'visual-form-builder' ); ?></h3>
|
21 |
+
<p><?php esc_html_e( 'These settings will affect all forms on your site.', 'visual-form-builder' ); ?></p>
|
22 |
+
<table class="form-table">
|
23 |
+
<tr valign="top">
|
24 |
+
<th scope="row"><?php esc_html_e( 'CSS', 'visual-form-builder' ); ?></th>
|
25 |
+
<td>
|
26 |
+
<fieldset>
|
27 |
+
<?php
|
28 |
+
$disable = array(
|
29 |
+
'always-load-css' => esc_html__( 'Always load CSS', 'visual-form-builder' ),
|
30 |
+
'disable-css' => esc_html__( 'Disable CSS', 'visual-form-builder' ),
|
31 |
+
);
|
32 |
+
|
33 |
+
foreach ( $disable as $key => $title ) :
|
34 |
+
|
35 |
+
$vfb_settings[ $key ] = isset( $vfb_settings[ $key ] ) ? $vfb_settings[ $key ] : '';
|
36 |
+
?>
|
37 |
+
<label for="vfb-settings-<?php echo esc_attr( $key ); ?>">
|
38 |
+
<input type="checkbox" name="vfb-settings[<?php echo esc_attr( $key ); ?>]" id="vfb-settings-<?php echo esc_attr( $key ); ?>" value="1" <?php checked( $vfb_settings[ $key ], 1 ); ?> /> <?php echo esc_html( $title ); ?>
|
39 |
+
</label>
|
40 |
+
<br>
|
41 |
<?php endforeach; ?>
|
42 |
+
</fieldset>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
|
46 |
+
<tr valign="top">
|
47 |
+
<th scope="row"><?php esc_html_e( 'Form Output', 'visual-form-builder' ); ?></th>
|
48 |
+
<td>
|
49 |
+
<fieldset>
|
50 |
+
<?php
|
51 |
+
$disable = array(
|
52 |
+
'address-labels' => esc_html__( 'Place Address labels above fields', 'visual-form-builder' ),
|
53 |
+
);
|
54 |
+
|
55 |
+
foreach ( $disable as $key => $title ) :
|
56 |
+
|
57 |
+
$vfb_settings[ $key ] = isset( $vfb_settings[ $key ] ) ? $vfb_settings[ $key ] : '';
|
58 |
+
?>
|
59 |
+
<label for="vfb-settings-<?php echo esc_attr( $key ); ?>">
|
60 |
+
<input type="checkbox" name="vfb-settings[<?php echo esc_attr( $key ); ?>]" id="vfb-settings-<?php echo esc_attr( $key ); ?>" value="1" <?php checked( $vfb_settings[ $key ], 1 ); ?> /> <?php echo esc_html( $title ); ?>
|
61 |
+
</label>
|
62 |
+
<br>
|
63 |
<?php endforeach; ?>
|
64 |
+
</fieldset>
|
65 |
+
</td>
|
66 |
+
</tr>
|
67 |
+
|
68 |
+
<tr valign="top">
|
69 |
+
<th scope="row"><?php esc_html_e( 'Disable Saving Entries', 'visual-form-builder' ); ?></th>
|
70 |
+
<td>
|
71 |
+
<fieldset>
|
72 |
+
<?php
|
73 |
+
$disable = array(
|
74 |
+
'disable-saving-entries' => esc_html__( 'Disables saving entry data for each submission after all emails have been sent.', 'visual-form-builder' ),
|
75 |
+
);
|
76 |
+
|
77 |
+
foreach ( $disable as $key => $title ) :
|
78 |
+
$vfb_settings[ $key ] = isset( $vfb_settings[ $key ] ) ? $vfb_settings[ $key ] : '';
|
79 |
+
?>
|
80 |
+
<label for="vfb-settings-<?php echo esc_attr( $key ); ?>">
|
81 |
+
<input type="checkbox" name="vfb-settings[<?php echo esc_attr( $key ); ?>]" id="vfb-settings-<?php echo esc_attr( $key ); ?>" value="1" <?php checked( $vfb_settings[ $key ], 1 ); ?> /> <?php echo esc_html( $title ); ?>
|
82 |
+
</label>
|
83 |
+
<br>
|
|
|
84 |
<?php endforeach; ?>
|
85 |
+
</fieldset>
|
86 |
+
</td>
|
87 |
+
</tr>
|
88 |
+
|
89 |
+
<tr valign="top">
|
90 |
+
<th scope="row"><label for="vfb-settings-spam-points"><?php esc_html_e( 'Spam word sensitivity', 'visual-form-builder' ); ?></label></th>
|
91 |
+
<td>
|
92 |
+
<?php $vfb_settings['spam-points'] = isset( $vfb_settings['spam-points'] ) ? $vfb_settings['spam-points'] : '4'; ?>
|
93 |
+
<input type="number" min="1" name="vfb-settings[spam-points]" id="vfb-settings-spam-points" value="<?php echo esc_attr( $vfb_settings['spam-points'] ); ?>" class="small-text" />
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
|
97 |
+
<tr valign="top">
|
98 |
+
<th scope="row"><label for="vfb-settings-max-upload-size"><?php esc_html_e( 'Max Upload Size', 'visual-form-builder' ); ?></label></th>
|
99 |
+
<td>
|
100 |
+
<?php $vfb_settings['max-upload-size'] = isset( $vfb_settings['max-upload-size'] ) ? $vfb_settings['max-upload-size'] : '25'; ?>
|
101 |
+
<input type="number" name="vfb-settings[max-upload-size]" id="vfb-settings-max-upload-size" value="<?php echo esc_attr( $vfb_settings['max-upload-size'] ); ?>" class="small-text" /> MB
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
|
105 |
+
<tr valign="top">
|
106 |
+
<th scope="row"><label for="vfb-settings-sender-mail-header"><?php esc_html_e( 'Sender Mail Header', 'visual-form-builder' ); ?></label></th>
|
107 |
+
<td>
|
108 |
+
<?php
|
109 |
+
// Use the admin_email as the From email.
|
110 |
+
$from_email = get_option( 'admin_email' );
|
111 |
+
|
112 |
+
// Get the site domain and get rid of www.
|
113 |
+
$sitename = isset( $_SERVER['SERVER_NAME'] ) ? strtolower( sanitize_text_field( wp_unslash( $_SERVER['SERVER_NAME'] ) ) ) : 'localhost';
|
114 |
+
if ( substr( $sitename, 0, 4 ) === 'www.' ) {
|
115 |
$sitename = substr( $sitename, 4 );
|
116 |
+
}
|
117 |
|
118 |
+
// Get the domain from the admin_email.
|
119 |
+
list( $user, $domain ) = explode( '@', $from_email );
|
120 |
|
121 |
+
// If site domain and admin_email domain match, use admin_email, otherwise a same domain email must be created.
|
122 |
+
$from_email = ( $sitename === $domain ) ? $from_email : "wordpress@$sitename";
|
123 |
|
124 |
+
$vfb_settings['sender-mail-header'] = isset( $vfb_settings['sender-mail-header'] ) ? $vfb_settings['sender-mail-header'] : $from_email;
|
125 |
+
?>
|
126 |
+
<input type="text" name="vfb-settings[sender-mail-header]" id="vfb-settings-sender-mail-header" value="<?php echo esc_attr( $vfb_settings['sender-mail-header'] ); ?>" class="regular-text" />
|
127 |
+
<p class="description"><?php esc_html_e( 'Some server configurations require an existing email on the domain be used when sending emails.', 'visual-form-builder' ); ?></p>
|
128 |
+
</td>
|
129 |
+
</tr>
|
130 |
+
</table>
|
131 |
|
132 |
+
<div class="vfb-notices vfb-notice-danger" style="width: 50%;">
|
133 |
+
<h3><?php esc_html_e( 'Uninstall Visual Form Builder', 'visual-form-builder' ); ?></h3>
|
134 |
+
<p><?php esc_html_e( 'Running this uninstall process will delete all Visual Form Builder data for this site. This process cannot be reversed.', 'visual-form-builder' ); ?></p>
|
135 |
<?php
|
136 |
submit_button(
|
137 |
+
esc_html__( 'Uninstall', 'visual-form-builder' ),
|
138 |
'delete',
|
139 |
'visual-form-builder-uninstall',
|
140 |
false
|
141 |
);
|
142 |
?>
|
143 |
+
</div> <!-- .vfb-notices -->
|
144 |
|
145 |
+
<?php submit_button( esc_html__( 'Save', 'visual-form-builder' ), 'primary', 'submit', false ); ?>
|
146 |
+
</form>
|
147 |
+
</div> <!-- .wrap -->
|
148 |
+
<?php
|
149 |
}
|
150 |
}
|
admin/class-save.php
CHANGED
@@ -24,222 +24,231 @@ class Visual_Form_Builder_Admin_Save {
|
|
24 |
public function add_new_form() {
|
25 |
global $wpdb;
|
26 |
|
27 |
-
if ( !isset( $_POST['action'] ) || !isset( $_GET['page'] ) )
|
28 |
return;
|
|
|
29 |
|
30 |
-
if ( 'vfb-add-new' !== $_GET['page'] )
|
31 |
return;
|
|
|
32 |
|
33 |
-
if ( 'create_form' !== $_POST['action'] )
|
34 |
return;
|
|
|
35 |
|
36 |
-
if ( !current_user_can( 'manage_options' ) )
|
37 |
-
wp_die(
|
|
|
38 |
|
39 |
check_admin_referer( 'create_form' );
|
40 |
|
41 |
-
$form_key
|
42 |
-
$form_title
|
43 |
-
$form_from_name = sanitize_text_field( $_POST['form_email_from_name'] );
|
44 |
-
$form_subject
|
45 |
-
$form_from
|
46 |
-
$form_to
|
47 |
|
48 |
$newdata = array(
|
49 |
-
'form_key'
|
50 |
-
'form_title'
|
51 |
-
'form_email_from_name'
|
52 |
-
'form_email_subject'
|
53 |
-
'form_email_from'
|
54 |
-
'form_email_to'
|
55 |
-
'form_success_message'
|
56 |
);
|
57 |
|
58 |
-
// Create the form
|
59 |
$wpdb->insert( VFB_WP_FORMS_TABLE_NAME, $newdata );
|
60 |
|
61 |
-
// Get form ID to add our first field
|
62 |
$new_form_selected = $wpdb->insert_id;
|
63 |
|
64 |
-
// Setup the initial fieldset
|
65 |
$initial_fieldset = array(
|
66 |
-
'form_id'
|
67 |
-
'field_key'
|
68 |
-
'field_type'
|
69 |
-
'field_name'
|
70 |
-
'field_sequence'
|
71 |
);
|
72 |
|
73 |
-
// Add the first fieldset to get things started
|
74 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $initial_fieldset );
|
75 |
|
76 |
$verification_fieldset = array(
|
77 |
-
'form_id'
|
78 |
-
'field_key'
|
79 |
-
'field_type'
|
80 |
-
'field_name'
|
81 |
'field_description' => '(This is for preventing spam)',
|
82 |
-
'field_sequence'
|
83 |
);
|
84 |
|
85 |
-
// Insert the submit field
|
86 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $verification_fieldset );
|
87 |
|
88 |
$verify_fieldset_parent_id = $wpdb->insert_id;
|
89 |
|
90 |
$secret = array(
|
91 |
-
'form_id'
|
92 |
-
'field_key'
|
93 |
-
'field_type'
|
94 |
-
'field_name'
|
95 |
-
'field_description'
|
96 |
-
'field_size'
|
97 |
-
'field_required'
|
98 |
-
'field_parent'
|
99 |
-
'field_sequence'
|
100 |
);
|
101 |
|
102 |
-
// Insert the submit field
|
103 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $secret );
|
104 |
|
105 |
-
// Make the submit last in the sequence
|
106 |
$submit = array(
|
107 |
-
'form_id'
|
108 |
-
'field_key'
|
109 |
-
'field_type'
|
110 |
-
'field_name'
|
111 |
-
'field_parent'
|
112 |
-
'field_sequence'
|
113 |
);
|
114 |
|
115 |
-
// Insert the submit field
|
116 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $submit );
|
117 |
|
118 |
-
|
119 |
-
|
|
|
120 |
exit();
|
121 |
}
|
122 |
|
123 |
/**
|
124 |
* [save_update_form description]
|
|
|
125 |
* @return [type] [description]
|
126 |
*/
|
127 |
public function save_update_form() {
|
128 |
global $wpdb;
|
129 |
|
130 |
-
if ( !isset( $_POST['action'] ) || !isset( $_GET['page'] ) )
|
131 |
return;
|
|
|
132 |
|
133 |
-
if ( 'visual-form-builder' !== $_GET['page'] )
|
134 |
return;
|
|
|
135 |
|
136 |
-
if ( 'update_form' !== $_POST['action'] )
|
137 |
return;
|
|
|
138 |
|
139 |
check_admin_referer( 'vfb_update_form' );
|
140 |
|
141 |
-
$form_id
|
142 |
-
$form_key
|
143 |
-
$form_title
|
144 |
-
$form_subject
|
145 |
-
$form_to
|
146 |
-
$form_from
|
147 |
-
$form_from_name
|
148 |
-
$form_from_override
|
149 |
-
$form_from_name_override
|
150 |
-
$form_success_type
|
151 |
-
$form_notification_setting
|
152 |
-
$form_notification_email_name
|
153 |
-
$form_notification_email_from
|
154 |
-
$form_notification_email
|
155 |
-
$form_notification_subject
|
156 |
-
$form_notification_message
|
157 |
-
$form_notification_entry
|
158 |
-
$form_label_alignment
|
159 |
-
|
160 |
-
// Add confirmation based on which type was selected
|
161 |
switch ( $form_success_type ) {
|
162 |
-
case 'text'
|
163 |
-
$form_success_message = format_for_editor( $_POST['form_success_message_text'] );
|
164 |
-
|
165 |
-
case 'page'
|
166 |
-
$form_success_message = absint( $_POST['form_success_message_page'] );
|
167 |
-
|
168 |
-
case 'redirect'
|
169 |
-
$form_success_message = esc_url_raw( $_POST['form_success_message_redirect'] );
|
170 |
-
|
171 |
}
|
172 |
|
173 |
$newdata = array(
|
174 |
-
'form_key'
|
175 |
-
'form_title'
|
176 |
-
'form_email_subject'
|
177 |
-
'form_email_to'
|
178 |
-
'form_email_from'
|
179 |
-
'form_email_from_name'
|
180 |
-
'form_email_from_override'
|
181 |
'form_email_from_name_override' => $form_from_name_override,
|
182 |
-
'form_success_type'
|
183 |
-
'form_success_message'
|
184 |
-
'form_notification_setting'
|
185 |
-
'form_notification_email_name'
|
186 |
-
'form_notification_email_from'
|
187 |
-
'form_notification_email'
|
188 |
-
'form_notification_subject'
|
189 |
-
'form_notification_message'
|
190 |
-
'form_notification_entry'
|
191 |
-
'form_label_alignment'
|
192 |
);
|
193 |
|
194 |
$where = array( 'form_id' => $form_id );
|
195 |
|
196 |
-
// Update form details
|
197 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, $newdata, $where );
|
198 |
|
199 |
$field_ids = array();
|
200 |
|
201 |
-
foreach ( $_POST['field_id'] as $fields ) {
|
202 |
-
|
203 |
}
|
204 |
|
205 |
-
// Initialize field sequence
|
206 |
$field_sequence = 0;
|
207 |
|
208 |
-
// Loop through each field and update
|
209 |
foreach ( $field_ids as $id ) {
|
210 |
$id = absint( $id );
|
211 |
|
212 |
-
$field_name
|
213 |
-
$field_key
|
214 |
-
$field_desc
|
215 |
-
$field_options
|
216 |
-
$field_validation
|
217 |
-
$field_required
|
218 |
-
$field_size
|
219 |
-
$field_css
|
220 |
-
$field_layout
|
221 |
-
$field_default
|
222 |
|
223 |
$field_data = array(
|
224 |
-
'field_key'
|
225 |
-
'field_name'
|
226 |
'field_description' => $field_desc,
|
227 |
-
'field_options'
|
228 |
-
'field_validation'
|
229 |
-
'field_required'
|
230 |
-
'field_size'
|
231 |
-
'field_css'
|
232 |
-
'field_layout'
|
233 |
-
'field_sequence'
|
234 |
-
'field_default'
|
235 |
);
|
236 |
|
237 |
$where = array(
|
238 |
-
'form_id'
|
239 |
-
'field_id'
|
240 |
);
|
241 |
|
242 |
-
// Update all fields
|
243 |
$wpdb->update( VFB_WP_FIELDS_TABLE_NAME, $field_data, $where );
|
244 |
|
245 |
$field_sequence++;
|
@@ -248,111 +257,119 @@ class Visual_Form_Builder_Admin_Save {
|
|
248 |
|
249 |
/**
|
250 |
* [save_trash_delete_form description]
|
|
|
251 |
* @return [type] [description]
|
252 |
*/
|
253 |
public function save_trash_delete_form() {
|
254 |
global $wpdb;
|
255 |
|
256 |
-
if ( !isset( $_GET['action'] ) || !isset( $_GET['page'] ) )
|
257 |
return;
|
|
|
258 |
|
259 |
-
if ( 'visual-form-builder' !== $_GET['page'] )
|
260 |
return;
|
|
|
261 |
|
262 |
-
if ( 'delete_form' !== $_GET['action'] )
|
263 |
return;
|
|
|
264 |
|
265 |
-
$id = absint( $_GET['form'] );
|
266 |
|
267 |
check_admin_referer( 'delete-form-' . $id );
|
268 |
|
269 |
-
// Delete form and all fields
|
270 |
-
$wpdb->query( $wpdb->prepare(
|
271 |
-
$wpdb->query( $wpdb->prepare(
|
272 |
-
$wpdb->query( $wpdb->prepare(
|
273 |
|
274 |
-
// Redirect to keep the URL clean (use AJAX in the future?)
|
275 |
wp_redirect( add_query_arg( 'action', 'deleted', 'admin.php?page=visual-form-builder' ) );
|
276 |
exit();
|
277 |
}
|
278 |
|
279 |
/**
|
280 |
* [save_copy_form description]
|
|
|
281 |
* @return [type] [description]
|
282 |
*/
|
283 |
public function save_copy_form() {
|
284 |
global $wpdb;
|
285 |
|
286 |
-
if ( !isset( $_GET['action'] ) || !isset( $_GET['page'] ) )
|
287 |
return;
|
|
|
288 |
|
289 |
-
if ( 'visual-form-builder' !== $_GET['page'] )
|
290 |
return;
|
|
|
291 |
|
292 |
-
if ( 'copy_form' !== $_GET['action'] )
|
293 |
return;
|
|
|
294 |
|
295 |
-
$id = absint( $_GET['form'] );
|
296 |
|
297 |
check_admin_referer( 'copy-form-' . $id );
|
298 |
|
299 |
-
// Get all fields and data for the request form
|
300 |
-
$fields = $wpdb->get_results( $wpdb->prepare(
|
301 |
-
$forms = $wpdb->get_results( $wpdb->prepare(
|
302 |
-
$override = $wpdb->get_var( $wpdb->prepare(
|
303 |
$from_name = $wpdb->get_var( null, 1 );
|
304 |
$notify = $wpdb->get_var( null, 2 );
|
305 |
|
306 |
-
// Copy this form and force the initial title to denote a copy
|
307 |
foreach ( $forms as $form ) {
|
308 |
$data = array(
|
309 |
-
'form_key'
|
310 |
-
'form_title'
|
311 |
-
'form_email_subject'
|
312 |
-
'form_email_to'
|
313 |
-
'form_email_from'
|
314 |
-
'form_email_from_name'
|
315 |
-
'form_email_from_override'
|
316 |
'form_email_from_name_override' => $form->form_email_from_name_override,
|
317 |
-
'form_success_type'
|
318 |
-
'form_success_message'
|
319 |
-
'form_notification_setting'
|
320 |
-
'form_notification_email_name'
|
321 |
-
'form_notification_email_from'
|
322 |
-
'form_notification_email'
|
323 |
-
'form_notification_subject'
|
324 |
-
'form_notification_message'
|
325 |
-
'form_notification_entry'
|
326 |
-
'form_label_alignment'
|
327 |
);
|
328 |
|
329 |
$wpdb->insert( VFB_WP_FORMS_TABLE_NAME, $data );
|
330 |
}
|
331 |
|
332 |
-
// Get form ID to add our first field
|
333 |
$new_form_selected = $wpdb->insert_id;
|
334 |
|
335 |
-
// Copy each field and data
|
336 |
foreach ( $fields as $field ) {
|
337 |
$data = array(
|
338 |
-
'form_id'
|
339 |
-
'field_key'
|
340 |
-
'field_type'
|
341 |
-
'field_name'
|
342 |
'field_description' => $field->field_description,
|
343 |
-
'field_options'
|
344 |
-
'field_sequence'
|
345 |
-
'field_validation'
|
346 |
-
'field_required'
|
347 |
-
'field_size'
|
348 |
-
'field_css'
|
349 |
-
'field_layout'
|
350 |
-
'field_parent'
|
351 |
);
|
352 |
|
353 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $data );
|
354 |
|
355 |
-
// If a parent field, save the old ID and the new ID to update new parent ID
|
356 |
if ( in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) ) {
|
357 |
$parents[ $field->field_id ] = $wpdb->insert_id;
|
358 |
}
|
@@ -361,7 +378,6 @@ class Visual_Form_Builder_Admin_Save {
|
|
361 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, array( 'form_email_from_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
|
362 |
}
|
363 |
|
364 |
-
|
365 |
if ( $from_name == $field->field_id ) {
|
366 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, array( 'form_email_from_name_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
|
367 |
}
|
@@ -371,29 +387,40 @@ class Visual_Form_Builder_Admin_Save {
|
|
371 |
}
|
372 |
}
|
373 |
|
374 |
-
// Loop through our parents and update them to their new IDs
|
375 |
foreach ( $parents as $k => $v ) {
|
376 |
-
$wpdb->update(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
}
|
378 |
|
379 |
-
// Redirect to keep the URL clean (use AJAX in the future?)
|
380 |
-
|
381 |
exit();
|
382 |
}
|
383 |
|
384 |
/**
|
385 |
* [save_settings description]
|
|
|
386 |
* @return [type] [description]
|
387 |
*/
|
388 |
public function save_settings() {
|
389 |
-
if ( !isset( $_POST['action'] ) || !isset( $_GET['page'] ) )
|
390 |
return;
|
|
|
391 |
|
392 |
-
if ( 'vfb-settings' !== $_GET['page'] )
|
393 |
return;
|
|
|
394 |
|
395 |
-
if ( 'vfb_settings' !== $_POST['action'] )
|
396 |
return;
|
|
|
397 |
|
398 |
check_admin_referer( 'vfb-update-settings' );
|
399 |
|
@@ -405,8 +432,10 @@ class Visual_Form_Builder_Admin_Save {
|
|
405 |
|
406 |
$data = array();
|
407 |
|
408 |
-
|
409 |
-
$
|
|
|
|
|
410 |
}
|
411 |
|
412 |
update_option( 'vfb-settings', $data );
|
@@ -414,14 +443,10 @@ class Visual_Form_Builder_Admin_Save {
|
|
414 |
|
415 |
/**
|
416 |
* Uninstall plugin.
|
417 |
-
*
|
418 |
* Run uninstall on Settings page instead of Plugins page so we can
|
419 |
* keep VFB files on the server.
|
420 |
*
|
421 |
-
* @
|
422 |
-
* @param mixed $license_key
|
423 |
-
* @param mixed $license_email
|
424 |
-
* @return void
|
425 |
*/
|
426 |
private function uninstall_plugin() {
|
427 |
$uninstall = new Visual_Form_Builder_Admin_Uninstall();
|
24 |
public function add_new_form() {
|
25 |
global $wpdb;
|
26 |
|
27 |
+
if ( ! isset( $_POST['action'] ) || ! isset( $_GET['page'] ) ) {
|
28 |
return;
|
29 |
+
}
|
30 |
|
31 |
+
if ( 'vfb-add-new' !== $_GET['page'] ) {
|
32 |
return;
|
33 |
+
}
|
34 |
|
35 |
+
if ( 'create_form' !== $_POST['action'] ) {
|
36 |
return;
|
37 |
+
}
|
38 |
|
39 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
40 |
+
wp_die( esc_html__( 'You do not have sufficient permissions to create a new form.', 'visual-form-builder' ) );
|
41 |
+
}
|
42 |
|
43 |
check_admin_referer( 'create_form' );
|
44 |
|
45 |
+
$form_key = isset( $_POST['form_title'] ) ? sanitize_title( wp_unslash( $_POST['form_title'] ) ) : '';
|
46 |
+
$form_title = isset( $_POST['form_title'] ) ? sanitize_text_field( wp_unslash( $_POST['form_title'] ) ) : '';
|
47 |
+
$form_from_name = isset( $_POST['form_email_from_name'] ) ? sanitize_text_field( wp_unslash( $_POST['form_email_from_name'] ) ) : '';
|
48 |
+
$form_subject = isset( $_POST['form_email_subject'] ) ? sanitize_text_field( wp_unslash( $_POST['form_email_subject'] ) ) : '';
|
49 |
+
$form_from = isset( $_POST['form_email_from'] ) ? sanitize_email( wp_unslash( $_POST['form_email_from'] ) ) : '';
|
50 |
+
$form_to = isset( $_POST['form_email_to'] ) ? serialize( sanitize_email( wp_unslash( $_POST['form_email_to'] ) ) ) : '';
|
51 |
|
52 |
$newdata = array(
|
53 |
+
'form_key' => $form_key,
|
54 |
+
'form_title' => $form_title,
|
55 |
+
'form_email_from_name' => $form_from_name,
|
56 |
+
'form_email_subject' => $form_subject,
|
57 |
+
'form_email_from' => $form_from,
|
58 |
+
'form_email_to' => $form_to,
|
59 |
+
'form_success_message' => '<p id="form_success">Your form was successfully submitted. Thank you for contacting us.</p>',
|
60 |
);
|
61 |
|
62 |
+
// Create the form.
|
63 |
$wpdb->insert( VFB_WP_FORMS_TABLE_NAME, $newdata );
|
64 |
|
65 |
+
// Get form ID to add our first field.
|
66 |
$new_form_selected = $wpdb->insert_id;
|
67 |
|
68 |
+
// Setup the initial fieldset.
|
69 |
$initial_fieldset = array(
|
70 |
+
'form_id' => $wpdb->insert_id,
|
71 |
+
'field_key' => 'fieldset',
|
72 |
+
'field_type' => 'fieldset',
|
73 |
+
'field_name' => 'Fieldset',
|
74 |
+
'field_sequence' => 0,
|
75 |
);
|
76 |
|
77 |
+
// Add the first fieldset to get things started.
|
78 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $initial_fieldset );
|
79 |
|
80 |
$verification_fieldset = array(
|
81 |
+
'form_id' => $new_form_selected,
|
82 |
+
'field_key' => 'verification',
|
83 |
+
'field_type' => 'verification',
|
84 |
+
'field_name' => 'Verification',
|
85 |
'field_description' => '(This is for preventing spam)',
|
86 |
+
'field_sequence' => 1,
|
87 |
);
|
88 |
|
89 |
+
// Insert the submit field.
|
90 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $verification_fieldset );
|
91 |
|
92 |
$verify_fieldset_parent_id = $wpdb->insert_id;
|
93 |
|
94 |
$secret = array(
|
95 |
+
'form_id' => $new_form_selected,
|
96 |
+
'field_key' => 'secret',
|
97 |
+
'field_type' => 'secret',
|
98 |
+
'field_name' => 'Please enter any two digits',
|
99 |
+
'field_description' => 'Example: 12',
|
100 |
+
'field_size' => 'medium',
|
101 |
+
'field_required' => 'yes',
|
102 |
+
'field_parent' => $verify_fieldset_parent_id,
|
103 |
+
'field_sequence' => 2,
|
104 |
);
|
105 |
|
106 |
+
// Insert the submit field.
|
107 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $secret );
|
108 |
|
109 |
+
// Make the submit last in the sequence.
|
110 |
$submit = array(
|
111 |
+
'form_id' => $new_form_selected,
|
112 |
+
'field_key' => 'submit',
|
113 |
+
'field_type' => 'submit',
|
114 |
+
'field_name' => 'Submit',
|
115 |
+
'field_parent' => $verify_fieldset_parent_id,
|
116 |
+
'field_sequence' => 3,
|
117 |
);
|
118 |
|
119 |
+
// Insert the submit field.
|
120 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $submit );
|
121 |
|
122 |
+
$redirect = admin_url( 'admin.php?page=visual-form-builder' );
|
123 |
+
|
124 |
+
wp_redirect( esc_url_raw( $redirect ) );
|
125 |
exit();
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
* [save_update_form description]
|
130 |
+
*
|
131 |
* @return [type] [description]
|
132 |
*/
|
133 |
public function save_update_form() {
|
134 |
global $wpdb;
|
135 |
|
136 |
+
if ( ! isset( $_POST['action'] ) || ! isset( $_GET['page'] ) ) {
|
137 |
return;
|
138 |
+
}
|
139 |
|
140 |
+
if ( 'visual-form-builder' !== $_GET['page'] ) {
|
141 |
return;
|
142 |
+
}
|
143 |
|
144 |
+
if ( 'update_form' !== $_POST['action'] ) {
|
145 |
return;
|
146 |
+
}
|
147 |
|
148 |
check_admin_referer( 'vfb_update_form' );
|
149 |
|
150 |
+
$form_id = isset( $_POST['form_id'] ) ? absint( wp_unslash( $_POST['form_id'] ) ) : '';
|
151 |
+
$form_key = isset( $_POST['form_title'] ) ? sanitize_title( wp_unslash( $_POST['form_title'] ), $form_id ) : '';
|
152 |
+
$form_title = isset( $_POST['form_title'] ) ? sanitize_text_field( wp_unslash( $_POST['form_title'] ) ) : '';
|
153 |
+
$form_subject = isset( $_POST['form_email_subject'] ) ? sanitize_text_field( wp_unslash( $_POST['form_email_subject'] ) ) : '';
|
154 |
+
$form_to = isset( $_POST['form_email_to'] ) ? serialize( array_map( 'sanitize_email', wp_unslash( $_POST['form_email_to'] ) ) ) : '';
|
155 |
+
$form_from = isset( $_POST['form_email_from'] ) ? sanitize_email( wp_unslash( $_POST['form_email_from'] ) ) : '';
|
156 |
+
$form_from_name = isset( $_POST['form_email_from_name'] ) ? sanitize_text_field( wp_unslash( $_POST['form_email_from_name'] ) ) : '';
|
157 |
+
$form_from_override = isset( $_POST['form_email_from_override'] ) ? absint( $_POST['form_email_from_override'] ) : '';
|
158 |
+
$form_from_name_override = isset( $_POST['form_email_from_name_override'] ) ? absint( $_POST['form_email_from_name_override'] ) : '';
|
159 |
+
$form_success_type = isset( $_POST['form_success_type'] ) ? sanitize_text_field( wp_unslash( $_POST['form_success_type'] ) ) : '';
|
160 |
+
$form_notification_setting = isset( $_POST['form_notification_setting'] ) ? absint( $_POST['form_notification_setting'] ) : '';
|
161 |
+
$form_notification_email_name = isset( $_POST['form_notification_email_name'] ) ? sanitize_text_field( wp_unslash( $_POST['form_notification_email_name'] ) ) : '';
|
162 |
+
$form_notification_email_from = isset( $_POST['form_notification_email_from'] ) ? sanitize_email( wp_unslash( $_POST['form_notification_email_from'] ) ) : '';
|
163 |
+
$form_notification_email = isset( $_POST['form_notification_email'] ) ? absint( $_POST['form_notification_email'] ) : '';
|
164 |
+
$form_notification_subject = isset( $_POST['form_notification_subject'] ) ? sanitize_text_field( wp_unslash( $_POST['form_notification_subject'] ) ) : '';
|
165 |
+
$form_notification_message = isset( $_POST['form_notification_message'] ) ? format_for_editor( wp_kses_post( wp_unslash( $_POST['form_notification_message'] ) ) ) : '';
|
166 |
+
$form_notification_entry = isset( $_POST['form_notification_entry'] ) ? absint( $_POST['form_notification_entry'] ) : '';
|
167 |
+
$form_label_alignment = isset( $_POST['form_label_alignment'] ) ? sanitize_text_field( wp_unslash( $_POST['form_label_alignment'] ) ) : '';
|
168 |
+
|
169 |
+
// Add confirmation based on which type was selected.
|
170 |
switch ( $form_success_type ) {
|
171 |
+
case 'text':
|
172 |
+
$form_success_message = isset( $_POST['form_success_message_text'] ) ? format_for_editor( wp_kses_post( wp_unslash( $_POST['form_success_message_text'] ) ) ) : '';
|
173 |
+
break;
|
174 |
+
case 'page':
|
175 |
+
$form_success_message = isset( $_POST['form_success_message_page'] ) ? absint( $_POST['form_success_message_page'] ) : '';
|
176 |
+
break;
|
177 |
+
case 'redirect':
|
178 |
+
$form_success_message = isset( $_POST['form_success_message_redirect'] ) ? esc_url_raw( wp_unslash( $_POST['form_success_message_redirect'] ) ) : '';
|
179 |
+
break;
|
180 |
}
|
181 |
|
182 |
$newdata = array(
|
183 |
+
'form_key' => $form_key,
|
184 |
+
'form_title' => $form_title,
|
185 |
+
'form_email_subject' => $form_subject,
|
186 |
+
'form_email_to' => $form_to,
|
187 |
+
'form_email_from' => $form_from,
|
188 |
+
'form_email_from_name' => $form_from_name,
|
189 |
+
'form_email_from_override' => $form_from_override,
|
190 |
'form_email_from_name_override' => $form_from_name_override,
|
191 |
+
'form_success_type' => $form_success_type,
|
192 |
+
'form_success_message' => $form_success_message,
|
193 |
+
'form_notification_setting' => $form_notification_setting,
|
194 |
+
'form_notification_email_name' => $form_notification_email_name,
|
195 |
+
'form_notification_email_from' => $form_notification_email_from,
|
196 |
+
'form_notification_email' => $form_notification_email,
|
197 |
+
'form_notification_subject' => $form_notification_subject,
|
198 |
+
'form_notification_message' => $form_notification_message,
|
199 |
+
'form_notification_entry' => $form_notification_entry,
|
200 |
+
'form_label_alignment' => $form_label_alignment,
|
201 |
);
|
202 |
|
203 |
$where = array( 'form_id' => $form_id );
|
204 |
|
205 |
+
// Update form details.
|
206 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, $newdata, $where );
|
207 |
|
208 |
$field_ids = array();
|
209 |
|
210 |
+
foreach ( wp_unslash( $_POST['field_id'] ) as $fields ) {
|
211 |
+
$field_ids[] = $fields;
|
212 |
}
|
213 |
|
214 |
+
// Initialize field sequence.
|
215 |
$field_sequence = 0;
|
216 |
|
217 |
+
// Loop through each field and update.
|
218 |
foreach ( $field_ids as $id ) {
|
219 |
$id = absint( $id );
|
220 |
|
221 |
+
$field_name = isset( $_POST[ 'field_name-' . $id ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'field_name-' . $id ] ) ) : '';
|
222 |
+
$field_key = sanitize_key( sanitize_title( $field_name, $id ) );
|
223 |
+
$field_desc = isset( $_POST[ 'field_description-' . $id ] ) ? sanitize_textarea_field( wp_unslash( $_POST[ 'field_description-' . $id ] ) ) : '';
|
224 |
+
$field_options = isset( $_POST[ 'field_options-' . $id ] ) ? serialize( array_map( 'sanitize_text_field', wp_unslash( $_POST[ 'field_options-' . $id ] ) ) ) : '';
|
225 |
+
$field_validation = isset( $_POST[ 'field_validation-' . $id ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'field_validation-' . $id ] ) ) : '';
|
226 |
+
$field_required = isset( $_POST[ 'field_required-' . $id ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'field_required-' . $id ] ) ) : '';
|
227 |
+
$field_size = isset( $_POST[ 'field_size-' . $id ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'field_size-' . $id ] ) ) : '';
|
228 |
+
$field_css = isset( $_POST[ 'field_css-' . $id ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'field_css-' . $id ] ) ) : '';
|
229 |
+
$field_layout = isset( $_POST[ 'field_layout-' . $id ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'field_layout-' . $id ] ) ) : '';
|
230 |
+
$field_default = isset( $_POST[ 'field_default-' . $id ] ) ? sanitize_text_field( wp_unslash( $_POST[ 'field_default-' . $id ] ) ) : '';
|
231 |
|
232 |
$field_data = array(
|
233 |
+
'field_key' => $field_key,
|
234 |
+
'field_name' => $field_name,
|
235 |
'field_description' => $field_desc,
|
236 |
+
'field_options' => $field_options,
|
237 |
+
'field_validation' => $field_validation,
|
238 |
+
'field_required' => $field_required,
|
239 |
+
'field_size' => $field_size,
|
240 |
+
'field_css' => $field_css,
|
241 |
+
'field_layout' => $field_layout,
|
242 |
+
'field_sequence' => $field_sequence,
|
243 |
+
'field_default' => $field_default,
|
244 |
);
|
245 |
|
246 |
$where = array(
|
247 |
+
'form_id' => $form_id,
|
248 |
+
'field_id' => $id,
|
249 |
);
|
250 |
|
251 |
+
// Update all fields.
|
252 |
$wpdb->update( VFB_WP_FIELDS_TABLE_NAME, $field_data, $where );
|
253 |
|
254 |
$field_sequence++;
|
257 |
|
258 |
/**
|
259 |
* [save_trash_delete_form description]
|
260 |
+
*
|
261 |
* @return [type] [description]
|
262 |
*/
|
263 |
public function save_trash_delete_form() {
|
264 |
global $wpdb;
|
265 |
|
266 |
+
if ( ! isset( $_GET['action'] ) || ! isset( $_GET['page'] ) ) {
|
267 |
return;
|
268 |
+
}
|
269 |
|
270 |
+
if ( 'visual-form-builder' !== $_GET['page'] ) {
|
271 |
return;
|
272 |
+
}
|
273 |
|
274 |
+
if ( 'delete_form' !== $_GET['action'] ) {
|
275 |
return;
|
276 |
+
}
|
277 |
|
278 |
+
$id = isset( $_GET['form'] ) ? absint( $_GET['form'] ) : 0;
|
279 |
|
280 |
check_admin_referer( 'delete-form-' . $id );
|
281 |
|
282 |
+
// Delete form and all fields.
|
283 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_FORMS_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
284 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_FIELDS_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
285 |
+
$wpdb->query( $wpdb->prepare( 'DELETE FROM ' . VFB_WP_ENTRIES_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
286 |
|
287 |
+
// Redirect to keep the URL clean (use AJAX in the future?).
|
288 |
wp_redirect( add_query_arg( 'action', 'deleted', 'admin.php?page=visual-form-builder' ) );
|
289 |
exit();
|
290 |
}
|
291 |
|
292 |
/**
|
293 |
* [save_copy_form description]
|
294 |
+
*
|
295 |
* @return [type] [description]
|
296 |
*/
|
297 |
public function save_copy_form() {
|
298 |
global $wpdb;
|
299 |
|
300 |
+
if ( ! isset( $_GET['action'] ) || ! isset( $_GET['page'] ) ) {
|
301 |
return;
|
302 |
+
}
|
303 |
|
304 |
+
if ( 'visual-form-builder' !== $_GET['page'] ) {
|
305 |
return;
|
306 |
+
}
|
307 |
|
308 |
+
if ( 'copy_form' !== $_GET['action'] ) {
|
309 |
return;
|
310 |
+
}
|
311 |
|
312 |
+
$id = isset( $_GET['form'] ) ? absint( $_GET['form'] ) : 0;
|
313 |
|
314 |
check_admin_referer( 'copy-form-' . $id );
|
315 |
|
316 |
+
// Get all fields and data for the request form.
|
317 |
+
$fields = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FIELDS_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
318 |
+
$forms = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FORMS_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
319 |
+
$override = $wpdb->get_var( $wpdb->prepare( 'SELECT form_email_from_override, form_email_from_name_override, form_notification_email FROM ' . VFB_WP_FORMS_TABLE_NAME . ' WHERE form_id = %d', $id ) );
|
320 |
$from_name = $wpdb->get_var( null, 1 );
|
321 |
$notify = $wpdb->get_var( null, 2 );
|
322 |
|
323 |
+
// Copy this form and force the initial title to denote a copy.
|
324 |
foreach ( $forms as $form ) {
|
325 |
$data = array(
|
326 |
+
'form_key' => sanitize_title( $form->form_key . ' copy' ),
|
327 |
+
'form_title' => $form->form_title . ' Copy',
|
328 |
+
'form_email_subject' => $form->form_email_subject,
|
329 |
+
'form_email_to' => $form->form_email_to,
|
330 |
+
'form_email_from' => $form->form_email_from,
|
331 |
+
'form_email_from_name' => $form->form_email_from_name,
|
332 |
+
'form_email_from_override' => $form->form_email_from_override,
|
333 |
'form_email_from_name_override' => $form->form_email_from_name_override,
|
334 |
+
'form_success_type' => $form->form_success_type,
|
335 |
+
'form_success_message' => $form->form_success_message,
|
336 |
+
'form_notification_setting' => $form->form_notification_setting,
|
337 |
+
'form_notification_email_name' => $form->form_notification_email_name,
|
338 |
+
'form_notification_email_from' => $form->form_notification_email_from,
|
339 |
+
'form_notification_email' => $form->form_notification_email,
|
340 |
+
'form_notification_subject' => $form->form_notification_subject,
|
341 |
+
'form_notification_message' => $form->form_notification_message,
|
342 |
+
'form_notification_entry' => $form->form_notification_entry,
|
343 |
+
'form_label_alignment' => $form->form_label_alignment,
|
344 |
);
|
345 |
|
346 |
$wpdb->insert( VFB_WP_FORMS_TABLE_NAME, $data );
|
347 |
}
|
348 |
|
349 |
+
// Get form ID to add our first field.
|
350 |
$new_form_selected = $wpdb->insert_id;
|
351 |
|
352 |
+
// Copy each field and data.
|
353 |
foreach ( $fields as $field ) {
|
354 |
$data = array(
|
355 |
+
'form_id' => $new_form_selected,
|
356 |
+
'field_key' => $field->field_key,
|
357 |
+
'field_type' => $field->field_type,
|
358 |
+
'field_name' => $field->field_name,
|
359 |
'field_description' => $field->field_description,
|
360 |
+
'field_options' => $field->field_options,
|
361 |
+
'field_sequence' => $field->field_sequence,
|
362 |
+
'field_validation' => $field->field_validation,
|
363 |
+
'field_required' => $field->field_required,
|
364 |
+
'field_size' => $field->field_size,
|
365 |
+
'field_css' => $field->field_css,
|
366 |
+
'field_layout' => $field->field_layout,
|
367 |
+
'field_parent' => $field->field_parent,
|
368 |
);
|
369 |
|
370 |
$wpdb->insert( VFB_WP_FIELDS_TABLE_NAME, $data );
|
371 |
|
372 |
+
// If a parent field, save the old ID and the new ID to update new parent ID.
|
373 |
if ( in_array( $field->field_type, array( 'fieldset', 'section', 'verification' ) ) ) {
|
374 |
$parents[ $field->field_id ] = $wpdb->insert_id;
|
375 |
}
|
378 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, array( 'form_email_from_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
|
379 |
}
|
380 |
|
|
|
381 |
if ( $from_name == $field->field_id ) {
|
382 |
$wpdb->update( VFB_WP_FORMS_TABLE_NAME, array( 'form_email_from_name_override' => $wpdb->insert_id ), array( 'form_id' => $new_form_selected ) );
|
383 |
}
|
387 |
}
|
388 |
}
|
389 |
|
390 |
+
// Loop through our parents and update them to their new IDs.
|
391 |
foreach ( $parents as $k => $v ) {
|
392 |
+
$wpdb->update(
|
393 |
+
VFB_WP_FIELDS_TABLE_NAME,
|
394 |
+
array( 'field_parent' => $v ),
|
395 |
+
array(
|
396 |
+
'form_id' => $new_form_selected,
|
397 |
+
'field_parent' => $k,
|
398 |
+
)
|
399 |
+
);
|
400 |
}
|
401 |
|
402 |
+
// Redirect to keep the URL clean (use AJAX in the future?).
|
403 |
+
wp_safe_redirect( 'admin.php?page=visual-form-builder&action=edit&form=' . $new_form_selected );
|
404 |
exit();
|
405 |
}
|
406 |
|
407 |
/**
|
408 |
* [save_settings description]
|
409 |
+
*
|
410 |
* @return [type] [description]
|
411 |
*/
|
412 |
public function save_settings() {
|
413 |
+
if ( ! isset( $_POST['action'] ) || ! isset( $_GET['page'] ) ) {
|
414 |
return;
|
415 |
+
}
|
416 |
|
417 |
+
if ( 'vfb-settings' !== $_GET['page'] ) {
|
418 |
return;
|
419 |
+
}
|
420 |
|
421 |
+
if ( 'vfb_settings' !== $_POST['action'] ) {
|
422 |
return;
|
423 |
+
}
|
424 |
|
425 |
check_admin_referer( 'vfb-update-settings' );
|
426 |
|
432 |
|
433 |
$data = array();
|
434 |
|
435 |
+
if ( isset( $_POST['vfb-settings'] ) ) {
|
436 |
+
foreach ( wp_unslash( $_POST['vfb-settings'] ) as $key => $val ) {
|
437 |
+
$data[ $key ] = sanitize_text_field( $val );
|
438 |
+
}
|
439 |
}
|
440 |
|
441 |
update_option( 'vfb-settings', $data );
|
443 |
|
444 |
/**
|
445 |
* Uninstall plugin.
|
|
|
446 |
* Run uninstall on Settings page instead of Plugins page so we can
|
447 |
* keep VFB files on the server.
|
448 |
*
|
449 |
+
* @return void
|
|
|
|
|
|
|
450 |
*/
|
451 |
private function uninstall_plugin() {
|
452 |
$uninstall = new Visual_Form_Builder_Admin_Uninstall();
|
admin/class-screen-options.php
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
* Handle Screen Options
|
4 |
*
|
5 |
* Defines and saves all options in Screen Options tabs
|
6 |
-
*
|
7 |
*/
|
8 |
class Visual_Form_Builder_Admin_Screen_Options {
|
9 |
|
@@ -15,16 +14,22 @@ class Visual_Form_Builder_Admin_Screen_Options {
|
|
15 |
*/
|
16 |
public function add_option() {
|
17 |
if ( isset( $_GET['form'] ) ) {
|
18 |
-
add_screen_option(
|
19 |
-
'
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
} else {
|
23 |
-
add_screen_option(
|
24 |
-
'
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
}
|
29 |
}
|
30 |
|
@@ -32,29 +37,33 @@ class Visual_Form_Builder_Admin_Screen_Options {
|
|
32 |
* Add options to Entries page
|
33 |
*/
|
34 |
public function add_option_entries() {
|
35 |
-
add_screen_option(
|
36 |
-
'
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
* Save Screen Options
|
44 |
*
|
45 |
-
* @
|
46 |
-
* @param
|
47 |
-
* @param
|
48 |
-
*
|
49 |
-
* @return
|
50 |
*/
|
51 |
public function save_option( $status, $option, $value ) {
|
52 |
-
|
53 |
-
if ( 'vfb_forms_per_page' == $option )
|
54 |
return $value;
|
|
|
55 |
|
56 |
-
if ( 'vfb_entries_per_page' == $option )
|
57 |
return $value;
|
|
|
58 |
|
59 |
return $status;
|
60 |
}
|
3 |
* Handle Screen Options
|
4 |
*
|
5 |
* Defines and saves all options in Screen Options tabs
|
|
|
6 |
*/
|
7 |
class Visual_Form_Builder_Admin_Screen_Options {
|
8 |
|
14 |
*/
|
15 |
public function add_option() {
|
16 |
if ( isset( $_GET['form'] ) ) {
|
17 |
+
add_screen_option(
|
18 |
+
'layout_columns',
|
19 |
+
array(
|
20 |
+
'max' => 2,
|
21 |
+
'default' => 2,
|
22 |
+
)
|
23 |
+
);
|
24 |
} else {
|
25 |
+
add_screen_option(
|
26 |
+
'per_page',
|
27 |
+
array(
|
28 |
+
'label' => __( 'Forms per page', 'visual-form-builder' ),
|
29 |
+
'default' => 20,
|
30 |
+
'option' => 'vfb_forms_per_page',
|
31 |
+
)
|
32 |
+
);
|
33 |
}
|
34 |
}
|
35 |
|
37 |
* Add options to Entries page
|
38 |
*/
|
39 |
public function add_option_entries() {
|
40 |
+
add_screen_option(
|
41 |
+
'per_page',
|
42 |
+
array(
|
43 |
+
'label' => __( 'Entries per page', 'visual-form-builder' ),
|
44 |
+
'default' => 20,
|
45 |
+
'option' => 'vfb_entries_per_page',
|
46 |
+
)
|
47 |
+
);
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Save Screen Options
|
52 |
*
|
53 |
+
* @param [type] $status Return this so we don't break other plugins.
|
54 |
+
* @param [type] $option The option name.
|
55 |
+
* @param [type] $value The submitted value.
|
56 |
+
*
|
57 |
+
* @return [type] [return description]
|
58 |
*/
|
59 |
public function save_option( $status, $option, $value ) {
|
60 |
+
if ( 'vfb_forms_per_page' == $option ) {
|
|
|
61 |
return $value;
|
62 |
+
}
|
63 |
|
64 |
+
if ( 'vfb_entries_per_page' == $option ) {
|
65 |
return $value;
|
66 |
+
}
|
67 |
|
68 |
return $status;
|
69 |
}
|
admin/class-widget.php
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
function vfb_register_widgets() {
|
6 |
register_widget( 'Visual_Form_Builder_Widget' );
|
7 |
}
|
|
|
8 |
|
9 |
/**
|
10 |
* Class that builds our Import page
|
@@ -15,91 +18,93 @@ class Visual_Form_Builder_Widget extends WP_Widget {
|
|
15 |
/**
|
16 |
* [__construct description]
|
17 |
*/
|
18 |
-
public function __construct(){
|
19 |
parent::__construct(
|
20 |
'vfb_widget',
|
21 |
__( 'Visual Form Builder', 'visual-form-builder' ),
|
22 |
array(
|
23 |
'classname' => 'vfb_widget_class',
|
24 |
-
'description' =>
|
25 |
)
|
26 |
);
|
27 |
}
|
28 |
|
29 |
/**
|
30 |
* [form description]
|
31 |
-
*
|
32 |
-
* @
|
|
|
|
|
33 |
*/
|
34 |
public function form( $instance ) {
|
35 |
global $wpdb;
|
36 |
|
37 |
-
// Query to get all forms
|
38 |
$order = sanitize_sql_orderby( 'form_id ASC' );
|
39 |
$where = apply_filters( 'vfb_pre_get_forms_widget', '' );
|
40 |
-
$forms = $wpdb->get_results(
|
41 |
|
42 |
$instance = wp_parse_args( (array) $instance );
|
43 |
|
44 |
-
$title = isset( $instance[
|
45 |
?>
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
<?php
|
67 |
}
|
68 |
|
69 |
/**
|
70 |
* [widget description]
|
71 |
-
*
|
72 |
-
* @param [type] $
|
73 |
-
* @
|
74 |
*/
|
75 |
public function widget( $args, $instance ) {
|
76 |
-
extract( $args );
|
77 |
-
|
78 |
$form_id = absint( $instance['id'] );
|
79 |
|
80 |
-
echo $before_widget;
|
81 |
|
82 |
-
// Title
|
83 |
-
if ( !empty( $instance['title'] ) )
|
84 |
-
echo $args['before_title'] . $instance['title'] . $args['after_title'];
|
|
|
85 |
|
86 |
-
// Print the output
|
87 |
-
echo do_shortcode(
|
88 |
|
89 |
-
echo $after_widget;
|
90 |
}
|
91 |
|
92 |
/**
|
93 |
* [update description]
|
94 |
-
*
|
95 |
-
* @param [type] $
|
|
|
96 |
* @return [type] [description]
|
97 |
*/
|
98 |
public function update( $new_instance, $old_instance ) {
|
99 |
$instance = array();
|
100 |
|
101 |
-
$instance['id']
|
102 |
-
$instance['title'] = !empty( $new_instance['title'] ) ?
|
103 |
|
104 |
return $instance;
|
105 |
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* [vfb_register_widgets description]
|
4 |
+
*
|
5 |
+
* @return void
|
6 |
+
*/
|
7 |
function vfb_register_widgets() {
|
8 |
register_widget( 'Visual_Form_Builder_Widget' );
|
9 |
}
|
10 |
+
add_action( 'widgets_init', 'vfb_register_widgets' );
|
11 |
|
12 |
/**
|
13 |
* Class that builds our Import page
|
18 |
/**
|
19 |
* [__construct description]
|
20 |
*/
|
21 |
+
public function __construct() {
|
22 |
parent::__construct(
|
23 |
'vfb_widget',
|
24 |
__( 'Visual Form Builder', 'visual-form-builder' ),
|
25 |
array(
|
26 |
'classname' => 'vfb_widget_class',
|
27 |
+
'description' => esc_html__( 'Visual Form Builder Widget', 'visual-form-builder' ),
|
28 |
)
|
29 |
);
|
30 |
}
|
31 |
|
32 |
/**
|
33 |
* [form description]
|
34 |
+
*
|
35 |
+
* @param [type] $instance [$instance description].
|
36 |
+
*
|
37 |
+
* @return void
|
38 |
*/
|
39 |
public function form( $instance ) {
|
40 |
global $wpdb;
|
41 |
|
42 |
+
// Query to get all forms.
|
43 |
$order = sanitize_sql_orderby( 'form_id ASC' );
|
44 |
$where = apply_filters( 'vfb_pre_get_forms_widget', '' );
|
45 |
+
$forms = $wpdb->get_results( 'SELECT * FROM ' . VFB_WP_FORMS_TABLE_NAME . " WHERE 1=1 $where ORDER BY $order" );
|
46 |
|
47 |
$instance = wp_parse_args( (array) $instance );
|
48 |
|
49 |
+
$title = isset( $instance['title'] ) ? $instance['title'] : '';
|
50 |
?>
|
51 |
+
<p>
|
52 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _esc_html_e( 'Title:', 'visual-form-builder' ); ?></label>
|
53 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
54 |
+
</p>
|
55 |
+
<p>
|
56 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Form to display:', 'visual-form-builder' ); ?></label>
|
57 |
+
<select id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" class="widefat">
|
58 |
+
<?php
|
59 |
+
foreach ( $forms as $form ) {
|
60 |
+
echo sprintf(
|
61 |
+
'<option value="%1$d" id="%2$s"%3$s>%1$d - %4$s</option>',
|
62 |
+
absint( $form->form_id ),
|
63 |
+
esc_html( $form->form_key ),
|
64 |
+
selected( $form->form_id, $instance['id'], 1 ),
|
65 |
+
esc_html( wp_unslash( $form->form_title ) )
|
66 |
+
);
|
67 |
+
}
|
68 |
+
?>
|
69 |
+
</select>
|
70 |
+
</p>
|
71 |
<?php
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
* [widget description]
|
76 |
+
*
|
77 |
+
* @param [type] $args [description].
|
78 |
+
* @param [type] $instance [description].
|
79 |
*/
|
80 |
public function widget( $args, $instance ) {
|
|
|
|
|
81 |
$form_id = absint( $instance['id'] );
|
82 |
|
83 |
+
echo esc_html( $args['before_widget'] );
|
84 |
|
85 |
+
// Title.
|
86 |
+
if ( ! empty( $instance['title'] ) ) {
|
87 |
+
echo esc_html( $args['before_title'] . $instance['title'] . $args['after_title'] );
|
88 |
+
}
|
89 |
|
90 |
+
// Print the output.
|
91 |
+
echo do_shortcode( '[vfb id=' . wp_kses_post( $form_id ) . ']' );
|
92 |
|
93 |
+
echo esc_html( $args['after_widget'] );
|
94 |
}
|
95 |
|
96 |
/**
|
97 |
* [update description]
|
98 |
+
*
|
99 |
+
* @param [type] $new_instance [description].
|
100 |
+
* @param [type] $old_instance [description].
|
101 |
* @return [type] [description]
|
102 |
*/
|
103 |
public function update( $new_instance, $old_instance ) {
|
104 |
$instance = array();
|
105 |
|
106 |
+
$instance['id'] = ! empty( $new_instance['id'] ) ? absint( $new_instance['id'] ) : '';
|
107 |
+
$instance['title'] = ! empty( $new_instance['title'] ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
|
108 |
|
109 |
return $instance;
|
110 |
}
|
inc/class-i18n.php
CHANGED
@@ -5,53 +5,50 @@
|
|
5 |
* Loads and defines the internationalization files for this plugin
|
6 |
* so that its ready for translation.
|
7 |
*
|
8 |
-
* @since
|
9 |
*/
|
10 |
-
class
|
11 |
-
|
12 |
/**
|
13 |
* The domain specified for this plugin.
|
14 |
*
|
15 |
-
* @since
|
16 |
-
* @access
|
17 |
-
* @var
|
18 |
*/
|
19 |
private $domain;
|
20 |
|
21 |
/**
|
22 |
* Load the plugin text domain for translation.
|
23 |
*
|
24 |
-
* @since
|
25 |
*/
|
26 |
public function load_lang() {
|
27 |
|
28 |
-
// The "plugin_locale" filter is also used in load_plugin_textdomain()
|
29 |
$locale = apply_filters( 'plugin_locale', get_locale(), $this->domain );
|
30 |
|
31 |
$wp_lang_dir = WP_LANG_DIR . '/' . $this->domain . '/' . $locale . '.mo';
|
32 |
|
33 |
-
// Load translated strings from WP_LANG_DIR
|
34 |
load_textdomain( $this->domain, $wp_lang_dir );
|
35 |
|
36 |
-
// Main plugin path
|
37 |
-
$plugin_dir
|
38 |
|
39 |
-
// Lang folder path
|
40 |
-
$lang_dir
|
41 |
|
42 |
-
// Load translated strings, if no WP_LANG_DIR found
|
43 |
load_plugin_textdomain( $this->domain, false, $lang_dir );
|
44 |
-
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
* Set the domain equal to that of the specified domain.
|
49 |
*
|
50 |
-
* @since
|
51 |
-
* @param
|
52 |
*/
|
53 |
public function set_domain( $domain ) {
|
54 |
$this->domain = $domain;
|
55 |
}
|
56 |
-
|
57 |
}
|
5 |
* Loads and defines the internationalization files for this plugin
|
6 |
* so that its ready for translation.
|
7 |
*
|
8 |
+
* @since 1.0
|
9 |
*/
|
10 |
+
class Visual_Form_Builder_I18n {
|
|
|
11 |
/**
|
12 |
* The domain specified for this plugin.
|
13 |
*
|
14 |
+
* @since 1.0
|
15 |
+
* @access private
|
16 |
+
* @var string $domain The domain identifier for this plugin.
|
17 |
*/
|
18 |
private $domain;
|
19 |
|
20 |
/**
|
21 |
* Load the plugin text domain for translation.
|
22 |
*
|
23 |
+
* @since 1.0
|
24 |
*/
|
25 |
public function load_lang() {
|
26 |
|
27 |
+
// The "plugin_locale" filter is also used in load_plugin_textdomain().
|
28 |
$locale = apply_filters( 'plugin_locale', get_locale(), $this->domain );
|
29 |
|
30 |
$wp_lang_dir = WP_LANG_DIR . '/' . $this->domain . '/' . $locale . '.mo';
|
31 |
|
32 |
+
// Load translated strings from WP_LANG_DIR.
|
33 |
load_textdomain( $this->domain, $wp_lang_dir );
|
34 |
|
35 |
+
// Main plugin path.
|
36 |
+
$plugin_dir = VFB_WP_PLUGIN_FILE;
|
37 |
|
38 |
+
// Lang folder path.
|
39 |
+
$lang_dir = dirname( plugin_basename( $plugin_dir ) ) . '/lang/';
|
40 |
|
41 |
+
// Load translated strings, if no WP_LANG_DIR found.
|
42 |
load_plugin_textdomain( $this->domain, false, $lang_dir );
|
|
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
* Set the domain equal to that of the specified domain.
|
47 |
*
|
48 |
+
* @since 1.0
|
49 |
+
* @param string $domain The domain that represents the locale of this plugin.
|
50 |
*/
|
51 |
public function set_domain( $domain ) {
|
52 |
$this->domain = $domain;
|
53 |
}
|
|
|
54 |
}
|
inc/class-install.php
CHANGED
@@ -1,91 +1,99 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
3 |
class Visual_Form_Builder_Install {
|
4 |
/**
|
5 |
* Initial setup
|
6 |
*/
|
7 |
-
public function __construct() {
|
8 |
-
}
|
9 |
|
10 |
/**
|
11 |
* Check DB version and run SQL install, if needed
|
12 |
-
*
|
|
|
13 |
*/
|
14 |
public function upgrade_db_check() {
|
15 |
$current_db_version = VFB_WP_DB_VERSION;
|
16 |
|
17 |
-
if ( get_option( 'vfb_db_version' )
|
18 |
$this->install_db();
|
|
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
public function install_db() {
|
22 |
global $wpdb;
|
23 |
|
24 |
$charset_collate = $wpdb->get_charset_collate();
|
25 |
|
26 |
-
|
27 |
|
28 |
-
// Forms table
|
29 |
-
$sql =
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
) $charset_collate;";
|
51 |
|
52 |
dbDelta( $sql );
|
53 |
|
54 |
-
// Fields table
|
55 |
-
$sql =
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
) $charset_collate;";
|
73 |
|
74 |
dbDelta( $sql );
|
75 |
|
76 |
-
// Entries table
|
77 |
-
$sql =
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
) $charset_collate;";
|
90 |
|
91 |
dbDelta( $sql );
|
@@ -95,7 +103,8 @@ class Visual_Form_Builder_Install {
|
|
95 |
|
96 |
/**
|
97 |
* A wrapper to check DB version which then calls install_db
|
98 |
-
*
|
|
|
99 |
*/
|
100 |
public function install() {
|
101 |
$this->upgrade_db_check();
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* [Visual_Form_Builder_Install description]
|
4 |
+
*/
|
5 |
class Visual_Form_Builder_Install {
|
6 |
/**
|
7 |
* Initial setup
|
8 |
*/
|
9 |
+
public function __construct() {}
|
|
|
10 |
|
11 |
/**
|
12 |
* Check DB version and run SQL install, if needed
|
13 |
+
*
|
14 |
+
* @return void
|
15 |
*/
|
16 |
public function upgrade_db_check() {
|
17 |
$current_db_version = VFB_WP_DB_VERSION;
|
18 |
|
19 |
+
if ( get_option( 'vfb_db_version' ) !== $current_db_version ) {
|
20 |
$this->install_db();
|
21 |
+
}
|
22 |
}
|
23 |
|
24 |
+
/**
|
25 |
+
* [install_db description]
|
26 |
+
*
|
27 |
+
* @return void
|
28 |
+
*/
|
29 |
public function install_db() {
|
30 |
global $wpdb;
|
31 |
|
32 |
$charset_collate = $wpdb->get_charset_collate();
|
33 |
|
34 |
+
include_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
35 |
|
36 |
+
// Forms table.
|
37 |
+
$sql = 'CREATE TABLE ' . VFB_WP_FORMS_TABLE_NAME . " (
|
38 |
+
form_id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
39 |
+
form_key TINYTEXT NOT NULL,
|
40 |
+
form_title TEXT NOT NULL,
|
41 |
+
form_email_subject TEXT,
|
42 |
+
form_email_to TEXT,
|
43 |
+
form_email_from VARCHAR(255),
|
44 |
+
form_email_from_name VARCHAR(255),
|
45 |
+
form_email_from_override VARCHAR(255),
|
46 |
+
form_email_from_name_override VARCHAR(255),
|
47 |
+
form_success_type VARCHAR(25) DEFAULT 'text',
|
48 |
+
form_success_message TEXT,
|
49 |
+
form_notification_setting VARCHAR(25),
|
50 |
+
form_notification_email_name VARCHAR(255),
|
51 |
+
form_notification_email_from VARCHAR(255),
|
52 |
+
form_notification_email VARCHAR(25),
|
53 |
+
form_notification_subject VARCHAR(255),
|
54 |
+
form_notification_message TEXT,
|
55 |
+
form_notification_entry VARCHAR(25),
|
56 |
+
form_label_alignment VARCHAR(25),
|
57 |
+
PRIMARY KEY (form_id)
|
58 |
) $charset_collate;";
|
59 |
|
60 |
dbDelta( $sql );
|
61 |
|
62 |
+
// Fields table.
|
63 |
+
$sql = 'CREATE TABLE ' . VFB_WP_FIELDS_TABLE_NAME . " (
|
64 |
+
field_id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
65 |
+
form_id BIGINT(20) NOT NULL,
|
66 |
+
field_key VARCHAR(255) NOT NULL,
|
67 |
+
field_type VARCHAR(25) NOT NULL,
|
68 |
+
field_options TEXT,
|
69 |
+
field_description TEXT,
|
70 |
+
field_name TEXT NOT NULL,
|
71 |
+
field_sequence BIGINT(20) DEFAULT '0',
|
72 |
+
field_parent BIGINT(20) DEFAULT '0',
|
73 |
+
field_validation VARCHAR(25),
|
74 |
+
field_required VARCHAR(25),
|
75 |
+
field_size VARCHAR(25) DEFAULT 'medium',
|
76 |
+
field_css VARCHAR(255),
|
77 |
+
field_layout VARCHAR(255),
|
78 |
+
field_default TEXT,
|
79 |
+
PRIMARY KEY (field_id)
|
80 |
) $charset_collate;";
|
81 |
|
82 |
dbDelta( $sql );
|
83 |
|
84 |
+
// Entries table.
|
85 |
+
$sql = 'CREATE TABLE ' . VFB_WP_ENTRIES_TABLE_NAME . " (
|
86 |
+
entries_id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
87 |
+
form_id BIGINT(20) NOT NULL,
|
88 |
+
data LONGTEXT NOT NULL,
|
89 |
+
subject TEXT,
|
90 |
+
sender_name VARCHAR(255),
|
91 |
+
sender_email VARCHAR(255),
|
92 |
+
emails_to TEXT,
|
93 |
+
date_submitted DATETIME,
|
94 |
+
ip_address VARCHAR(50),
|
95 |
+
entry_approved VARCHAR(20) DEFAULT '1',
|
96 |
+
PRIMARY KEY (entries_id)
|
97 |
) $charset_collate;";
|
98 |
|
99 |
dbDelta( $sql );
|
103 |
|
104 |
/**
|
105 |
* A wrapper to check DB version which then calls install_db
|
106 |
+
*
|
107 |
+
* @return void
|
108 |
*/
|
109 |
public function install() {
|
110 |
$this->upgrade_db_check();
|
inc/class-list-table.php
DELETED
@@ -1,1520 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Base class for displaying a list of items in an ajaxified HTML table.
|
4 |
-
* A copy of the WP_List_Table class
|
5 |
-
*
|
6 |
-
* @since 3.1.0
|
7 |
-
* @access private
|
8 |
-
*
|
9 |
-
* @package WordPress
|
10 |
-
* @subpackage List_Table
|
11 |
-
*/
|
12 |
-
class Visual_Form_Builder_List_Table {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* The current list of items.
|
16 |
-
*
|
17 |
-
* @since 3.1.0
|
18 |
-
* @var array
|
19 |
-
*/
|
20 |
-
public $items;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Various information about the current table.
|
24 |
-
*
|
25 |
-
* @since 3.1.0
|
26 |
-
* @var array
|
27 |
-
*/
|
28 |
-
protected $_args;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Various information needed for displaying the pagination.
|
32 |
-
*
|
33 |
-
* @since 3.1.0
|
34 |
-
* @var array
|
35 |
-
*/
|
36 |
-
protected $_pagination_args = array();
|
37 |
-
|
38 |
-
/**
|
39 |
-
* The current screen.
|
40 |
-
*
|
41 |
-
* @since 3.1.0
|
42 |
-
* @var WP_Screen
|
43 |
-
*/
|
44 |
-
protected $screen;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Cached bulk actions.
|
48 |
-
*
|
49 |
-
* @since 3.1.0
|
50 |
-
* @var array
|
51 |
-
*/
|
52 |
-
private $_actions;
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Cached pagination output.
|
56 |
-
*
|
57 |
-
* @since 3.1.0
|
58 |
-
* @var string
|
59 |
-
*/
|
60 |
-
private $_pagination;
|
61 |
-
|
62 |
-
/**
|
63 |
-
* The view switcher modes.
|
64 |
-
*
|
65 |
-
* @since 4.1.0
|
66 |
-
* @var array
|
67 |
-
*/
|
68 |
-
protected $modes = array();
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Stores the value returned by ->get_column_info().
|
72 |
-
*
|
73 |
-
* @since 4.1.0
|
74 |
-
* @var array
|
75 |
-
*/
|
76 |
-
protected $_column_headers;
|
77 |
-
|
78 |
-
/**
|
79 |
-
* {@internal Missing Summary}
|
80 |
-
*
|
81 |
-
* @var array
|
82 |
-
*/
|
83 |
-
protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
|
84 |
-
|
85 |
-
/**
|
86 |
-
* {@internal Missing Summary}
|
87 |
-
*
|
88 |
-
* @var array
|
89 |
-
*/
|
90 |
-
protected $compat_methods = array(
|
91 |
-
'set_pagination_args',
|
92 |
-
'get_views',
|
93 |
-
'get_bulk_actions',
|
94 |
-
'bulk_actions',
|
95 |
-
'row_actions',
|
96 |
-
'months_dropdown',
|
97 |
-
'view_switcher',
|
98 |
-
'comments_bubble',
|
99 |
-
'get_items_per_page',
|
100 |
-
'pagination',
|
101 |
-
'get_sortable_columns',
|
102 |
-
'get_column_info',
|
103 |
-
'get_table_classes',
|
104 |
-
'display_tablenav',
|
105 |
-
'extra_tablenav',
|
106 |
-
'single_row_columns',
|
107 |
-
);
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Constructor.
|
111 |
-
*
|
112 |
-
* The child class should call this constructor from its own constructor to override
|
113 |
-
* the default $args.
|
114 |
-
*
|
115 |
-
* @since 3.1.0
|
116 |
-
*
|
117 |
-
* @param array|string $args {
|
118 |
-
* Array or string of arguments.
|
119 |
-
*
|
120 |
-
* @type string $plural Plural value used for labels and the objects being listed.
|
121 |
-
* This affects things such as CSS class-names and nonces used
|
122 |
-
* in the list table, e.g. 'posts'. Default empty.
|
123 |
-
* @type string $singular Singular label for an object being listed, e.g. 'post'.
|
124 |
-
* Default empty
|
125 |
-
* @type bool $ajax Whether the list table supports Ajax. This includes loading
|
126 |
-
* and sorting data, for example. If true, the class will call
|
127 |
-
* the _js_vars() method in the footer to provide variables
|
128 |
-
* to any scripts handling Ajax events. Default false.
|
129 |
-
* @type string $screen String containing the hook name used to determine the current
|
130 |
-
* screen. If left null, the current screen will be automatically set.
|
131 |
-
* Default null.
|
132 |
-
* }
|
133 |
-
*/
|
134 |
-
public function __construct( $args = array() ) {
|
135 |
-
$args = wp_parse_args(
|
136 |
-
$args,
|
137 |
-
array(
|
138 |
-
'plural' => '',
|
139 |
-
'singular' => '',
|
140 |
-
'ajax' => false,
|
141 |
-
'screen' => null,
|
142 |
-
)
|
143 |
-
);
|
144 |
-
|
145 |
-
$this->screen = convert_to_screen( $args['screen'] );
|
146 |
-
|
147 |
-
add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
|
148 |
-
|
149 |
-
if ( ! $args['plural'] ) {
|
150 |
-
$args['plural'] = $this->screen->base;
|
151 |
-
}
|
152 |
-
|
153 |
-
$args['plural'] = sanitize_key( $args['plural'] );
|
154 |
-
$args['singular'] = sanitize_key( $args['singular'] );
|
155 |
-
|
156 |
-
$this->_args = $args;
|
157 |
-
|
158 |
-
if ( $args['ajax'] ) {
|
159 |
-
// wp_enqueue_script( 'list-table' );
|
160 |
-
add_action( 'admin_footer', array( $this, '_js_vars' ) );
|
161 |
-
}
|
162 |
-
|
163 |
-
if ( empty( $this->modes ) ) {
|
164 |
-
$this->modes = array(
|
165 |
-
'list' => __( 'Compact view' ),
|
166 |
-
'excerpt' => __( 'Extended view' ),
|
167 |
-
);
|
168 |
-
}
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Make private properties readable for backward compatibility.
|
173 |
-
*
|
174 |
-
* @since 4.0.0
|
175 |
-
*
|
176 |
-
* @param string $name Property to get.
|
177 |
-
* @return mixed Property.
|
178 |
-
*/
|
179 |
-
public function __get( $name ) {
|
180 |
-
if ( in_array( $name, $this->compat_fields, true ) ) {
|
181 |
-
return $this->$name;
|
182 |
-
}
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Make private properties settable for backward compatibility.
|
187 |
-
*
|
188 |
-
* @since 4.0.0
|
189 |
-
*
|
190 |
-
* @param string $name Property to check if set.
|
191 |
-
* @param mixed $value Property value.
|
192 |
-
* @return mixed Newly-set property.
|
193 |
-
*/
|
194 |
-
public function __set( $name, $value ) {
|
195 |
-
if ( in_array( $name, $this->compat_fields, true ) ) {
|
196 |
-
return $this->$name = $value;
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Make private properties checkable for backward compatibility.
|
202 |
-
*
|
203 |
-
* @since 4.0.0
|
204 |
-
*
|
205 |
-
* @param string $name Property to check if set.
|
206 |
-
* @return bool Whether the property is set.
|
207 |
-
*/
|
208 |
-
public function __isset( $name ) {
|
209 |
-
if ( in_array( $name, $this->compat_fields, true ) ) {
|
210 |
-
return isset( $this->$name );
|
211 |
-
}
|
212 |
-
}
|
213 |
-
|
214 |
-
/**
|
215 |
-
* Make private properties un-settable for backward compatibility.
|
216 |
-
*
|
217 |
-
* @since 4.0.0
|
218 |
-
*
|
219 |
-
* @param string $name Property to unset.
|
220 |
-
*/
|
221 |
-
public function __unset( $name ) {
|
222 |
-
if ( in_array( $name, $this->compat_fields, true ) ) {
|
223 |
-
unset( $this->$name );
|
224 |
-
}
|
225 |
-
}
|
226 |
-
|
227 |
-
/**
|
228 |
-
* Make private/protected methods readable for backward compatibility.
|
229 |
-
*
|
230 |
-
* @since 4.0.0
|
231 |
-
*
|
232 |
-
* @param string $name Method to call.
|
233 |
-
* @param array $arguments Arguments to pass when calling.
|
234 |
-
* @return mixed|bool Return value of the callback, false otherwise.
|
235 |
-
*/
|
236 |
-
public function __call( $name, $arguments ) {
|
237 |
-
if ( in_array( $name, $this->compat_methods, true ) ) {
|
238 |
-
return $this->$name( ...$arguments );
|
239 |
-
}
|
240 |
-
return false;
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Checks the current user's permissions
|
245 |
-
*
|
246 |
-
* @since 3.1.0
|
247 |
-
* @abstract
|
248 |
-
*/
|
249 |
-
public function ajax_user_can() {
|
250 |
-
die( 'function WP_List_Table::ajax_user_can() must be overridden in a subclass.' );
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Prepares the list of items for displaying.
|
255 |
-
*
|
256 |
-
* @uses WP_List_Table::set_pagination_args()
|
257 |
-
*
|
258 |
-
* @since 3.1.0
|
259 |
-
* @abstract
|
260 |
-
*/
|
261 |
-
public function prepare_items() {
|
262 |
-
die( 'function WP_List_Table::prepare_items() must be overridden in a subclass.' );
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* An internal method that sets all the necessary pagination arguments
|
267 |
-
*
|
268 |
-
* @since 3.1.0
|
269 |
-
*
|
270 |
-
* @param array|string $args Array or string of arguments with information about the pagination.
|
271 |
-
*/
|
272 |
-
protected function set_pagination_args( $args ) {
|
273 |
-
$args = wp_parse_args(
|
274 |
-
$args,
|
275 |
-
array(
|
276 |
-
'total_items' => 0,
|
277 |
-
'total_pages' => 0,
|
278 |
-
'per_page' => 0,
|
279 |
-
)
|
280 |
-
);
|
281 |
-
|
282 |
-
if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
|
283 |
-
$args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
|
284 |
-
}
|
285 |
-
|
286 |
-
// Redirect if page number is invalid and headers are not already sent.
|
287 |
-
if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
|
288 |
-
wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
|
289 |
-
exit;
|
290 |
-
}
|
291 |
-
|
292 |
-
$this->_pagination_args = $args;
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* Access the pagination args.
|
297 |
-
*
|
298 |
-
* @since 3.1.0
|
299 |
-
*
|
300 |
-
* @param string $key Pagination argument to retrieve. Common values include 'total_items',
|
301 |
-
* 'total_pages', 'per_page', or 'infinite_scroll'.
|
302 |
-
* @return int Number of items that correspond to the given pagination argument.
|
303 |
-
*/
|
304 |
-
public function get_pagination_arg( $key ) {
|
305 |
-
if ( 'page' === $key ) {
|
306 |
-
return $this->get_pagenum();
|
307 |
-
}
|
308 |
-
|
309 |
-
if ( isset( $this->_pagination_args[ $key ] ) ) {
|
310 |
-
return $this->_pagination_args[ $key ];
|
311 |
-
}
|
312 |
-
}
|
313 |
-
|
314 |
-
/**
|
315 |
-
* Whether the table has items to display or not
|
316 |
-
*
|
317 |
-
* @since 3.1.0
|
318 |
-
*
|
319 |
-
* @return bool
|
320 |
-
*/
|
321 |
-
public function has_items() {
|
322 |
-
return ! empty( $this->items );
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Message to be displayed when there are no items
|
327 |
-
*
|
328 |
-
* @since 3.1.0
|
329 |
-
*/
|
330 |
-
public function no_items() {
|
331 |
-
_e( 'No items found.' );
|
332 |
-
}
|
333 |
-
|
334 |
-
/**
|
335 |
-
* Displays the search box.
|
336 |
-
*
|
337 |
-
* @since 3.1.0
|
338 |
-
*
|
339 |
-
* @param string $text The 'submit' button label.
|
340 |
-
* @param string $input_id ID attribute value for the search input field.
|
341 |
-
*/
|
342 |
-
public function search_box( $text, $input_id ) {
|
343 |
-
if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
|
344 |
-
return;
|
345 |
-
}
|
346 |
-
|
347 |
-
$input_id = $input_id . '-search-input';
|
348 |
-
|
349 |
-
if ( ! empty( $_REQUEST['orderby'] ) ) {
|
350 |
-
echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
|
351 |
-
}
|
352 |
-
if ( ! empty( $_REQUEST['order'] ) ) {
|
353 |
-
echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
|
354 |
-
}
|
355 |
-
if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
|
356 |
-
echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
|
357 |
-
}
|
358 |
-
if ( ! empty( $_REQUEST['detached'] ) ) {
|
359 |
-
echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
|
360 |
-
}
|
361 |
-
?>
|
362 |
-
<p class="search-box">
|
363 |
-
<label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
|
364 |
-
<input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
|
365 |
-
<?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
|
366 |
-
</p>
|
367 |
-
<?php
|
368 |
-
}
|
369 |
-
|
370 |
-
/**
|
371 |
-
* Gets the list of views available on this table.
|
372 |
-
*
|
373 |
-
* The format is an associative array:
|
374 |
-
* - `'id' => 'link'`
|
375 |
-
*
|
376 |
-
* @since 3.1.0
|
377 |
-
*
|
378 |
-
* @return array
|
379 |
-
*/
|
380 |
-
protected function get_views() {
|
381 |
-
return array();
|
382 |
-
}
|
383 |
-
|
384 |
-
/**
|
385 |
-
* Displays the list of views available on this table.
|
386 |
-
*
|
387 |
-
* @since 3.1.0
|
388 |
-
*/
|
389 |
-
public function views() {
|
390 |
-
$views = $this->get_views();
|
391 |
-
/**
|
392 |
-
* Filters the list of available list table views.
|
393 |
-
*
|
394 |
-
* The dynamic portion of the hook name, `$this->screen->id`, refers
|
395 |
-
* to the ID of the current screen.
|
396 |
-
*
|
397 |
-
* @since 3.1.0
|
398 |
-
*
|
399 |
-
* @param string[] $views An array of available list table views.
|
400 |
-
*/
|
401 |
-
$views = apply_filters( "views_{$this->screen->id}", $views );
|
402 |
-
|
403 |
-
if ( empty( $views ) ) {
|
404 |
-
return;
|
405 |
-
}
|
406 |
-
|
407 |
-
$this->screen->render_screen_reader_content( 'heading_views' );
|
408 |
-
|
409 |
-
echo "<ul class='subsubsub'>\n";
|
410 |
-
foreach ( $views as $class => $view ) {
|
411 |
-
$views[ $class ] = "\t<li class='$class'>$view";
|
412 |
-
}
|
413 |
-
echo implode( " |</li>\n", $views ) . "</li>\n";
|
414 |
-
echo '</ul>';
|
415 |
-
}
|
416 |
-
|
417 |
-
/**
|
418 |
-
* Retrieves the list of bulk actions available for this table.
|
419 |
-
*
|
420 |
-
* The format is an associative array where each element represents either a top level option value and label, or
|
421 |
-
* an array representing an optgroup and its options.
|
422 |
-
*
|
423 |
-
* For a standard option, the array element key is the field value and the array element value is the field label.
|
424 |
-
*
|
425 |
-
* For an optgroup, the array element key is the label and the array element value is an associative array of
|
426 |
-
* options as above.
|
427 |
-
*
|
428 |
-
* Example:
|
429 |
-
*
|
430 |
-
* [
|
431 |
-
* 'edit' => 'Edit',
|
432 |
-
* 'delete' => 'Delete',
|
433 |
-
* 'Change State' => [
|
434 |
-
* 'feature' => 'Featured',
|
435 |
-
* 'sale' => 'On Sale',
|
436 |
-
* ]
|
437 |
-
* ]
|
438 |
-
*
|
439 |
-
* @since 3.1.0
|
440 |
-
* @since 5.6.0 A bulk action can now contain an array of options in order to create an optgroup.
|
441 |
-
*
|
442 |
-
* @return array
|
443 |
-
*/
|
444 |
-
protected function get_bulk_actions() {
|
445 |
-
return array();
|
446 |
-
}
|
447 |
-
|
448 |
-
/**
|
449 |
-
* Displays the bulk actions dropdown.
|
450 |
-
*
|
451 |
-
* @since 3.1.0
|
452 |
-
*
|
453 |
-
* @param string $which The location of the bulk actions: 'top' or 'bottom'.
|
454 |
-
* This is designated as optional for backward compatibility.
|
455 |
-
*/
|
456 |
-
protected function bulk_actions( $which = '' ) {
|
457 |
-
if ( is_null( $this->_actions ) ) {
|
458 |
-
$this->_actions = $this->get_bulk_actions();
|
459 |
-
|
460 |
-
/**
|
461 |
-
* Filters the items in the bulk actions menu of the list table.
|
462 |
-
*
|
463 |
-
* The dynamic portion of the hook name, `$this->screen->id`, refers
|
464 |
-
* to the ID of the current screen.
|
465 |
-
*
|
466 |
-
* @since 3.1.0
|
467 |
-
* @since 5.6.0 A bulk action can now contain an array of options in order to create an optgroup.
|
468 |
-
*
|
469 |
-
* @param array $actions An array of the available bulk actions.
|
470 |
-
*/
|
471 |
-
$this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
|
472 |
-
|
473 |
-
$two = '';
|
474 |
-
} else {
|
475 |
-
$two = '2';
|
476 |
-
}
|
477 |
-
|
478 |
-
if ( empty( $this->_actions ) ) {
|
479 |
-
return;
|
480 |
-
}
|
481 |
-
|
482 |
-
echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
|
483 |
-
echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
|
484 |
-
echo '<option value="-1">' . __( 'Bulk actions' ) . "</option>\n";
|
485 |
-
|
486 |
-
foreach ( $this->_actions as $key => $value ) {
|
487 |
-
if ( is_array( $value ) ) {
|
488 |
-
echo "\t" . '<optgroup label="' . esc_attr( $key ) . '">' . "\n";
|
489 |
-
|
490 |
-
foreach ( $value as $name => $title ) {
|
491 |
-
$class = ( 'edit' === $name ) ? ' class="hide-if-no-js"' : '';
|
492 |
-
|
493 |
-
echo "\t\t" . '<option value="' . esc_attr( $name ) . '"' . $class . '>' . $title . "</option>\n";
|
494 |
-
}
|
495 |
-
echo "\t" . "</optgroup>\n";
|
496 |
-
} else {
|
497 |
-
$class = ( 'edit' === $key ) ? ' class="hide-if-no-js"' : '';
|
498 |
-
|
499 |
-
echo "\t" . '<option value="' . esc_attr( $key ) . '"' . $class . '>' . $value . "</option>\n";
|
500 |
-
}
|
501 |
-
}
|
502 |
-
|
503 |
-
echo "</select>\n";
|
504 |
-
|
505 |
-
submit_button( __( 'Apply' ), 'action', '', false, array( 'id' => "doaction$two" ) );
|
506 |
-
echo "\n";
|
507 |
-
}
|
508 |
-
|
509 |
-
/**
|
510 |
-
* Gets the current action selected from the bulk actions dropdown.
|
511 |
-
*
|
512 |
-
* @since 3.1.0
|
513 |
-
*
|
514 |
-
* @return string|false The action name. False if no action was selected.
|
515 |
-
*/
|
516 |
-
public function current_action() {
|
517 |
-
if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
|
518 |
-
return false;
|
519 |
-
}
|
520 |
-
|
521 |
-
if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
|
522 |
-
return $_REQUEST['action'];
|
523 |
-
}
|
524 |
-
|
525 |
-
return false;
|
526 |
-
}
|
527 |
-
|
528 |
-
/**
|
529 |
-
* Generates the required HTML for a list of row action links.
|
530 |
-
*
|
531 |
-
* @since 3.1.0
|
532 |
-
*
|
533 |
-
* @param string[] $actions An array of action links.
|
534 |
-
* @param bool $always_visible Whether the actions should be always visible.
|
535 |
-
* @return string The HTML for the row actions.
|
536 |
-
*/
|
537 |
-
protected function row_actions( $actions, $always_visible = false ) {
|
538 |
-
$action_count = count( $actions );
|
539 |
-
|
540 |
-
if ( ! $action_count ) {
|
541 |
-
return '';
|
542 |
-
}
|
543 |
-
|
544 |
-
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
545 |
-
|
546 |
-
if ( 'excerpt' === $mode ) {
|
547 |
-
$always_visible = true;
|
548 |
-
}
|
549 |
-
|
550 |
-
$out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
|
551 |
-
|
552 |
-
$i = 0;
|
553 |
-
|
554 |
-
foreach ( $actions as $action => $link ) {
|
555 |
-
++$i;
|
556 |
-
|
557 |
-
$sep = ( $i < $action_count ) ? ' | ' : '';
|
558 |
-
|
559 |
-
$out .= "<span class='$action'>$link$sep</span>";
|
560 |
-
}
|
561 |
-
|
562 |
-
$out .= '</div>';
|
563 |
-
|
564 |
-
$out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
|
565 |
-
|
566 |
-
return $out;
|
567 |
-
}
|
568 |
-
|
569 |
-
/**
|
570 |
-
* Displays a dropdown for filtering items in the list table by month.
|
571 |
-
*
|
572 |
-
* @since 3.1.0
|
573 |
-
*
|
574 |
-
* @global wpdb $wpdb WordPress database abstraction object.
|
575 |
-
* @global WP_Locale $wp_locale WordPress date and time locale object.
|
576 |
-
*
|
577 |
-
* @param string $post_type The post type.
|
578 |
-
*/
|
579 |
-
protected function months_dropdown( $post_type ) {
|
580 |
-
global $wpdb, $wp_locale;
|
581 |
-
|
582 |
-
/**
|
583 |
-
* Filters whether to remove the 'Months' drop-down from the post list table.
|
584 |
-
*
|
585 |
-
* @since 4.2.0
|
586 |
-
*
|
587 |
-
* @param bool $disable Whether to disable the drop-down. Default false.
|
588 |
-
* @param string $post_type The post type.
|
589 |
-
*/
|
590 |
-
if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
|
591 |
-
return;
|
592 |
-
}
|
593 |
-
|
594 |
-
/**
|
595 |
-
* Filters to short-circuit performing the months dropdown query.
|
596 |
-
*
|
597 |
-
* @since 5.7.0
|
598 |
-
*
|
599 |
-
* @param object[]|false $months 'Months' drop-down results. Default false.
|
600 |
-
* @param string $post_type The post type.
|
601 |
-
*/
|
602 |
-
$months = apply_filters( 'pre_months_dropdown_query', false, $post_type );
|
603 |
-
|
604 |
-
if ( ! is_array( $months ) ) {
|
605 |
-
$extra_checks = "AND post_status != 'auto-draft'";
|
606 |
-
if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
|
607 |
-
$extra_checks .= " AND post_status != 'trash'";
|
608 |
-
} elseif ( isset( $_GET['post_status'] ) ) {
|
609 |
-
$extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
|
610 |
-
}
|
611 |
-
|
612 |
-
$months = $wpdb->get_results(
|
613 |
-
$wpdb->prepare(
|
614 |
-
"
|
615 |
-
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
|
616 |
-
FROM $wpdb->posts
|
617 |
-
WHERE post_type = %s
|
618 |
-
$extra_checks
|
619 |
-
ORDER BY post_date DESC
|
620 |
-
",
|
621 |
-
$post_type
|
622 |
-
)
|
623 |
-
);
|
624 |
-
}
|
625 |
-
|
626 |
-
/**
|
627 |
-
* Filters the 'Months' drop-down results.
|
628 |
-
*
|
629 |
-
* @since 3.7.0
|
630 |
-
*
|
631 |
-
* @param object[] $months Array of the months drop-down query results.
|
632 |
-
* @param string $post_type The post type.
|
633 |
-
*/
|
634 |
-
$months = apply_filters( 'months_dropdown_results', $months, $post_type );
|
635 |
-
|
636 |
-
$month_count = count( $months );
|
637 |
-
|
638 |
-
if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
|
639 |
-
return;
|
640 |
-
}
|
641 |
-
|
642 |
-
$m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
|
643 |
-
?>
|
644 |
-
<label for="filter-by-date" class="screen-reader-text"><?php echo get_post_type_object( $post_type )->labels->filter_by_date; ?></label>
|
645 |
-
<select name="m" id="filter-by-date">
|
646 |
-
<option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
|
647 |
-
<?php
|
648 |
-
foreach ( $months as $arc_row ) {
|
649 |
-
if ( 0 == $arc_row->year ) {
|
650 |
-
continue;
|
651 |
-
}
|
652 |
-
|
653 |
-
$month = zeroise( $arc_row->month, 2 );
|
654 |
-
$year = $arc_row->year;
|
655 |
-
|
656 |
-
printf(
|
657 |
-
"<option %s value='%s'>%s</option>\n",
|
658 |
-
selected( $m, $year . $month, false ),
|
659 |
-
esc_attr( $arc_row->year . $month ),
|
660 |
-
/* translators: 1: Month name, 2: 4-digit year. */
|
661 |
-
sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
|
662 |
-
);
|
663 |
-
}
|
664 |
-
?>
|
665 |
-
</select>
|
666 |
-
<?php
|
667 |
-
}
|
668 |
-
|
669 |
-
/**
|
670 |
-
* Displays a view switcher.
|
671 |
-
*
|
672 |
-
* @since 3.1.0
|
673 |
-
*
|
674 |
-
* @param string $current_mode
|
675 |
-
*/
|
676 |
-
protected function view_switcher( $current_mode ) {
|
677 |
-
?>
|
678 |
-
<input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
|
679 |
-
<div class="view-switch">
|
680 |
-
<?php
|
681 |
-
foreach ( $this->modes as $mode => $title ) {
|
682 |
-
$classes = array( 'view-' . $mode );
|
683 |
-
$aria_current = '';
|
684 |
-
|
685 |
-
if ( $current_mode === $mode ) {
|
686 |
-
$classes[] = 'current';
|
687 |
-
$aria_current = ' aria-current="page"';
|
688 |
-
}
|
689 |
-
|
690 |
-
printf(
|
691 |
-
"<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
|
692 |
-
esc_url( remove_query_arg( 'attachment-filter', add_query_arg( 'mode', $mode ) ) ),
|
693 |
-
implode( ' ', $classes ),
|
694 |
-
$title
|
695 |
-
);
|
696 |
-
}
|
697 |
-
?>
|
698 |
-
</div>
|
699 |
-
<?php
|
700 |
-
}
|
701 |
-
|
702 |
-
/**
|
703 |
-
* Displays a comment count bubble.
|
704 |
-
*
|
705 |
-
* @since 3.1.0
|
706 |
-
*
|
707 |
-
* @param int $post_id The post ID.
|
708 |
-
* @param int $pending_comments Number of pending comments.
|
709 |
-
*/
|
710 |
-
protected function comments_bubble( $post_id, $pending_comments ) {
|
711 |
-
$approved_comments = get_comments_number();
|
712 |
-
|
713 |
-
$approved_comments_number = number_format_i18n( $approved_comments );
|
714 |
-
$pending_comments_number = number_format_i18n( $pending_comments );
|
715 |
-
|
716 |
-
$approved_only_phrase = sprintf(
|
717 |
-
/* translators: %s: Number of comments. */
|
718 |
-
_n( '%s comment', '%s comments', $approved_comments ),
|
719 |
-
$approved_comments_number
|
720 |
-
);
|
721 |
-
|
722 |
-
$approved_phrase = sprintf(
|
723 |
-
/* translators: %s: Number of comments. */
|
724 |
-
_n( '%s approved comment', '%s approved comments', $approved_comments ),
|
725 |
-
$approved_comments_number
|
726 |
-
);
|
727 |
-
|
728 |
-
$pending_phrase = sprintf(
|
729 |
-
/* translators: %s: Number of comments. */
|
730 |
-
_n( '%s pending comment', '%s pending comments', $pending_comments ),
|
731 |
-
$pending_comments_number
|
732 |
-
);
|
733 |
-
|
734 |
-
if ( ! $approved_comments && ! $pending_comments ) {
|
735 |
-
// No comments at all.
|
736 |
-
printf(
|
737 |
-
'<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
|
738 |
-
__( 'No comments' )
|
739 |
-
);
|
740 |
-
} elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) {
|
741 |
-
// Don't link the comment bubble for a trashed post.
|
742 |
-
printf(
|
743 |
-
'<span class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
|
744 |
-
$approved_comments_number,
|
745 |
-
$pending_comments ? $approved_phrase : $approved_only_phrase
|
746 |
-
);
|
747 |
-
} elseif ( $approved_comments ) {
|
748 |
-
// Link the comment bubble to approved comments.
|
749 |
-
printf(
|
750 |
-
'<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
|
751 |
-
esc_url(
|
752 |
-
add_query_arg(
|
753 |
-
array(
|
754 |
-
'p' => $post_id,
|
755 |
-
'comment_status' => 'approved',
|
756 |
-
),
|
757 |
-
admin_url( 'edit-comments.php' )
|
758 |
-
)
|
759 |
-
),
|
760 |
-
$approved_comments_number,
|
761 |
-
$pending_comments ? $approved_phrase : $approved_only_phrase
|
762 |
-
);
|
763 |
-
} else {
|
764 |
-
// Don't link the comment bubble when there are no approved comments.
|
765 |
-
printf(
|
766 |
-
'<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
|
767 |
-
$approved_comments_number,
|
768 |
-
$pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
|
769 |
-
);
|
770 |
-
}
|
771 |
-
|
772 |
-
if ( $pending_comments ) {
|
773 |
-
printf(
|
774 |
-
'<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
|
775 |
-
esc_url(
|
776 |
-
add_query_arg(
|
777 |
-
array(
|
778 |
-
'p' => $post_id,
|
779 |
-
'comment_status' => 'moderated',
|
780 |
-
),
|
781 |
-
admin_url( 'edit-comments.php' )
|
782 |
-
)
|
783 |
-
),
|
784 |
-
$pending_comments_number,
|
785 |
-
$pending_phrase
|
786 |
-
);
|
787 |
-
} else {
|
788 |
-
printf(
|
789 |
-
'<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
|
790 |
-
$pending_comments_number,
|
791 |
-
$approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
|
792 |
-
);
|
793 |
-
}
|
794 |
-
}
|
795 |
-
|
796 |
-
/**
|
797 |
-
* Gets the current page number.
|
798 |
-
*
|
799 |
-
* @since 3.1.0
|
800 |
-
*
|
801 |
-
* @return int
|
802 |
-
*/
|
803 |
-
public function get_pagenum() {
|
804 |
-
$pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
|
805 |
-
|
806 |
-
if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
|
807 |
-
$pagenum = $this->_pagination_args['total_pages'];
|
808 |
-
}
|
809 |
-
|
810 |
-
return max( 1, $pagenum );
|
811 |
-
}
|
812 |
-
|
813 |
-
/**
|
814 |
-
* Gets the number of items to display on a single page.
|
815 |
-
*
|
816 |
-
* @since 3.1.0
|
817 |
-
*
|
818 |
-
* @param string $option
|
819 |
-
* @param int $default
|
820 |
-
* @return int
|
821 |
-
*/
|
822 |
-
protected function get_items_per_page( $option, $default = 20 ) {
|
823 |
-
$per_page = (int) get_user_option( $option );
|
824 |
-
if ( empty( $per_page ) || $per_page < 1 ) {
|
825 |
-
$per_page = $default;
|
826 |
-
}
|
827 |
-
|
828 |
-
/**
|
829 |
-
* Filters the number of items to be displayed on each page of the list table.
|
830 |
-
*
|
831 |
-
* The dynamic hook name, `$option`, refers to the `per_page` option depending
|
832 |
-
* on the type of list table in use. Possible filter names include:
|
833 |
-
*
|
834 |
-
* - `edit_comments_per_page`
|
835 |
-
* - `sites_network_per_page`
|
836 |
-
* - `site_themes_network_per_page`
|
837 |
-
* - `themes_network_per_page'`
|
838 |
-
* - `users_network_per_page`
|
839 |
-
* - `edit_post_per_page`
|
840 |
-
* - `edit_page_per_page'`
|
841 |
-
* - `edit_{$post_type}_per_page`
|
842 |
-
* - `edit_post_tag_per_page`
|
843 |
-
* - `edit_category_per_page`
|
844 |
-
* - `edit_{$taxonomy}_per_page`
|
845 |
-
* - `site_users_network_per_page`
|
846 |
-
* - `users_per_page`
|
847 |
-
*
|
848 |
-
* @since 2.9.0
|
849 |
-
*
|
850 |
-
* @param int $per_page Number of items to be displayed. Default 20.
|
851 |
-
*/
|
852 |
-
return (int) apply_filters( "{$option}", $per_page );
|
853 |
-
}
|
854 |
-
|
855 |
-
/**
|
856 |
-
* Displays the pagination.
|
857 |
-
*
|
858 |
-
* @since 3.1.0
|
859 |
-
*
|
860 |
-
* @param string $which
|
861 |
-
*/
|
862 |
-
protected function pagination( $which ) {
|
863 |
-
if ( empty( $this->_pagination_args ) ) {
|
864 |
-
return;
|
865 |
-
}
|
866 |
-
|
867 |
-
$total_items = $this->_pagination_args['total_items'];
|
868 |
-
$total_pages = $this->_pagination_args['total_pages'];
|
869 |
-
$infinite_scroll = false;
|
870 |
-
if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
|
871 |
-
$infinite_scroll = $this->_pagination_args['infinite_scroll'];
|
872 |
-
}
|
873 |
-
|
874 |
-
if ( 'top' === $which && $total_pages > 1 ) {
|
875 |
-
$this->screen->render_screen_reader_content( 'heading_pagination' );
|
876 |
-
}
|
877 |
-
|
878 |
-
$output = '<span class="displaying-num">' . sprintf(
|
879 |
-
/* translators: %s: Number of items. */
|
880 |
-
_n( '%s item', '%s items', $total_items ),
|
881 |
-
number_format_i18n( $total_items )
|
882 |
-
) . '</span>';
|
883 |
-
|
884 |
-
$current = $this->get_pagenum();
|
885 |
-
$removable_query_args = wp_removable_query_args();
|
886 |
-
|
887 |
-
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
888 |
-
|
889 |
-
$current_url = remove_query_arg( $removable_query_args, $current_url );
|
890 |
-
|
891 |
-
$page_links = array();
|
892 |
-
|
893 |
-
$total_pages_before = '<span class="paging-input">';
|
894 |
-
$total_pages_after = '</span></span>';
|
895 |
-
|
896 |
-
$disable_first = false;
|
897 |
-
$disable_last = false;
|
898 |
-
$disable_prev = false;
|
899 |
-
$disable_next = false;
|
900 |
-
|
901 |
-
if ( 1 == $current ) {
|
902 |
-
$disable_first = true;
|
903 |
-
$disable_prev = true;
|
904 |
-
}
|
905 |
-
if ( 2 == $current ) {
|
906 |
-
$disable_first = true;
|
907 |
-
}
|
908 |
-
if ( $total_pages == $current ) {
|
909 |
-
$disable_last = true;
|
910 |
-
$disable_next = true;
|
911 |
-
}
|
912 |
-
if ( $total_pages - 1 == $current ) {
|
913 |
-
$disable_last = true;
|
914 |
-
}
|
915 |
-
|
916 |
-
if ( $disable_first ) {
|
917 |
-
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>';
|
918 |
-
} else {
|
919 |
-
$page_links[] = sprintf(
|
920 |
-
"<a class='first-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
|
921 |
-
esc_url( remove_query_arg( 'paged', $current_url ) ),
|
922 |
-
__( 'First page' ),
|
923 |
-
'«'
|
924 |
-
);
|
925 |
-
}
|
926 |
-
|
927 |
-
if ( $disable_prev ) {
|
928 |
-
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">‹</span>';
|
929 |
-
} else {
|
930 |
-
$page_links[] = sprintf(
|
931 |
-
"<a class='prev-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
|
932 |
-
esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
|
933 |
-
__( 'Previous page' ),
|
934 |
-
'‹'
|
935 |
-
);
|
936 |
-
}
|
937 |
-
|
938 |
-
if ( 'bottom' === $which ) {
|
939 |
-
$html_current_page = $current;
|
940 |
-
$total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
|
941 |
-
} else {
|
942 |
-
$html_current_page = sprintf(
|
943 |
-
"%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
|
944 |
-
'<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
|
945 |
-
$current,
|
946 |
-
strlen( $total_pages )
|
947 |
-
);
|
948 |
-
}
|
949 |
-
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
|
950 |
-
$page_links[] = $total_pages_before . sprintf(
|
951 |
-
/* translators: 1: Current page, 2: Total pages. */
|
952 |
-
_x( '%1$s of %2$s', 'paging' ),
|
953 |
-
$html_current_page,
|
954 |
-
$html_total_pages
|
955 |
-
) . $total_pages_after;
|
956 |
-
|
957 |
-
if ( $disable_next ) {
|
958 |
-
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">›</span>';
|
959 |
-
} else {
|
960 |
-
$page_links[] = sprintf(
|
961 |
-
"<a class='next-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
|
962 |
-
esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
|
963 |
-
__( 'Next page' ),
|
964 |
-
'›'
|
965 |
-
);
|
966 |
-
}
|
967 |
-
|
968 |
-
if ( $disable_last ) {
|
969 |
-
$page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span>';
|
970 |
-
} else {
|
971 |
-
$page_links[] = sprintf(
|
972 |
-
"<a class='last-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
|
973 |
-
esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
|
974 |
-
__( 'Last page' ),
|
975 |
-
'»'
|
976 |
-
);
|
977 |
-
}
|
978 |
-
|
979 |
-
$pagination_links_class = 'pagination-links';
|
980 |
-
if ( ! empty( $infinite_scroll ) ) {
|
981 |
-
$pagination_links_class .= ' hide-if-js';
|
982 |
-
}
|
983 |
-
$output .= "\n<span class='$pagination_links_class'>" . implode( "\n", $page_links ) . '</span>';
|
984 |
-
|
985 |
-
if ( $total_pages ) {
|
986 |
-
$page_class = $total_pages < 2 ? ' one-page' : '';
|
987 |
-
} else {
|
988 |
-
$page_class = ' no-pages';
|
989 |
-
}
|
990 |
-
$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
|
991 |
-
|
992 |
-
echo $this->_pagination;
|
993 |
-
}
|
994 |
-
|
995 |
-
/**
|
996 |
-
* Gets a list of columns.
|
997 |
-
*
|
998 |
-
* The format is:
|
999 |
-
* - `'internal-name' => 'Title'`
|
1000 |
-
*
|
1001 |
-
* @since 3.1.0
|
1002 |
-
* @abstract
|
1003 |
-
*
|
1004 |
-
* @return array
|
1005 |
-
*/
|
1006 |
-
public function get_columns() {
|
1007 |
-
die( 'function WP_List_Table::get_columns() must be overridden in a subclass.' );
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
/**
|
1011 |
-
* Gets a list of sortable columns.
|
1012 |
-
*
|
1013 |
-
* The format is:
|
1014 |
-
* - `'internal-name' => 'orderby'`
|
1015 |
-
* - `'internal-name' => array( 'orderby', 'asc' )` - The second element sets the initial sorting order.
|
1016 |
-
* - `'internal-name' => array( 'orderby', true )` - The second element makes the initial order descending.
|
1017 |
-
*
|
1018 |
-
* @since 3.1.0
|
1019 |
-
*
|
1020 |
-
* @return array
|
1021 |
-
*/
|
1022 |
-
protected function get_sortable_columns() {
|
1023 |
-
return array();
|
1024 |
-
}
|
1025 |
-
|
1026 |
-
/**
|
1027 |
-
* Gets the name of the default primary column.
|
1028 |
-
*
|
1029 |
-
* @since 4.3.0
|
1030 |
-
*
|
1031 |
-
* @return string Name of the default primary column, in this case, an empty string.
|
1032 |
-
*/
|
1033 |
-
protected function get_default_primary_column_name() {
|
1034 |
-
$columns = $this->get_columns();
|
1035 |
-
$column = '';
|
1036 |
-
|
1037 |
-
if ( empty( $columns ) ) {
|
1038 |
-
return $column;
|
1039 |
-
}
|
1040 |
-
|
1041 |
-
// We need a primary defined so responsive views show something,
|
1042 |
-
// so let's fall back to the first non-checkbox column.
|
1043 |
-
foreach ( $columns as $col => $column_name ) {
|
1044 |
-
if ( 'cb' === $col ) {
|
1045 |
-
continue;
|
1046 |
-
}
|
1047 |
-
|
1048 |
-
$column = $col;
|
1049 |
-
break;
|
1050 |
-
}
|
1051 |
-
|
1052 |
-
return $column;
|
1053 |
-
}
|
1054 |
-
|
1055 |
-
/**
|
1056 |
-
* Public wrapper for WP_List_Table::get_default_primary_column_name().
|
1057 |
-
*
|
1058 |
-
* @since 4.4.0
|
1059 |
-
*
|
1060 |
-
* @return string Name of the default primary column.
|
1061 |
-
*/
|
1062 |
-
public function get_primary_column() {
|
1063 |
-
return $this->get_primary_column_name();
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
/**
|
1067 |
-
* Gets the name of the primary column.
|
1068 |
-
*
|
1069 |
-
* @since 4.3.0
|
1070 |
-
*
|
1071 |
-
* @return string The name of the primary column.
|
1072 |
-
*/
|
1073 |
-
protected function get_primary_column_name() {
|
1074 |
-
$columns = get_column_headers( $this->screen );
|
1075 |
-
$default = $this->get_default_primary_column_name();
|
1076 |
-
|
1077 |
-
// If the primary column doesn't exist,
|
1078 |
-
// fall back to the first non-checkbox column.
|
1079 |
-
if ( ! isset( $columns[ $default ] ) ) {
|
1080 |
-
$default = self::get_default_primary_column_name();
|
1081 |
-
}
|
1082 |
-
|
1083 |
-
/**
|
1084 |
-
* Filters the name of the primary column for the current list table.
|
1085 |
-
*
|
1086 |
-
* @since 4.3.0
|
1087 |
-
*
|
1088 |
-
* @param string $default Column name default for the specific list table, e.g. 'name'.
|
1089 |
-
* @param string $context Screen ID for specific list table, e.g. 'plugins'.
|
1090 |
-
*/
|
1091 |
-
$column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
|
1092 |
-
|
1093 |
-
if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
|
1094 |
-
$column = $default;
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
return $column;
|
1098 |
-
}
|
1099 |
-
|
1100 |
-
/**
|
1101 |
-
* Gets a list of all, hidden, and sortable columns, with filter applied.
|
1102 |
-
*
|
1103 |
-
* @since 3.1.0
|
1104 |
-
*
|
1105 |
-
* @return array
|
1106 |
-
*/
|
1107 |
-
protected function get_column_info() {
|
1108 |
-
// $_column_headers is already set / cached.
|
1109 |
-
if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
|
1110 |
-
/*
|
1111 |
-
* Backward compatibility for `$_column_headers` format prior to WordPress 4.3.
|
1112 |
-
*
|
1113 |
-
* In WordPress 4.3 the primary column name was added as a fourth item in the
|
1114 |
-
* column headers property. This ensures the primary column name is included
|
1115 |
-
* in plugins setting the property directly in the three item format.
|
1116 |
-
*/
|
1117 |
-
$column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
|
1118 |
-
foreach ( $this->_column_headers as $key => $value ) {
|
1119 |
-
$column_headers[ $key ] = $value;
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
return $column_headers;
|
1123 |
-
}
|
1124 |
-
|
1125 |
-
$columns = get_column_headers( $this->screen );
|
1126 |
-
$hidden = get_hidden_columns( $this->screen );
|
1127 |
-
|
1128 |
-
$sortable_columns = $this->get_sortable_columns();
|
1129 |
-
/**
|
1130 |
-
* Filters the list table sortable columns for a specific screen.
|
1131 |
-
*
|
1132 |
-
* The dynamic portion of the hook name, `$this->screen->id`, refers
|
1133 |
-
* to the ID of the current screen.
|
1134 |
-
*
|
1135 |
-
* @since 3.1.0
|
1136 |
-
*
|
1137 |
-
* @param array $sortable_columns An array of sortable columns.
|
1138 |
-
*/
|
1139 |
-
$_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
|
1140 |
-
|
1141 |
-
$sortable = array();
|
1142 |
-
foreach ( $_sortable as $id => $data ) {
|
1143 |
-
if ( empty( $data ) ) {
|
1144 |
-
continue;
|
1145 |
-
}
|
1146 |
-
|
1147 |
-
$data = (array) $data;
|
1148 |
-
if ( ! isset( $data[1] ) ) {
|
1149 |
-
$data[1] = false;
|
1150 |
-
}
|
1151 |
-
|
1152 |
-
$sortable[ $id ] = $data;
|
1153 |
-
}
|
1154 |
-
|
1155 |
-
$primary = $this->get_primary_column_name();
|
1156 |
-
$this->_column_headers = array( $columns, $hidden, $sortable, $primary );
|
1157 |
-
|
1158 |
-
return $this->_column_headers;
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
/**
|
1162 |
-
* Returns the number of visible columns.
|
1163 |
-
*
|
1164 |
-
* @since 3.1.0
|
1165 |
-
*
|
1166 |
-
* @return int
|
1167 |
-
*/
|
1168 |
-
public function get_column_count() {
|
1169 |
-
list ( $columns, $hidden ) = $this->get_column_info();
|
1170 |
-
$hidden = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
|
1171 |
-
return count( $columns ) - count( $hidden );
|
1172 |
-
}
|
1173 |
-
|
1174 |
-
/**
|
1175 |
-
* Prints column headers, accounting for hidden and sortable columns.
|
1176 |
-
*
|
1177 |
-
* @since 3.1.0
|
1178 |
-
*
|
1179 |
-
* @param bool $with_id Whether to set the ID attribute or not
|
1180 |
-
*/
|
1181 |
-
public function print_column_headers( $with_id = true ) {
|
1182 |
-
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
|
1183 |
-
|
1184 |
-
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
1185 |
-
$current_url = remove_query_arg( 'paged', $current_url );
|
1186 |
-
|
1187 |
-
if ( isset( $_GET['orderby'] ) ) {
|
1188 |
-
$current_orderby = $_GET['orderby'];
|
1189 |
-
} else {
|
1190 |
-
$current_orderby = '';
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
|
1194 |
-
$current_order = 'desc';
|
1195 |
-
} else {
|
1196 |
-
$current_order = 'asc';
|
1197 |
-
}
|
1198 |
-
|
1199 |
-
if ( ! empty( $columns['cb'] ) ) {
|
1200 |
-
static $cb_counter = 1;
|
1201 |
-
$columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
|
1202 |
-
. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
|
1203 |
-
$cb_counter++;
|
1204 |
-
}
|
1205 |
-
|
1206 |
-
foreach ( $columns as $column_key => $column_display_name ) {
|
1207 |
-
$class = array( 'manage-column', "column-$column_key" );
|
1208 |
-
|
1209 |
-
if ( in_array( $column_key, $hidden, true ) ) {
|
1210 |
-
$class[] = 'hidden';
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
if ( 'cb' === $column_key ) {
|
1214 |
-
$class[] = 'check-column';
|
1215 |
-
} elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
|
1216 |
-
$class[] = 'num';
|
1217 |
-
}
|
1218 |
-
|
1219 |
-
if ( $column_key === $primary ) {
|
1220 |
-
$class[] = 'column-primary';
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
if ( isset( $sortable[ $column_key ] ) ) {
|
1224 |
-
list( $orderby, $desc_first ) = $sortable[ $column_key ];
|
1225 |
-
|
1226 |
-
if ( $current_orderby === $orderby ) {
|
1227 |
-
$order = 'asc' === $current_order ? 'desc' : 'asc';
|
1228 |
-
|
1229 |
-
$class[] = 'sorted';
|
1230 |
-
$class[] = $current_order;
|
1231 |
-
} else {
|
1232 |
-
$order = strtolower( $desc_first );
|
1233 |
-
|
1234 |
-
if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) {
|
1235 |
-
$order = $desc_first ? 'desc' : 'asc';
|
1236 |
-
}
|
1237 |
-
|
1238 |
-
$class[] = 'sortable';
|
1239 |
-
$class[] = 'desc' === $order ? 'asc' : 'desc';
|
1240 |
-
}
|
1241 |
-
|
1242 |
-
$column_display_name = sprintf(
|
1243 |
-
'<a href="%s"><span>%s</span><span class="sorting-indicator"></span></a>',
|
1244 |
-
esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ),
|
1245 |
-
$column_display_name
|
1246 |
-
);
|
1247 |
-
}
|
1248 |
-
|
1249 |
-
$tag = ( 'cb' === $column_key ) ? 'td' : 'th';
|
1250 |
-
$scope = ( 'th' === $tag ) ? 'scope="col"' : '';
|
1251 |
-
$id = $with_id ? "id='$column_key'" : '';
|
1252 |
-
|
1253 |
-
if ( ! empty( $class ) ) {
|
1254 |
-
$class = "class='" . implode( ' ', $class ) . "'";
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
echo "<$tag $scope $id $class>$column_display_name</$tag>";
|
1258 |
-
}
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
/**
|
1262 |
-
* Displays the table.
|
1263 |
-
*
|
1264 |
-
* @since 3.1.0
|
1265 |
-
*/
|
1266 |
-
public function display() {
|
1267 |
-
$singular = $this->_args['singular'];
|
1268 |
-
|
1269 |
-
$this->display_tablenav( 'top' );
|
1270 |
-
|
1271 |
-
$this->screen->render_screen_reader_content( 'heading_list' );
|
1272 |
-
?>
|
1273 |
-
<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
|
1274 |
-
<thead>
|
1275 |
-
<tr>
|
1276 |
-
<?php $this->print_column_headers(); ?>
|
1277 |
-
</tr>
|
1278 |
-
</thead>
|
1279 |
-
|
1280 |
-
<tbody id="the-list"
|
1281 |
-
<?php
|
1282 |
-
if ( $singular ) {
|
1283 |
-
echo " data-wp-lists='list:$singular'";
|
1284 |
-
}
|
1285 |
-
?>
|
1286 |
-
>
|
1287 |
-
<?php $this->display_rows_or_placeholder(); ?>
|
1288 |
-
</tbody>
|
1289 |
-
|
1290 |
-
<tfoot>
|
1291 |
-
<tr>
|
1292 |
-
<?php $this->print_column_headers( false ); ?>
|
1293 |
-
</tr>
|
1294 |
-
</tfoot>
|
1295 |
-
|
1296 |
-
</table>
|
1297 |
-
<?php
|
1298 |
-
$this->display_tablenav( 'bottom' );
|
1299 |
-
}
|
1300 |
-
|
1301 |
-
/**
|
1302 |
-
* Gets a list of CSS classes for the WP_List_Table table tag.
|
1303 |
-
*
|
1304 |
-
* @since 3.1.0
|
1305 |
-
*
|
1306 |
-
* @return string[] Array of CSS classes for the table tag.
|
1307 |
-
*/
|
1308 |
-
protected function get_table_classes() {
|
1309 |
-
$mode = get_user_setting( 'posts_list_mode', 'list' );
|
1310 |
-
|
1311 |
-
$mode_class = esc_attr( 'table-view-' . $mode );
|
1312 |
-
|
1313 |
-
return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] );
|
1314 |
-
}
|
1315 |
-
|
1316 |
-
/**
|
1317 |
-
* Generates the table navigation above or below the table
|
1318 |
-
*
|
1319 |
-
* @since 3.1.0
|
1320 |
-
* @param string $which
|
1321 |
-
*/
|
1322 |
-
protected function display_tablenav( $which ) {
|
1323 |
-
if ( 'top' === $which ) {
|
1324 |
-
wp_nonce_field( 'bulk-' . $this->_args['plural'] );
|
1325 |
-
}
|
1326 |
-
?>
|
1327 |
-
<div class="tablenav <?php echo esc_attr( $which ); ?>">
|
1328 |
-
|
1329 |
-
<?php if ( $this->has_items() ) : ?>
|
1330 |
-
<div class="alignleft actions bulkactions">
|
1331 |
-
<?php $this->bulk_actions( $which ); ?>
|
1332 |
-
</div>
|
1333 |
-
<?php
|
1334 |
-
endif;
|
1335 |
-
$this->extra_tablenav( $which );
|
1336 |
-
$this->pagination( $which );
|
1337 |
-
?>
|
1338 |
-
|
1339 |
-
<br class="clear" />
|
1340 |
-
</div>
|
1341 |
-
<?php
|
1342 |
-
}
|
1343 |
-
|
1344 |
-
/**
|
1345 |
-
* Extra controls to be displayed between bulk actions and pagination.
|
1346 |
-
*
|
1347 |
-
* @since 3.1.0
|
1348 |
-
*
|
1349 |
-
* @param string $which
|
1350 |
-
*/
|
1351 |
-
protected function extra_tablenav( $which ) {}
|
1352 |
-
|
1353 |
-
/**
|
1354 |
-
* Generates the tbody element for the list table.
|
1355 |
-
*
|
1356 |
-
* @since 3.1.0
|
1357 |
-
*/
|
1358 |
-
public function display_rows_or_placeholder() {
|
1359 |
-
if ( $this->has_items() ) {
|
1360 |
-
$this->display_rows();
|
1361 |
-
} else {
|
1362 |
-
echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
|
1363 |
-
$this->no_items();
|
1364 |
-
echo '</td></tr>';
|
1365 |
-
}
|
1366 |
-
}
|
1367 |
-
|
1368 |
-
/**
|
1369 |
-
* Generates the table rows.
|
1370 |
-
*
|
1371 |
-
* @since 3.1.0
|
1372 |
-
*/
|
1373 |
-
public function display_rows() {
|
1374 |
-
foreach ( $this->items as $item ) {
|
1375 |
-
$this->single_row( $item );
|
1376 |
-
}
|
1377 |
-
}
|
1378 |
-
|
1379 |
-
/**
|
1380 |
-
* Generates content for a single row of the table.
|
1381 |
-
*
|
1382 |
-
* @since 3.1.0
|
1383 |
-
*
|
1384 |
-
* @param object|array $item The current item
|
1385 |
-
*/
|
1386 |
-
public function single_row( $item ) {
|
1387 |
-
echo '<tr>';
|
1388 |
-
$this->single_row_columns( $item );
|
1389 |
-
echo '</tr>';
|
1390 |
-
}
|
1391 |
-
|
1392 |
-
/**
|
1393 |
-
* @param object|array $item
|
1394 |
-
* @param string $column_name
|
1395 |
-
*/
|
1396 |
-
protected function column_default( $item, $column_name ) {}
|
1397 |
-
|
1398 |
-
/**
|
1399 |
-
* @param object|array $item
|
1400 |
-
*/
|
1401 |
-
protected function column_cb( $item ) {}
|
1402 |
-
|
1403 |
-
/**
|
1404 |
-
* Generates the columns for a single row of the table.
|
1405 |
-
*
|
1406 |
-
* @since 3.1.0
|
1407 |
-
*
|
1408 |
-
* @param object|array $item The current item.
|
1409 |
-
*/
|
1410 |
-
protected function single_row_columns( $item ) {
|
1411 |
-
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
|
1412 |
-
|
1413 |
-
foreach ( $columns as $column_name => $column_display_name ) {
|
1414 |
-
$classes = "$column_name column-$column_name";
|
1415 |
-
if ( $primary === $column_name ) {
|
1416 |
-
$classes .= ' has-row-actions column-primary';
|
1417 |
-
}
|
1418 |
-
|
1419 |
-
if ( in_array( $column_name, $hidden, true ) ) {
|
1420 |
-
$classes .= ' hidden';
|
1421 |
-
}
|
1422 |
-
|
1423 |
-
// Comments column uses HTML in the display name with screen reader text.
|
1424 |
-
// Strip tags to get closer to a user-friendly string.
|
1425 |
-
$data = 'data-colname="' . esc_attr( wp_strip_all_tags( $column_display_name ) ) . '"';
|
1426 |
-
|
1427 |
-
$attributes = "class='$classes' $data";
|
1428 |
-
|
1429 |
-
if ( 'cb' === $column_name ) {
|
1430 |
-
echo '<th scope="row" class="check-column">';
|
1431 |
-
echo $this->column_cb( $item );
|
1432 |
-
echo '</th>';
|
1433 |
-
} elseif ( method_exists( $this, '_column_' . $column_name ) ) {
|
1434 |
-
echo call_user_func(
|
1435 |
-
array( $this, '_column_' . $column_name ),
|
1436 |
-
$item,
|
1437 |
-
$classes,
|
1438 |
-
$data,
|
1439 |
-
$primary
|
1440 |
-
);
|
1441 |
-
} elseif ( method_exists( $this, 'column_' . $column_name ) ) {
|
1442 |
-
echo "<td $attributes>";
|
1443 |
-
echo call_user_func( array( $this, 'column_' . $column_name ), $item );
|
1444 |
-
echo $this->handle_row_actions( $item, $column_name, $primary );
|
1445 |
-
echo '</td>';
|
1446 |
-
} else {
|
1447 |
-
echo "<td $attributes>";
|
1448 |
-
echo $this->column_default( $item, $column_name );
|
1449 |
-
echo $this->handle_row_actions( $item, $column_name, $primary );
|
1450 |
-
echo '</td>';
|
1451 |
-
}
|
1452 |
-
}
|
1453 |
-
}
|
1454 |
-
|
1455 |
-
/**
|
1456 |
-
* Generates and display row actions links for the list table.
|
1457 |
-
*
|
1458 |
-
* @since 4.3.0
|
1459 |
-
*
|
1460 |
-
* @param object|array $item The item being acted upon.
|
1461 |
-
* @param string $column_name Current column name.
|
1462 |
-
* @param string $primary Primary column name.
|
1463 |
-
* @return string The row actions HTML, or an empty string
|
1464 |
-
* if the current column is not the primary column.
|
1465 |
-
*/
|
1466 |
-
protected function handle_row_actions( $item, $column_name, $primary ) {
|
1467 |
-
return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
|
1468 |
-
}
|
1469 |
-
|
1470 |
-
/**
|
1471 |
-
* Handles an incoming ajax request (called from admin-ajax.php)
|
1472 |
-
*
|
1473 |
-
* @since 3.1.0
|
1474 |
-
*/
|
1475 |
-
public function ajax_response() {
|
1476 |
-
$this->prepare_items();
|
1477 |
-
|
1478 |
-
ob_start();
|
1479 |
-
if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
|
1480 |
-
$this->display_rows();
|
1481 |
-
} else {
|
1482 |
-
$this->display_rows_or_placeholder();
|
1483 |
-
}
|
1484 |
-
|
1485 |
-
$rows = ob_get_clean();
|
1486 |
-
|
1487 |
-
$response = array( 'rows' => $rows );
|
1488 |
-
|
1489 |
-
if ( isset( $this->_pagination_args['total_items'] ) ) {
|
1490 |
-
$response['total_items_i18n'] = sprintf(
|
1491 |
-
/* translators: Number of items. */
|
1492 |
-
_n( '%s item', '%s items', $this->_pagination_args['total_items'] ),
|
1493 |
-
number_format_i18n( $this->_pagination_args['total_items'] )
|
1494 |
-
);
|
1495 |
-
}
|
1496 |
-
if ( isset( $this->_pagination_args['total_pages'] ) ) {
|
1497 |
-
$response['total_pages'] = $this->_pagination_args['total_pages'];
|
1498 |
-
$response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
|
1499 |
-
}
|
1500 |
-
|
1501 |
-
die( wp_json_encode( $response ) );
|
1502 |
-
}
|
1503 |
-
|
1504 |
-
/**
|
1505 |
-
* Sends required variables to JavaScript land.
|
1506 |
-
*
|
1507 |
-
* @since 3.1.0
|
1508 |
-
*/
|
1509 |
-
public function _js_vars() {
|
1510 |
-
$args = array(
|
1511 |
-
'class' => get_class( $this ),
|
1512 |
-
'screen' => array(
|
1513 |
-
'id' => $this->screen->id,
|
1514 |
-
'base' => $this->screen->base,
|
1515 |
-
),
|
1516 |
-
);
|
1517 |
-
|
1518 |
-
printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
|
1519 |
-
}
|
1520 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/class-uninstall.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Installs the DB
|
6 |
*
|
7 |
-
* @since
|
8 |
*/
|
9 |
class Visual_Form_Builder_Admin_Uninstall {
|
10 |
/**
|
@@ -13,16 +13,12 @@ class Visual_Form_Builder_Admin_Uninstall {
|
|
13 |
* @access public
|
14 |
* @return void
|
15 |
*/
|
16 |
-
public function __construct() {
|
17 |
-
}
|
18 |
|
19 |
/**
|
20 |
-
* uninstall
|
21 |
*
|
22 |
-
* @
|
23 |
-
* @param mixed $license_key
|
24 |
-
* @param mixed $license_email
|
25 |
-
* @return void
|
26 |
*/
|
27 |
public function uninstall() {
|
28 |
$this->uninstall_data();
|
@@ -42,7 +38,7 @@ class Visual_Form_Builder_Admin_Uninstall {
|
|
42 |
array( $plugin => time() ) + (array) get_option( 'recently_activated' )
|
43 |
);
|
44 |
|
45 |
-
|
46 |
exit();
|
47 |
}
|
48 |
|
@@ -55,9 +51,9 @@ class Visual_Form_Builder_Admin_Uninstall {
|
|
55 |
public function uninstall_data() {
|
56 |
global $wpdb;
|
57 |
|
58 |
-
$form_table
|
59 |
-
$fields_table
|
60 |
-
$entries_table
|
61 |
|
62 |
$wpdb->query( "DROP TABLE IF EXISTS $form_table" );
|
63 |
$wpdb->query( "DROP TABLE IF EXISTS $fields_table" );
|
@@ -68,6 +64,6 @@ class Visual_Form_Builder_Admin_Uninstall {
|
|
68 |
delete_option( 'vfb_dashboard_widget_options' );
|
69 |
delete_option( 'vfb-settings' );
|
70 |
|
71 |
-
$wpdb->query(
|
72 |
}
|
73 |
}
|
4 |
*
|
5 |
* Installs the DB
|
6 |
*
|
7 |
+
* @since 2.9.9
|
8 |
*/
|
9 |
class Visual_Form_Builder_Admin_Uninstall {
|
10 |
/**
|
13 |
* @access public
|
14 |
* @return void
|
15 |
*/
|
16 |
+
public function __construct() { }
|
|
|
17 |
|
18 |
/**
|
19 |
+
* [uninstall description]
|
20 |
*
|
21 |
+
* @return void
|
|
|
|
|
|
|
22 |
*/
|
23 |
public function uninstall() {
|
24 |
$this->uninstall_data();
|
38 |
array( $plugin => time() ) + (array) get_option( 'recently_activated' )
|
39 |
);
|
40 |
|
41 |
+
wp_safe_edirect( admin_url( 'plugins.php' ) );
|
42 |
exit();
|
43 |
}
|
44 |
|
51 |
public function uninstall_data() {
|
52 |
global $wpdb;
|
53 |
|
54 |
+
$form_table = $wpdb->prefix . 'visual_form_builder_fields';
|
55 |
+
$fields_table = $wpdb->prefix . 'visual_form_builder_forms';
|
56 |
+
$entries_table = $wpdb->prefix . 'visual_form_builder_entries';
|
57 |
|
58 |
$wpdb->query( "DROP TABLE IF EXISTS $form_table" );
|
59 |
$wpdb->query( "DROP TABLE IF EXISTS $fields_table" );
|
64 |
delete_option( 'vfb_dashboard_widget_options' );
|
65 |
delete_option( 'vfb-settings' );
|
66 |
|
67 |
+
$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' )" );
|
68 |
}
|
69 |
}
|
inc/countries.php
CHANGED
@@ -4,210 +4,210 @@
|
|
4 |
*
|
5 |
* Returns an array of countries and codes.
|
6 |
*
|
7 |
-
* @package
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
14 |
return array(
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
"Cote d\'Ivoire",
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
);
|
4 |
*
|
5 |
* Returns an array of countries and codes.
|
6 |
*
|
7 |
+
* @package VFB
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
+
exit;
|
12 |
}
|
13 |
|
14 |
return array(
|
15 |
+
'',
|
16 |
+
'Afghanistan',
|
17 |
+
'Albania',
|
18 |
+
'Algeria',
|
19 |
+
'Andorra',
|
20 |
+
'Angola',
|
21 |
+
'Antigua and Barbuda',
|
22 |
+
'Argentina',
|
23 |
+
'Armenia',
|
24 |
+
'Australia',
|
25 |
+
'Austria',
|
26 |
+
'Azerbaijan',
|
27 |
+
'Bahamas',
|
28 |
+
'Bahrain',
|
29 |
+
'Bangladesh',
|
30 |
+
'Barbados',
|
31 |
+
'Belarus',
|
32 |
+
'Belgium',
|
33 |
+
'Belize',
|
34 |
+
'Benin',
|
35 |
+
'Bhutan',
|
36 |
+
'Bolivia',
|
37 |
+
'Bosnia and Herzegovina',
|
38 |
+
'Botswana',
|
39 |
+
'Brazil',
|
40 |
+
'Brunei',
|
41 |
+
'Bulgaria',
|
42 |
+
'Burkina Faso',
|
43 |
+
'Burundi',
|
44 |
+
'Cambodia',
|
45 |
+
'Cameroon',
|
46 |
+
'Canada',
|
47 |
+
'Cape Verde',
|
48 |
+
'Central African Republic',
|
49 |
+
'Chad',
|
50 |
+
'Chile',
|
51 |
+
'China',
|
52 |
+
'Colombia',
|
53 |
+
'Comoros',
|
54 |
+
'Congo (Brazzaville)',
|
55 |
+
'Congo',
|
56 |
+
'Costa Rica',
|
57 |
"Cote d\'Ivoire",
|
58 |
+
'Croatia',
|
59 |
+
'Cuba',
|
60 |
+
'Cyprus',
|
61 |
+
'Czech Republic',
|
62 |
+
'Denmark',
|
63 |
+
'Djibouti',
|
64 |
+
'Dominica',
|
65 |
+
'Dominican Republic',
|
66 |
+
'East Timor (Timor Timur)',
|
67 |
+
'Ecuador',
|
68 |
+
'Egypt',
|
69 |
+
'El Salvador',
|
70 |
+
'Equatorial Guinea',
|
71 |
+
'Eritrea',
|
72 |
+
'Estonia',
|
73 |
+
'Ethiopia',
|
74 |
+
'Fiji',
|
75 |
+
'Finland',
|
76 |
+
'France',
|
77 |
+
'Gabon',
|
78 |
+
'Gambia, The',
|
79 |
+
'Georgia',
|
80 |
+
'Germany',
|
81 |
+
'Ghana',
|
82 |
+
'Greece',
|
83 |
+
'Grenada',
|
84 |
+
'Guatemala',
|
85 |
+
'Guinea',
|
86 |
+
'Guinea-Bissau',
|
87 |
+
'Guyana',
|
88 |
+
'Haiti',
|
89 |
+
'Honduras',
|
90 |
+
'Hungary',
|
91 |
+
'Iceland',
|
92 |
+
'India',
|
93 |
+
'Indonesia',
|
94 |
+
'Iran',
|
95 |
+
'Iraq',
|
96 |
+
'Ireland',
|
97 |
+
'Israel',
|
98 |
+
'Italy',
|
99 |
+
'Jamaica',
|
100 |
+
'Japan',
|
101 |
+
'Jordan',
|
102 |
+
'Kazakhstan',
|
103 |
+
'Kenya',
|
104 |
+
'Kiribati',
|
105 |
+
'Korea, North',
|
106 |
+
'Korea, South',
|
107 |
+
'Kuwait',
|
108 |
+
'Kyrgyzstan',
|
109 |
+
'Laos',
|
110 |
+
'Latvia',
|
111 |
+
'Lebanon',
|
112 |
+
'Lesotho',
|
113 |
+
'Liberia',
|
114 |
+
'Libya',
|
115 |
+
'Liechtenstein',
|
116 |
+
'Lithuania',
|
117 |
+
'Luxembourg',
|
118 |
+
'Macedonia',
|
119 |
+
'Madagascar',
|
120 |
+
'Malawi',
|
121 |
+
'Malaysia',
|
122 |
+
'Maldives',
|
123 |
+
'Mali',
|
124 |
+
'Malta',
|
125 |
+
'Marshall Islands',
|
126 |
+
'Mauritania',
|
127 |
+
'Mauritius',
|
128 |
+
'Mexico',
|
129 |
+
'Micronesia',
|
130 |
+
'Moldova',
|
131 |
+
'Monaco',
|
132 |
+
'Mongolia',
|
133 |
+
'Montenegro',
|
134 |
+
'Morocco',
|
135 |
+
'Mozambique',
|
136 |
+
'Myanmar',
|
137 |
+
'Namibia',
|
138 |
+
'Nauru',
|
139 |
+
'Nepal',
|
140 |
+
'Netherlands',
|
141 |
+
'New Zealand',
|
142 |
+
'Nicaragua',
|
143 |
+
'Niger',
|
144 |
+
'Nigeria',
|
145 |
+
'Norway',
|
146 |
+
'Oman',
|
147 |
+
'Pakistan',
|
148 |
+
'Palestinian Territory',
|
149 |
+
'Palau',
|
150 |
+
'Panama',
|
151 |
+
'Papua New Guinea',
|
152 |
+
'Paraguay',
|
153 |
+
'Peru',
|
154 |
+
'Philippines',
|
155 |
+
'Poland',
|
156 |
+
'Portugal',
|
157 |
+
'Qatar',
|
158 |
+
'Romania',
|
159 |
+
'Russia',
|
160 |
+
'Rwanda',
|
161 |
+
'Saint Kitts and Nevis',
|
162 |
+
'Saint Lucia',
|
163 |
+
'Saint Vincent',
|
164 |
+
'Samoa',
|
165 |
+
'San Marino',
|
166 |
+
'Sao Tome and Principe',
|
167 |
+
'Saudi Arabia',
|
168 |
+
'Senegal',
|
169 |
+
'Serbia',
|
170 |
+
'Seychelles',
|
171 |
+
'Sierra Leone',
|
172 |
+
'Singapore',
|
173 |
+
'Slovakia',
|
174 |
+
'Slovenia',
|
175 |
+
'Solomon Islands',
|
176 |
+
'Somalia',
|
177 |
+
'South Africa',
|
178 |
+
'Spain',
|
179 |
+
'Sri Lanka',
|
180 |
+
'Sudan',
|
181 |
+
'Suriname',
|
182 |
+
'Swaziland',
|
183 |
+
'Sweden',
|
184 |
+
'Switzerland',
|
185 |
+
'Syria',
|
186 |
+
'Taiwan',
|
187 |
+
'Tajikistan',
|
188 |
+
'Tanzania',
|
189 |
+
'Thailand',
|
190 |
+
'Togo',
|
191 |
+
'Tonga',
|
192 |
+
'Trinidad and Tobago',
|
193 |
+
'Tunisia',
|
194 |
+
'Turkey',
|
195 |
+
'Turkmenistan',
|
196 |
+
'Tuvalu',
|
197 |
+
'Uganda',
|
198 |
+
'Ukraine',
|
199 |
+
'United Arab Emirates',
|
200 |
+
'United Kingdom',
|
201 |
+
'United States of America',
|
202 |
+
'Uruguay',
|
203 |
+
'Uzbekistan',
|
204 |
+
'Vanuatu',
|
205 |
+
'Vatican City',
|
206 |
+
'Venezuela',
|
207 |
+
'Vietnam',
|
208 |
+
'Western Sahara',
|
209 |
+
'Western Samoa',
|
210 |
+
'Yemen',
|
211 |
+
'Zambia',
|
212 |
+
'Zimbabwe',
|
213 |
);
|
public/assets/css/visual-form-builder.css
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
form.visual-form-builder{
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
}
|
11 |
|
12 |
form.visual-form-builder li{
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
clear: both;
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
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 |
-
|
39 |
}
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
|
45 |
/* !Remove list item styles */
|
46 |
.visual-form-builder ul,
|
@@ -51,48 +51,48 @@ form.visual-form-builder li{
|
|
51 |
.entry-content .visual-form-builder ol,
|
52 |
.comment-content .visual-form-builder ol,
|
53 |
.mu_register .visual-form-builder ol {
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
background: none !important;
|
57 |
list-style: none !important;
|
58 |
list-style-type: none !important;
|
59 |
list-style-image: none !important;
|
60 |
-
|
61 |
-
line-height: inherit;
|
62 |
-
}
|
63 |
|
64 |
-
.visual-form-builder ul li {
|
65 |
-
|
66 |
-
background: none !important;
|
67 |
-
list-style: none !important;
|
68 |
-
list-style-type: none !important;
|
69 |
-
list-style-image: none !important;
|
70 |
}
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
list-style: none !important;
|
86 |
-
list-style-type: none !important;
|
87 |
-
list-style-image: none !important;
|
88 |
-
}
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
.vfb-span,
|
98 |
.visual-form-builder li div span.vfb-span,
|
@@ -100,29 +100,29 @@ form.visual-form-builder li{
|
|
100 |
span.vfb-full input,
|
101 |
span.vfb-full input[type="text"].vfb-medium,
|
102 |
span.vfb-full select{
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
|
127 |
.visual-form-builder span.vfb-right input,
|
128 |
.visual-form-builder span.vfb-right input[type="text"],
|
@@ -130,106 +130,106 @@ span.vfb-full select{
|
|
130 |
.visual-form-builder span.vfb-left input,
|
131 |
.visual-form-builder span.vfb-left input[type="text"],
|
132 |
.visual-form-builder span.vfb-left select{
|
133 |
-
|
134 |
}
|
135 |
|
136 |
/* !Time Field */
|
137 |
.visual-form-builder span.vfb-time{
|
138 |
-
|
139 |
-
|
140 |
}
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
|
147 |
.visual-form-builder li div label,
|
148 |
.visual-form-builder li span label {
|
149 |
-
|
150 |
-
|
151 |
}
|
152 |
|
153 |
/* !Fieldset */
|
154 |
.visual-form-builder fieldset{
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
}
|
162 |
|
163 |
/* !Legend */
|
164 |
.visual-form-builder .vfb-legend{
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
}
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
|
179 |
/* !Description */
|
180 |
.visual-form-builder label,
|
181 |
label.vfb-desc{
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
}
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
.visual-form-builder.left-label .vfb-desc,
|
192 |
-
.visual-form-builder.right-label .vfb-desc{
|
193 |
-
float:left;
|
194 |
-
margin:0 15px 0 0;
|
195 |
-
width:20%;
|
196 |
-
}
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
-
.visual-form-builder label.vfb-choice{
|
215 |
-
|
216 |
-
padding:0 0 5px;
|
217 |
-
width:88%;
|
218 |
-
font-size:100%;
|
219 |
-
line-height:150%;
|
220 |
}
|
221 |
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
color: #BC1212;
|
230 |
-
vertical-align: baseline;
|
231 |
-
font-weight: bold;
|
232 |
-
}
|
233 |
|
234 |
/* !Input, Textarea, and Select */
|
235 |
input.vfb-text,
|
@@ -238,48 +238,48 @@ input[type="tel"].vfb-text,
|
|
238 |
input[type="email"].vfb-text,
|
239 |
input[type="url"].vfb-text,
|
240 |
textarea.vfb-textarea {
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
}
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
|
284 |
input.vfb-text,
|
285 |
input[type="text"].vfb-text,
|
@@ -288,16 +288,16 @@ input[type="email"].vfb-text,
|
|
288 |
input[type="url"].vfb-text,
|
289 |
textarea.vfb-textarea,
|
290 |
select.vfb-select {
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
}
|
298 |
|
299 |
select.vfb-select{
|
300 |
-
|
301 |
}
|
302 |
|
303 |
input.vfb-small,
|
@@ -306,7 +306,7 @@ input[type="tel"].vfb-small,
|
|
306 |
input[type="email"].vfb-small,
|
307 |
input[type="url"].vfb-small,
|
308 |
select.vfb-small{
|
309 |
-
|
310 |
}
|
311 |
|
312 |
input.vfb-medium,
|
@@ -315,7 +315,7 @@ input[type="tel"].vfb-medium,
|
|
315 |
input[type="email"].vfb-medium,
|
316 |
input[type="url"].vfb-medium,
|
317 |
select.vfb-medium{
|
318 |
-
|
319 |
}
|
320 |
|
321 |
input.vfb-large,
|
@@ -325,33 +325,33 @@ input[type="email"].vfb-large,
|
|
325 |
input[type="url"].vfb-large,
|
326 |
select.vfb-large,
|
327 |
textarea.vfb-textarea{
|
328 |
-
|
329 |
}
|
330 |
|
331 |
input[type="file"].vfb-small,
|
332 |
input[type="file"].vfb-medium,
|
333 |
input[type="file"].vfb-large {
|
334 |
-
|
335 |
-
|
336 |
}
|
337 |
|
338 |
|
339 |
textarea.vfb-medium{
|
340 |
-
|
341 |
}
|
342 |
|
343 |
textarea.vfb-medium{
|
344 |
-
|
345 |
}
|
346 |
|
347 |
textarea.vfb-large{
|
348 |
-
|
349 |
}
|
350 |
|
351 |
/* !Submit Button */
|
352 |
.vfb-submit,
|
353 |
input[type="submit"].vfb-submit {
|
354 |
-
|
355 |
}
|
356 |
|
357 |
/* !Checkbox and Radio */
|
@@ -359,68 +359,68 @@ input.vfb-checkbox,
|
|
359 |
input[type="checkbox"].vfb-checkbox,
|
360 |
input.vfb-radio,
|
361 |
input[type="radio"].vfb-radio {
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
}
|
368 |
|
369 |
input.vfb-other,
|
370 |
input[type="text"].vfb-other {
|
371 |
-
|
372 |
}
|
373 |
|
374 |
/* !Field Layout */
|
375 |
.visual-form-builder li.vfb-two-column div span,
|
376 |
.visual-form-builder li.vfb-three-column div span,
|
377 |
.visual-form-builder li.vfb-auto-column div span{
|
378 |
-
|
379 |
-
|
380 |
}
|
381 |
|
382 |
.visual-form-builder li.vfb-three-column div span{
|
383 |
-
|
384 |
}
|
385 |
|
386 |
.visual-form-builder li.vfb-auto-column div span{
|
387 |
-
|
388 |
}
|
389 |
|
390 |
.visual-form-builder li.vfb-left-half,
|
391 |
.visual-form-builder li.vfb-left-third,
|
392 |
.visual-form-builder li.vfb-left-two-thirds{
|
393 |
-
|
394 |
-
|
395 |
}
|
396 |
|
397 |
.visual-form-builder li.vfb-right-half,
|
398 |
.visual-form-builder li.vfb-right-third,
|
399 |
.visual-form-builder li.vfb-right-two-thirds{
|
400 |
-
|
401 |
-
|
402 |
}
|
403 |
|
404 |
.visual-form-builder li.vfb-middle-third{
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
}
|
409 |
|
410 |
.visual-form-builder li.vfb-left-half,
|
411 |
.visual-form-builder li.vfb-right-half{
|
412 |
-
|
413 |
}
|
414 |
|
415 |
.visual-form-builder li.vfb-left-third,
|
416 |
.visual-form-builder li.vfb-middle-third,
|
417 |
.visual-form-builder li.vfb-right-third{
|
418 |
-
|
419 |
}
|
420 |
|
421 |
.visual-form-builder li.vfb-left-two-thirds,
|
422 |
.visual-form-builder li.vfb-right-two-thirds{
|
423 |
-
|
424 |
}
|
425 |
|
426 |
li.vfb-left-half .vfb-small,
|
@@ -444,14 +444,14 @@ li.vfb-right-third .vfb-large,
|
|
444 |
.visual-form-builder li.vfb-right-two-thirds .vfb-small,
|
445 |
.visual-form-builder li.vfb-right-two-thirds .vfb-medium,
|
446 |
.visual-form-builder li.vfb-right-two-thirds .vfb-large{
|
447 |
-
|
448 |
}
|
449 |
|
450 |
/* !Error */
|
451 |
label.vfb-error{
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
}
|
456 |
|
457 |
input.vfb-error,
|
@@ -463,68 +463,68 @@ input[type="url"].vfb-text.vfb-error,
|
|
463 |
select.vfb-error,
|
464 |
textarea.vfb-error,
|
465 |
textarea.vfb-textarea.vfb-error,{
|
466 |
-
|
467 |
}
|
468 |
|
469 |
/* !Success Mesage - Default */
|
470 |
p#form_success,
|
471 |
.vfb-form-success {
|
472 |
-
|
473 |
-
|
474 |
}
|
475 |
|
476 |
#ui-datepicker-div {
|
477 |
-
|
478 |
-
|
479 |
}
|
480 |
|
481 |
/* !Instructions */
|
482 |
.vfb-item-instructions{
|
483 |
-
|
484 |
-
|
485 |
}
|
486 |
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
|
499 |
/* !Sections */
|
500 |
.vfb-section-div {
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
}
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
|
517 |
/* !Clearing */
|
518 |
.vfb-clear{
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
}
|
526 |
|
527 |
/* !Conditional Field */
|
528 |
.vfb-conditional-hide{
|
529 |
-
|
530 |
}
|
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 !important;
|
14 |
+
width: auto !important;
|
15 |
+
background: none !important;
|
16 |
+
list-style: none !important;
|
17 |
+
list-style-type: none !important;
|
18 |
+
list-style-image: none !important;
|
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;
|
39 |
}
|
40 |
|
41 |
+
form.visual-form-builder .vfb-item-instructions br {
|
42 |
+
display: inline;
|
43 |
+
}
|
44 |
|
45 |
/* !Remove list item styles */
|
46 |
.visual-form-builder ul,
|
51 |
.entry-content .visual-form-builder ol,
|
52 |
.comment-content .visual-form-builder ol,
|
53 |
.mu_register .visual-form-builder ol {
|
54 |
+
margin: 0 14px !important;
|
55 |
+
padding: 0 !important;
|
56 |
+
background: none !important;
|
57 |
+
list-style: none !important;
|
58 |
+
list-style-type: none !important;
|
59 |
+
list-style-image: none !important;
|
60 |
+
font-size: 13px;
|
61 |
+
line-height: inherit;
|
62 |
+
}
|
63 |
+
|
64 |
+
.visual-form-builder ul li {
|
65 |
+
margin: 0 !important;
|
66 |
background: none !important;
|
67 |
list-style: none !important;
|
68 |
list-style-type: none !important;
|
69 |
list-style-image: none !important;
|
70 |
+
}
|
|
|
|
|
71 |
|
72 |
+
.visual-form-builder ul li:before {
|
73 |
+
content: none;
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
+
.visual-form-builder li,
|
77 |
+
.entry-content .visual-form-builder li,
|
78 |
+
.comment-content .visual-form-builder li,
|
79 |
+
.mu_register .visual-form-builder li {
|
80 |
+
clear: both;
|
81 |
+
margin: 0 !important;
|
82 |
+
padding: 6px 1% 9px !important;
|
83 |
+
width: 64%;
|
84 |
+
background: none !important;
|
85 |
+
list-style: none !important;
|
86 |
+
list-style-type: none !important;
|
87 |
+
list-style-image: none !important;
|
88 |
+
}
|
|
|
|
|
|
|
|
|
89 |
|
90 |
+
.visual-form-builder li:before,
|
91 |
+
.entry-content .visual-form-builder li:before,
|
92 |
+
.comment-content .visual-form-builder li:before,
|
93 |
+
.mu_register .visual-form-builder li:before {
|
94 |
+
content: none;
|
95 |
+
}
|
96 |
|
97 |
.vfb-span,
|
98 |
.visual-form-builder li div span.vfb-span,
|
100 |
span.vfb-full input,
|
101 |
span.vfb-full input[type="text"].vfb-medium,
|
102 |
span.vfb-full select{
|
103 |
+
display:block;
|
104 |
+
float:left;
|
105 |
+
margin: 0;
|
106 |
+
width:100%;
|
107 |
}
|
108 |
|
109 |
+
.visual-form-builder span.vfb-left{
|
110 |
+
float:left;
|
111 |
+
width:48%;
|
112 |
+
}
|
113 |
|
114 |
+
.visual-form-builder span.vfb-right{
|
115 |
+
float:right;
|
116 |
+
width:48%;
|
117 |
+
}
|
118 |
|
119 |
+
.visual-form-builder span.vfb-span ul li {
|
120 |
+
list-style: disc;
|
121 |
+
}
|
122 |
|
123 |
+
.visual-form-builder span.vfb-span ol li {
|
124 |
+
list-style: decimal;
|
125 |
+
}
|
126 |
|
127 |
.visual-form-builder span.vfb-right input,
|
128 |
.visual-form-builder span.vfb-right input[type="text"],
|
130 |
.visual-form-builder span.vfb-left input,
|
131 |
.visual-form-builder span.vfb-left input[type="text"],
|
132 |
.visual-form-builder span.vfb-left select{
|
133 |
+
width:100% !important;
|
134 |
}
|
135 |
|
136 |
/* !Time Field */
|
137 |
.visual-form-builder span.vfb-time{
|
138 |
+
float:left;
|
139 |
+
margin:0 0.3em 0 0;
|
140 |
}
|
141 |
|
142 |
+
.rtl .visual-form-builder span.vfb-time {
|
143 |
+
float: right;
|
144 |
+
margin: 0 0 0 0.3em;
|
145 |
+
}
|
146 |
|
147 |
.visual-form-builder li div label,
|
148 |
.visual-form-builder li span label {
|
149 |
+
margin: 0;
|
150 |
+
font-size: 90%;
|
151 |
}
|
152 |
|
153 |
/* !Fieldset */
|
154 |
.visual-form-builder fieldset{
|
155 |
+
clear:both;
|
156 |
+
margin:15px 0;
|
157 |
+
padding: 0;
|
158 |
+
border:1px solid #D3D3D3;
|
159 |
+
border-radius:3px;
|
160 |
+
background-color:#eeeeee;
|
161 |
}
|
162 |
|
163 |
/* !Legend */
|
164 |
.visual-form-builder .vfb-legend{
|
165 |
+
margin:5px 14px;
|
166 |
+
padding:0 6px;
|
167 |
+
border-bottom:1px solid #CCCCCC;
|
168 |
+
color:#990000;
|
169 |
+
font-size:inherit;
|
170 |
+
}
|
171 |
+
|
172 |
+
.visual-form-builder .vfb-legend h3 {
|
173 |
+
margin: 0 !important;
|
174 |
+
padding: 0 !important;
|
175 |
+
font-size:20px;
|
176 |
+
line-height: 2.0em;
|
177 |
+
}
|
178 |
|
179 |
/* !Description */
|
180 |
.visual-form-builder label,
|
181 |
label.vfb-desc{
|
182 |
+
display:block;
|
183 |
+
margin:0;
|
184 |
+
padding: 0 0 3px 0;
|
185 |
+
color:#000;
|
186 |
}
|
187 |
+
label.vfb-desc{
|
188 |
+
font-weight:bold;
|
189 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
+
.visual-form-builder.left-label .vfb-desc,
|
192 |
+
.visual-form-builder.right-label .vfb-desc{
|
193 |
+
float:left;
|
194 |
+
margin:0 15px 0 0;
|
195 |
+
width:20%;
|
196 |
+
}
|
197 |
|
198 |
+
.visual-form-builder.right-label .vfb-desc{
|
199 |
+
padding-top:2px;
|
200 |
+
text-align:right;
|
201 |
+
}
|
202 |
|
203 |
+
.visual-form-builder li div {
|
204 |
+
margin: 0;
|
205 |
+
padding: 0;
|
206 |
+
}
|
207 |
+
|
208 |
+
.visual-form-builder.left-label li div,
|
209 |
+
.visual-form-builder.right-label li div {
|
210 |
+
float: left;
|
211 |
+
width: 65%;
|
212 |
+
}
|
213 |
+
|
214 |
+
.visual-form-builder label.vfb-choice{
|
215 |
+
margin:-16px 0 0 23px;
|
216 |
+
padding:0 0 5px;
|
217 |
+
width:88%;
|
218 |
+
font-size:100%;
|
219 |
+
line-height:150%;
|
220 |
+
}
|
221 |
|
222 |
+
.rtl .visual-form-builder label.vfb-choice {
|
223 |
+
margin: -16px 23px 0 0;
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
|
226 |
+
.visual-form-builder label .vfb-required-asterisk {
|
227 |
+
margin: 0;
|
228 |
+
padding: 0;
|
229 |
+
color: #BC1212;
|
230 |
+
vertical-align: baseline;
|
231 |
+
font-weight: bold;
|
232 |
+
}
|
|
|
|
|
|
|
|
|
233 |
|
234 |
/* !Input, Textarea, and Select */
|
235 |
input.vfb-text,
|
238 |
input[type="email"].vfb-text,
|
239 |
input[type="url"].vfb-text,
|
240 |
textarea.vfb-textarea {
|
241 |
+
padding: 3px 0;
|
242 |
+
border: 1px solid #DDDDDD;
|
243 |
+
border-radius: 3px;
|
244 |
+
background: none repeat scroll 0 0 #FAFAFA;
|
245 |
+
|
246 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
247 |
+
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
248 |
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
249 |
+
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
250 |
+
-moz-transition: border linear .2s, box-shadow linear .2s;
|
251 |
+
-o-transition: border linear .2s, box-shadow linear .2s;
|
252 |
+
transition: border linear .2s, box-shadow linear .2s;
|
253 |
+
}
|
254 |
+
|
255 |
+
input.vfb-text:focus,
|
256 |
+
input[type="text"].vfb-text:focus,
|
257 |
+
input[type="tel"].vfb-text:focus,
|
258 |
+
input[type="email"].vfb-text:focus,
|
259 |
+
input[type="url"].vfb-text:focus,
|
260 |
+
textarea.vfb-textarea:focus {
|
261 |
+
outline: 0;
|
262 |
+
outline: thin dotted \9;
|
263 |
+
/* IE6-9 */
|
264 |
+
border-color: rgba(82, 168, 236, 0.8);
|
265 |
+
|
266 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
|
267 |
+
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
|
268 |
+
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
|
269 |
+
}
|
270 |
+
|
271 |
+
input.vfb-text.vfb-error:focus,
|
272 |
+
input[type="text"].vfb-text.vfb-error:focus,
|
273 |
+
input[type="tel"].vfb-text.vfb-error:focus,
|
274 |
+
input[type="email"].vfb-text.vfb-error:focus,
|
275 |
+
input[type="url"].vfb-text.vfb-error:focus,
|
276 |
+
textarea.vfb-textarea.vfb-error:focus {
|
277 |
+
border-color: rgba(238,83,83,0.8);
|
278 |
+
|
279 |
+
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(238,83,83,.6);
|
280 |
+
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(238,83,83,.6);
|
281 |
+
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(238,83,83,.6);
|
282 |
+
}
|
283 |
|
284 |
input.vfb-text,
|
285 |
input[type="text"].vfb-text,
|
288 |
input[type="url"].vfb-text,
|
289 |
textarea.vfb-textarea,
|
290 |
select.vfb-select {
|
291 |
+
margin: 0 0 5px 0;
|
292 |
+
height: auto;
|
293 |
+
color: #373737;
|
294 |
+
font-size:100%;
|
295 |
+
font-family:inherit;
|
296 |
+
line-height: normal;
|
297 |
}
|
298 |
|
299 |
select.vfb-select{
|
300 |
+
padding: 1px 0 0;
|
301 |
}
|
302 |
|
303 |
input.vfb-small,
|
306 |
input[type="email"].vfb-small,
|
307 |
input[type="url"].vfb-small,
|
308 |
select.vfb-small{
|
309 |
+
width:25%;
|
310 |
}
|
311 |
|
312 |
input.vfb-medium,
|
315 |
input[type="email"].vfb-medium,
|
316 |
input[type="url"].vfb-medium,
|
317 |
select.vfb-medium{
|
318 |
+
width:50%;
|
319 |
}
|
320 |
|
321 |
input.vfb-large,
|
325 |
input[type="url"].vfb-large,
|
326 |
select.vfb-large,
|
327 |
textarea.vfb-textarea{
|
328 |
+
width:100%;
|
329 |
}
|
330 |
|
331 |
input[type="file"].vfb-small,
|
332 |
input[type="file"].vfb-medium,
|
333 |
input[type="file"].vfb-large {
|
334 |
+
height: auto;
|
335 |
+
line-height: normal;
|
336 |
}
|
337 |
|
338 |
|
339 |
textarea.vfb-medium{
|
340 |
+
height:5.5em;
|
341 |
}
|
342 |
|
343 |
textarea.vfb-medium{
|
344 |
+
height:10em;
|
345 |
}
|
346 |
|
347 |
textarea.vfb-large{
|
348 |
+
height:20em;
|
349 |
}
|
350 |
|
351 |
/* !Submit Button */
|
352 |
.vfb-submit,
|
353 |
input[type="submit"].vfb-submit {
|
354 |
+
font-size:1.1em;
|
355 |
}
|
356 |
|
357 |
/* !Checkbox and Radio */
|
359 |
input[type="checkbox"].vfb-checkbox,
|
360 |
input.vfb-radio,
|
361 |
input[type="radio"].vfb-radio {
|
362 |
+
display:block;
|
363 |
+
margin:4px 0 0;
|
364 |
+
width:13px;
|
365 |
+
height:13px;
|
366 |
+
font-size:1.1em;
|
367 |
}
|
368 |
|
369 |
input.vfb-other,
|
370 |
input[type="text"].vfb-other {
|
371 |
+
margin: 0 0 8px 25px;
|
372 |
}
|
373 |
|
374 |
/* !Field Layout */
|
375 |
.visual-form-builder li.vfb-two-column div span,
|
376 |
.visual-form-builder li.vfb-three-column div span,
|
377 |
.visual-form-builder li.vfb-auto-column div span{
|
378 |
+
margin:0 5px 0 0;
|
379 |
+
width:48%;
|
380 |
}
|
381 |
|
382 |
.visual-form-builder li.vfb-three-column div span{
|
383 |
+
width:30%;
|
384 |
}
|
385 |
|
386 |
.visual-form-builder li.vfb-auto-column div span{
|
387 |
+
width:auto;
|
388 |
}
|
389 |
|
390 |
.visual-form-builder li.vfb-left-half,
|
391 |
.visual-form-builder li.vfb-left-third,
|
392 |
.visual-form-builder li.vfb-left-two-thirds{
|
393 |
+
float:left;
|
394 |
+
clear:left;
|
395 |
}
|
396 |
|
397 |
.visual-form-builder li.vfb-right-half,
|
398 |
.visual-form-builder li.vfb-right-third,
|
399 |
.visual-form-builder li.vfb-right-two-thirds{
|
400 |
+
float:right;
|
401 |
+
clear:none;
|
402 |
}
|
403 |
|
404 |
.visual-form-builder li.vfb-middle-third{
|
405 |
+
float:left;
|
406 |
+
clear:none;
|
407 |
+
margin-left:2%;
|
408 |
}
|
409 |
|
410 |
.visual-form-builder li.vfb-left-half,
|
411 |
.visual-form-builder li.vfb-right-half{
|
412 |
+
width:47% !important;
|
413 |
}
|
414 |
|
415 |
.visual-form-builder li.vfb-left-third,
|
416 |
.visual-form-builder li.vfb-middle-third,
|
417 |
.visual-form-builder li.vfb-right-third{
|
418 |
+
width:30% !important;
|
419 |
}
|
420 |
|
421 |
.visual-form-builder li.vfb-left-two-thirds,
|
422 |
.visual-form-builder li.vfb-right-two-thirds{
|
423 |
+
width:64% !important;
|
424 |
}
|
425 |
|
426 |
li.vfb-left-half .vfb-small,
|
444 |
.visual-form-builder li.vfb-right-two-thirds .vfb-small,
|
445 |
.visual-form-builder li.vfb-right-two-thirds .vfb-medium,
|
446 |
.visual-form-builder li.vfb-right-two-thirds .vfb-large{
|
447 |
+
width:100%;
|
448 |
}
|
449 |
|
450 |
/* !Error */
|
451 |
label.vfb-error{
|
452 |
+
color:red;
|
453 |
+
font-weight:bold;
|
454 |
+
font-size:90%;
|
455 |
}
|
456 |
|
457 |
input.vfb-error,
|
463 |
select.vfb-error,
|
464 |
textarea.vfb-error,
|
465 |
textarea.vfb-textarea.vfb-error,{
|
466 |
+
border:1px solid red;
|
467 |
}
|
468 |
|
469 |
/* !Success Mesage - Default */
|
470 |
p#form_success,
|
471 |
.vfb-form-success {
|
472 |
+
color: green;
|
473 |
+
font-weight: bold;
|
474 |
}
|
475 |
|
476 |
#ui-datepicker-div {
|
477 |
+
display: none;
|
478 |
+
font-size:12px;
|
479 |
}
|
480 |
|
481 |
/* !Instructions */
|
482 |
.vfb-item-instructions{
|
483 |
+
border-radius:3px;
|
484 |
+
background-color:#e3e3e3;
|
485 |
}
|
486 |
|
487 |
+
.vfb-item-instructions ul,
|
488 |
+
.vfb-item-instructions ul li {
|
489 |
+
padding-bottom: 0;
|
490 |
+
list-style: disc;
|
491 |
+
}
|
492 |
|
493 |
+
.vfb-item-instructions ol,
|
494 |
+
.vfb-item-instructions ol li {
|
495 |
+
padding-bottom: 0;
|
496 |
+
list-style: decimal;
|
497 |
+
}
|
498 |
|
499 |
/* !Sections */
|
500 |
.vfb-section-div {
|
501 |
+
float:left;
|
502 |
+
margin:10px 0;
|
503 |
+
padding:10px;
|
504 |
+
width:97%;
|
505 |
+
border-radius:3px;
|
506 |
+
background-color:#D4D4D4;
|
507 |
+
}
|
508 |
+
|
509 |
+
.visual-form-builder .vfb-section-div h4 {
|
510 |
+
margin: 0 !important;
|
511 |
+
padding: 0 !important;
|
512 |
+
border-bottom:1px solid #BABABA;
|
513 |
+
font-size:16px;
|
514 |
+
line-height: inherit;
|
515 |
+
}
|
516 |
|
517 |
/* !Clearing */
|
518 |
.vfb-clear{
|
519 |
+
display:block;
|
520 |
+
visibility:hidden;
|
521 |
+
clear:both;
|
522 |
+
overflow:hidden;
|
523 |
+
width:0;
|
524 |
+
height:0;
|
525 |
}
|
526 |
|
527 |
/* !Conditional Field */
|
528 |
.vfb-conditional-hide{
|
529 |
+
display: none;
|
530 |
}
|
public/assets/js/i18n/datepicker/datepicker-cs_CS.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['cs']);
|
33 |
|
34 |
return datepicker.regional['cs'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['cs'] );
|
33 |
|
34 |
return datepicker.regional['cs'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-de_DE.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['de']);
|
33 |
|
34 |
return datepicker.regional['de'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['de'] );
|
33 |
|
34 |
return datepicker.regional['de'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-el_GR.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['el']);
|
33 |
|
34 |
return datepicker.regional['el'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['el'] );
|
33 |
|
34 |
return datepicker.regional['el'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-en_AU.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['en-AU']);
|
33 |
|
34 |
return datepicker.regional['en-AU'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['en-AU'] );
|
33 |
|
34 |
return datepicker.regional['en-AU'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-en_GB.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['en-GB']);
|
33 |
|
34 |
return datepicker.regional['en-GB'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['en-GB'] );
|
33 |
|
34 |
return datepicker.regional['en-GB'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-en_US.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if ( typeof define === "function" && define.amd ) {
|
4 |
|
5 |
// AMD. Register as an anonymous module.
|
6 |
-
define([ "../datepicker" ], factory );
|
7 |
} else {
|
8 |
|
9 |
// Browser globals
|
@@ -28,7 +28,7 @@
|
|
28 |
isRTL: false,
|
29 |
showMonthAfterYear: false,
|
30 |
yearSuffix: ''};
|
31 |
-
datepicker.setDefaults(datepicker.regional['en-US']);
|
32 |
|
33 |
return datepicker.regional['en-US'];
|
34 |
|
3 |
if ( typeof define === "function" && define.amd ) {
|
4 |
|
5 |
// AMD. Register as an anonymous module.
|
6 |
+
define( [ "../datepicker" ], factory );
|
7 |
} else {
|
8 |
|
9 |
// Browser globals
|
28 |
isRTL: false,
|
29 |
showMonthAfterYear: false,
|
30 |
yearSuffix: ''};
|
31 |
+
datepicker.setDefaults( datepicker.regional['en-US'] );
|
32 |
|
33 |
return datepicker.regional['en-US'];
|
34 |
|
public/assets/js/i18n/datepicker/datepicker-es_ES.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['es']);
|
33 |
|
34 |
return datepicker.regional['es'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['es'] );
|
33 |
|
34 |
return datepicker.regional['es'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-fr_FR.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
if ( typeof define === "function" && define.amd ) {
|
7 |
|
8 |
// AMD. Register as an anonymous module.
|
9 |
-
define([ "../datepicker" ], factory );
|
10 |
} else {
|
11 |
|
12 |
// Browser globals
|
@@ -31,7 +31,7 @@
|
|
31 |
isRTL: false,
|
32 |
showMonthAfterYear: false,
|
33 |
yearSuffix: ''};
|
34 |
-
datepicker.setDefaults(datepicker.regional['fr']);
|
35 |
|
36 |
return datepicker.regional['fr'];
|
37 |
|
6 |
if ( typeof define === "function" && define.amd ) {
|
7 |
|
8 |
// AMD. Register as an anonymous module.
|
9 |
+
define( [ "../datepicker" ], factory );
|
10 |
} else {
|
11 |
|
12 |
// Browser globals
|
31 |
isRTL: false,
|
32 |
showMonthAfterYear: false,
|
33 |
yearSuffix: ''};
|
34 |
+
datepicker.setDefaults( datepicker.regional['fr'] );
|
35 |
|
36 |
return datepicker.regional['fr'];
|
37 |
|
public/assets/js/i18n/datepicker/datepicker-he_IL.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: true,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['he']);
|
33 |
|
34 |
return datepicker.regional['he'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: true,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['he'] );
|
33 |
|
34 |
return datepicker.regional['he'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-hu_HU.js
CHANGED
@@ -3,8 +3,11 @@
|
|
3 |
if ( typeof define === "function" && define.amd ) {
|
4 |
|
5 |
// AMD. Register as an anonymous module.
|
6 |
-
define(
|
7 |
-
|
|
|
|
|
|
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +32,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['hu']);
|
33 |
|
34 |
return datepicker.regional['hu'];
|
35 |
|
3 |
if ( typeof define === "function" && define.amd ) {
|
4 |
|
5 |
// AMD. Register as an anonymous module.
|
6 |
+
define(
|
7 |
+
[ "query.ui.datepicker"
|
8 |
+
],
|
9 |
+
factory
|
10 |
+
);
|
11 |
} else {
|
12 |
|
13 |
// Browser globals
|
32 |
isRTL: false,
|
33 |
showMonthAfterYear: true,
|
34 |
yearSuffix: ''};
|
35 |
+
datepicker.setDefaults( datepicker.regional['hu'] );
|
36 |
|
37 |
return datepicker.regional['hu'];
|
38 |
|
public/assets/js/i18n/datepicker/datepicker-id_ID.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['id']);
|
33 |
|
34 |
return datepicker.regional['id'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['id'] );
|
33 |
|
34 |
return datepicker.regional['id'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-it_IT.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['it']);
|
33 |
|
34 |
return datepicker.regional['it'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['it'] );
|
33 |
|
34 |
return datepicker.regional['it'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-ja_JP.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '年'};
|
32 |
-
datepicker.setDefaults(datepicker.regional['ja']);
|
33 |
|
34 |
return datepicker.regional['ja'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '年'};
|
32 |
+
datepicker.setDefaults( datepicker.regional['ja'] );
|
33 |
|
34 |
return datepicker.regional['ja'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-ko_KR.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '년'};
|
32 |
-
datepicker.setDefaults(datepicker.regional['ko']);
|
33 |
|
34 |
return datepicker.regional['ko'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '년'};
|
32 |
+
datepicker.setDefaults( datepicker.regional['ko'] );
|
33 |
|
34 |
return datepicker.regional['ko'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-nl_NL.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional.nl);
|
33 |
|
34 |
return datepicker.regional.nl;
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional.nl );
|
33 |
|
34 |
return datepicker.regional.nl;
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-pl_PL.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['pl']);
|
33 |
|
34 |
return datepicker.regional['pl'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['pl'] );
|
33 |
|
34 |
return datepicker.regional['pl'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-pt_BR.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['pt-BR']);
|
33 |
|
34 |
return datepicker.regional['pt-BR'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['pt-BR'] );
|
33 |
|
34 |
return datepicker.regional['pt-BR'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-pt_PT.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if ( typeof define === "function" && define.amd ) {
|
4 |
|
5 |
// AMD. Register as an anonymous module.
|
6 |
-
define([ "../datepicker" ], factory );
|
7 |
} else {
|
8 |
|
9 |
// Browser globals
|
@@ -28,7 +28,7 @@
|
|
28 |
isRTL: false,
|
29 |
showMonthAfterYear: false,
|
30 |
yearSuffix: ''};
|
31 |
-
datepicker.setDefaults(datepicker.regional['pt']);
|
32 |
|
33 |
return datepicker.regional['pt'];
|
34 |
|
3 |
if ( typeof define === "function" && define.amd ) {
|
4 |
|
5 |
// AMD. Register as an anonymous module.
|
6 |
+
define( [ "../datepicker" ], factory );
|
7 |
} else {
|
8 |
|
9 |
// Browser globals
|
28 |
isRTL: false,
|
29 |
showMonthAfterYear: false,
|
30 |
yearSuffix: ''};
|
31 |
+
datepicker.setDefaults( datepicker.regional['pt'] );
|
32 |
|
33 |
return datepicker.regional['pt'];
|
34 |
|
public/assets/js/i18n/datepicker/datepicker-ro_RO.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
if ( typeof define === "function" && define.amd ) {
|
8 |
|
9 |
// AMD. Register as an anonymous module.
|
10 |
-
define([ "../datepicker" ], factory );
|
11 |
} else {
|
12 |
|
13 |
// Browser globals
|
@@ -32,7 +32,7 @@
|
|
32 |
isRTL: false,
|
33 |
showMonthAfterYear: false,
|
34 |
yearSuffix: ''};
|
35 |
-
datepicker.setDefaults(datepicker.regional['ro']);
|
36 |
|
37 |
return datepicker.regional['ro'];
|
38 |
|
7 |
if ( typeof define === "function" && define.amd ) {
|
8 |
|
9 |
// AMD. Register as an anonymous module.
|
10 |
+
define( [ "../datepicker" ], factory );
|
11 |
} else {
|
12 |
|
13 |
// Browser globals
|
32 |
isRTL: false,
|
33 |
showMonthAfterYear: false,
|
34 |
yearSuffix: ''};
|
35 |
+
datepicker.setDefaults( datepicker.regional['ro'] );
|
36 |
|
37 |
return datepicker.regional['ro'];
|
38 |
|
public/assets/js/i18n/datepicker/datepicker-ru_RU.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['ru']);
|
33 |
|
34 |
return datepicker.regional['ru'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['ru'] );
|
33 |
|
34 |
return datepicker.regional['ru'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-sv_SE.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['sv']);
|
33 |
|
34 |
return datepicker.regional['sv'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['sv'] );
|
33 |
|
34 |
return datepicker.regional['sv'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-tr_TR.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
-
datepicker.setDefaults(datepicker.regional['tr']);
|
33 |
|
34 |
return datepicker.regional['tr'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: false,
|
31 |
yearSuffix: ''};
|
32 |
+
datepicker.setDefaults( datepicker.regional['tr'] );
|
33 |
|
34 |
return datepicker.regional['tr'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-zh_CN.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '年'};
|
32 |
-
datepicker.setDefaults(datepicker.regional['zh-CN']);
|
33 |
|
34 |
return datepicker.regional['zh-CN'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '年'};
|
32 |
+
datepicker.setDefaults( datepicker.regional['zh-CN'] );
|
33 |
|
34 |
return datepicker.regional['zh-CN'];
|
35 |
|
public/assets/js/i18n/datepicker/datepicker-zh_TW.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
-
define([ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
@@ -29,7 +29,7 @@
|
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '年'};
|
32 |
-
datepicker.setDefaults(datepicker.regional['zh-TW']);
|
33 |
|
34 |
return datepicker.regional['zh-TW'];
|
35 |
|
4 |
if ( typeof define === "function" && define.amd ) {
|
5 |
|
6 |
// AMD. Register as an anonymous module.
|
7 |
+
define( [ "../datepicker" ], factory );
|
8 |
} else {
|
9 |
|
10 |
// Browser globals
|
29 |
isRTL: false,
|
30 |
showMonthAfterYear: true,
|
31 |
yearSuffix: '年'};
|
32 |
+
datepicker.setDefaults( datepicker.regional['zh-TW'] );
|
33 |
|
34 |
return datepicker.regional['zh-TW'];
|
35 |
|
public/assets/js/i18n/validate/messages-cs_CS.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: CS (Czech; čeština, český jazyk)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: CS (Czech; čeština, český jazyk)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Tento údaj je povinný.",
|
10 |
+
remote: "Prosím, opravte tento údaj.",
|
11 |
+
email: "Prosím, zadejte platný e-mail.",
|
12 |
+
url: "Prosím, zadejte platné URL.",
|
13 |
+
date: "Prosím, zadejte platné datum.",
|
14 |
+
dateISO: "Prosím, zadejte platné datum (ISO).",
|
15 |
+
number: "Prosím, zadejte číslo.",
|
16 |
+
digits: "Prosím, zadávejte pouze číslice.",
|
17 |
+
creditcard: "Prosím, zadejte číslo kreditní karty.",
|
18 |
+
equalTo: "Prosím, zadejte znovu stejnou hodnotu.",
|
19 |
+
accept: "Prosím, zadejte soubor se správnou příponou.",
|
20 |
+
maxlength: $.validator.format( "Prosím, zadejte nejvíce {0} znaků." ),
|
21 |
+
minlength: $.validator.format( "Prosím, zadejte nejméně {0} znaků." ),
|
22 |
+
rangelength: $.validator.format( "Prosím, zadejte od {0} do {1} znaků." ),
|
23 |
+
range: $.validator.format( "Prosím, zadejte hodnotu od {0} do {1}." ),
|
24 |
+
max: $.validator.format( "Prosím, zadejte hodnotu menší nebo rovnu {0}." ),
|
25 |
+
min: $.validator.format( "Prosím, zadejte hodnotu větší nebo rovnu {0}." ),
|
26 |
+
maxWords: $.validator.format( "Prosím, zadejte {0} slova nebo méně." ),
|
27 |
+
minWords: $.validator.format( "Prosím, zadejte alespoň {0} slov." ),
|
28 |
+
rangeWords: $.validator.format( "Prosím zadejte mezi {0} a {1} slovy." ),
|
29 |
+
alphanumeric: "Písmena, číslice a podtržítka jen prosím",
|
30 |
+
lettersonly: "Dopisy jen prosím",
|
31 |
+
nowhitespace: "Žádné mezery, prosím",
|
32 |
+
phone: 'Prosím, zadejte platné telefonní číslo. Většina USA / Kanada a mezinárodní formáty přijaty.',
|
33 |
+
ipv4: 'Prosím, zadejte platnou IP v4 adresu.',
|
34 |
+
ipv6: 'Prosím, zadejte platnou IP v6 adresu.',
|
35 |
+
ziprange: 'Váš ZIP kód musí v rozsahu 902xx-xxxx na 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'Zadaná US PSČ je neplatné',
|
37 |
+
integer: 'Pozitivní nebo negativní, non-desetinné číslo, prosím',
|
38 |
+
vfbUsername: 'Toto uživatelské jméno je již registrováno. Prosím, zvolte jinou'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-de_DE.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: DE (German, Deutsch)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: DE (German, Deutsch)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Dieses Feld ist ein Pflichtfeld.",
|
10 |
+
remote: "Bitte korrigieren Sie dieses Feld.",
|
11 |
+
email: "Geben Sie bitte eine gültige E-Mail Adresse ein.",
|
12 |
+
url: "Geben Sie bitte eine gültige URL ein.",
|
13 |
+
date: "Bitte geben Sie ein gültiges Datum ein.",
|
14 |
+
dateISO: "Bitte geben Sie ein gültiges Datum ein (ISO).",
|
15 |
+
number: "Geben Sie bitte eine Nummer ein.",
|
16 |
+
digits: "Geben Sie bitte nur Ziffern ein.",
|
17 |
+
creditcard: "Geben Sie bitte eine gültige Kreditkarten-Nummer ein.",
|
18 |
+
equalTo: "Bitte denselben Wert wiederholen.",
|
19 |
+
accept: "Bitte geben Sie einen Wert mit einer gültigen Erweiterung.",
|
20 |
+
maxlength: $.validator.format( "Geben Sie bitte maximal {0} Zeichen ein." ),
|
21 |
+
minlength: $.validator.format( "Geben Sie bitte mindestens {0} Zeichen ein." ),
|
22 |
+
rangelength: $.validator.format( "Geben Sie bitte mindestens {0} und maximal {1} Zeichen ein." ),
|
23 |
+
range: $.validator.format( "Geben Sie bitte einen Wert zwischen {0} und {1} ein." ),
|
24 |
+
max: $.validator.format( "Geben Sie bitte einen Wert kleiner oder gleich {0} ein." ),
|
25 |
+
min: $.validator.format( "Geben Sie bitte einen Wert größer oder gleich {0} ein." ),
|
26 |
+
maxWords: $.validator.format( "Geben Sie bitte {0} Wörter oder weniger." ),
|
27 |
+
minWords: $.validator.format( "Geben Sie bitte mindestens {0} Worte." ),
|
28 |
+
rangeWords: $.validator.format( "Geben Sie bitte zwischen {0} und {1} Wörter eingeben." ),
|
29 |
+
alphanumeric: "Buchstaben, Zahlen und Unterstrichen bitte",
|
30 |
+
lettersonly: "Nur Buchstaben bitte",
|
31 |
+
nowhitespace: "Kein Leerzeichen bitte",
|
32 |
+
phone: 'Bitte geben Sie eine gültige Telefonnummer. Die meisten US / Canada und internationale Formate akzeptiert.',
|
33 |
+
ipv4: 'Bitte geben Sie eine gültige IP v4 Adresse.',
|
34 |
+
ipv6: 'Bitte geben Sie eine gültige IP-v6-Adresse.',
|
35 |
+
ziprange: 'Ihre ZIP-Code muss im Bereich 902xx-xxxx bis 905-xx-xxxx sein',
|
36 |
+
zipcodeUS: 'Die angegebene US-Postleitzahl ist ungültig',
|
37 |
+
integer: 'Eine positive oder negative Nicht-Dezimalzahl bitte',
|
38 |
+
vfbUsername: 'Dieser Benutzername ist bereits registriert. Bitte wählen Sie einen anderen'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-el_GR.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: EL (Greek; ελληνικά)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: EL (Greek; ελληνικά)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Αυτό το πεδίο είναι υποχρεωτικό.",
|
10 |
+
remote: "Παρακαλώ διορθώστε αυτό το πεδίο.",
|
11 |
+
email: "Παρακαλώ εισάγετε μια έγκυρη διεύθυνση email.",
|
12 |
+
url: "Παρακαλώ εισάγετε ένα έγκυρο URL.",
|
13 |
+
date: "Παρακαλώ εισάγετε μια έγκυρη ημερομηνία.",
|
14 |
+
dateISO: "Παρακαλώ εισάγετε μια έγκυρη ημερομηνία (ISO).",
|
15 |
+
number: "Παρακαλώ εισάγετε έναν έγκυρο αριθμό.",
|
16 |
+
digits: "Παρακαλώ εισάγετε μόνο αριθμητικά ψηφία.",
|
17 |
+
creditcard: "Παρακαλώ εισάγετε έναν έγκυρο αριθμό πιστωτικής κάρτας.",
|
18 |
+
equalTo: "Παρακαλώ εισάγετε την ίδια τιμή ξανά.",
|
19 |
+
accept: "Παρακαλώ εισάγετε μια τιμή με έγκυρη επέκταση αρχείου.",
|
20 |
+
maxlength: $.validator.format( "Παρακαλώ εισάγετε μέχρι και {0} χαρακτήρες." ),
|
21 |
+
minlength: $.validator.format( "Παρακαλώ εισάγετε τουλάχιστον {0} χαρακτήρες." ),
|
22 |
+
rangelength: $.validator.format( "Παρακαλώ εισάγετε μια τιμή με μήκος μεταξύ {0} και {1} χαρακτήρων." ),
|
23 |
+
range: $.validator.format( "Παρακαλώ εισάγετε μια τιμή μεταξύ {0} και {1}." ),
|
24 |
+
max: $.validator.format( "Παρακαλώ εισάγετε μια τιμή μικρότερη ή ίση του {0}." ),
|
25 |
+
min: $.validator.format( "Παρακαλώ εισάγετε μια τιμή μεγαλύτερη ή ίση του {0}." ),
|
26 |
+
maxWords: $.validator.format( "Παρακαλούμε, εισάγετε {0} λέξεις ή λιγότερο." ),
|
27 |
+
minWords: $.validator.format( "Παρακαλούμε, εισάγετε τουλάχιστον {0} λόγια." ),
|
28 |
+
rangeWords: $.validator.format( "Παρακαλούμε, εισάγετε μεταξύ {0} και {1} λόγια." ),
|
29 |
+
alphanumeric: "Γράμματα, αριθμούς και χαρακτήρες υπογράμμισης μόνο παρακαλώ",
|
30 |
+
lettersonly: "Επιστολές μόνο παρακαλώ",
|
31 |
+
nowhitespace: "Δεν λευκό χώρο, παρακαλείστε να",
|
32 |
+
phone: 'Παρακαλώ εισάγετε έναν έγκυρο αριθμό τηλεφώνου. Οι περισσότερες μορφές των ΗΠΑ / Καναδά και διεθνή αποδεκτά.',
|
33 |
+
ipv4: 'Παρακαλώ εισάγετε μια έγκυρη διεύθυνση IP v4.',
|
34 |
+
ipv6: 'Παρακαλώ εισάγετε μια έγκυρη διεύθυνση IP v6.',
|
35 |
+
ziprange: 'Ο ταχυδρομικός σας κωδικός πρέπει να είναι στο εύρος 902xx-xxxx 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'Η συγκεκριμένη ΗΠΑ ταχυδρομικός κώδικας δεν είναι έγκυρος',
|
37 |
+
integer: 'Μια θετική ή αρνητική μη δεκαδικό αριθμό παρακαλώ',
|
38 |
+
vfbUsername: 'Αυτό το όνομα χρήστη είναι ήδη καταχωρημένο. Παρακαλώ επιλέξτε ένα άλλο'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-en_AU.js
CHANGED
@@ -4,35 +4,38 @@
|
|
4 |
* Region: AU (Austrailian)
|
5 |
*/
|
6 |
(function($) {
|
7 |
-
$.extend(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
4 |
* Region: AU (Austrailian)
|
5 |
*/
|
6 |
(function($) {
|
7 |
+
$.extend(
|
8 |
+
$.validator.messages,
|
9 |
+
{
|
10 |
+
required: 'This field is required.',
|
11 |
+
remote: 'Please fix this field.',
|
12 |
+
email: 'Please enter a valid email address.',
|
13 |
+
url: 'Please enter a valid URL.',
|
14 |
+
date: 'Please enter a valid date.',
|
15 |
+
dateISO: 'Please enter a valid date (ISO).',
|
16 |
+
number: 'Please enter a valid number.',
|
17 |
+
digits: 'Please enter only digits.',
|
18 |
+
creditcard: 'Please enter a valid credit card number.',
|
19 |
+
equalTo: 'Please enter the same value again.',
|
20 |
+
maxlength: $.validator.format( 'Please enter no more than {0} characters.' ),
|
21 |
+
minlength: $.validator.format( 'Please enter at least {0} characters.' ),
|
22 |
+
rangelength: $.validator.format( 'Please enter a value between {0} and {1} characters long.' ),
|
23 |
+
range: $.validator.format( 'Please enter a value between {0} and {1}.' ),
|
24 |
+
max: $.validator.format( 'Please enter a value less than or equal to {0}.' ),
|
25 |
+
min: $.validator.format( 'Please enter a value greater than or equal to {0}.' ),
|
26 |
+
maxWords: $.validator.format( 'Please enter {0} words or less.' ),
|
27 |
+
minWords: $.validator.format( 'Please enter at least {0} words.' ),
|
28 |
+
rangeWords: $.validator.format( 'Please enter between {0} and {1} words.' ),
|
29 |
+
alphanumeric: 'Letters, numbers, and underscores only please',
|
30 |
+
lettersonly: 'Letters only please',
|
31 |
+
nowhitespace: 'No white space please',
|
32 |
+
phone: 'Please enter a valid phone number. Most US/Canada and International formats accepted.',
|
33 |
+
ipv4: 'Please enter a valid IP v4 address.',
|
34 |
+
ipv6: 'Please enter a valid IP v6 address.',
|
35 |
+
ziprange: 'Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'The specified US ZIP Code is invalid',
|
37 |
+
integer: 'A positive or negative non-decimal number please',
|
38 |
+
vfbUsername: 'This username is already registered. Please choose another one.'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-en_GB.js
CHANGED
@@ -4,35 +4,38 @@
|
|
4 |
* Region: GB (Great Britain)
|
5 |
*/
|
6 |
(function($) {
|
7 |
-
$.extend(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
4 |
* Region: GB (Great Britain)
|
5 |
*/
|
6 |
(function($) {
|
7 |
+
$.extend(
|
8 |
+
$.validator.messages,
|
9 |
+
{
|
10 |
+
required: 'This field is required.',
|
11 |
+
remote: 'Please fix this field.',
|
12 |
+
email: 'Please enter a valid email address.',
|
13 |
+
url: 'Please enter a valid URL.',
|
14 |
+
date: 'Please enter a valid date.',
|
15 |
+
dateISO: 'Please enter a valid date (ISO).',
|
16 |
+
number: 'Please enter a valid number.',
|
17 |
+
digits: 'Please enter only digits.',
|
18 |
+
creditcard: 'Please enter a valid credit card number.',
|
19 |
+
equalTo: 'Please enter the same value again.',
|
20 |
+
maxlength: $.validator.format( 'Please enter no more than {0} characters.' ),
|
21 |
+
minlength: $.validator.format( 'Please enter at least {0} characters.' ),
|
22 |
+
rangelength: $.validator.format( 'Please enter a value between {0} and {1} characters long.' ),
|
23 |
+
range: $.validator.format( 'Please enter a value between {0} and {1}.' ),
|
24 |
+
max: $.validator.format( 'Please enter a value less than or equal to {0}.' ),
|
25 |
+
min: $.validator.format( 'Please enter a value greater than or equal to {0}.' ),
|
26 |
+
maxWords: $.validator.format( 'Please enter {0} words or less.' ),
|
27 |
+
minWords: $.validator.format( 'Please enter at least {0} words.' ),
|
28 |
+
rangeWords: $.validator.format( 'Please enter between {0} and {1} words.' ),
|
29 |
+
alphanumeric: 'Letters, numbers, and underscores only please',
|
30 |
+
lettersonly: 'Letters only please',
|
31 |
+
nowhitespace: 'No white space please',
|
32 |
+
phone: 'Please enter a valid phone number. Most US/Canada and International formats accepted.',
|
33 |
+
ipv4: 'Please enter a valid IP v4 address.',
|
34 |
+
ipv6: 'Please enter a valid IP v6 address.',
|
35 |
+
ziprange: 'Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'The specified US ZIP Code is invalid',
|
37 |
+
integer: 'A positive or negative non-decimal number please',
|
38 |
+
vfbUsername: 'This username is already registered. Please choose another one.'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-en_US.js
CHANGED
@@ -4,35 +4,38 @@
|
|
4 |
* Region: US (United States)
|
5 |
*/
|
6 |
(function($) {
|
7 |
-
$.extend(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
4 |
* Region: US (United States)
|
5 |
*/
|
6 |
(function($) {
|
7 |
+
$.extend(
|
8 |
+
$.validator.messages,
|
9 |
+
{
|
10 |
+
required: 'This field is required.',
|
11 |
+
remote: 'Please fix this field.',
|
12 |
+
email: 'Please enter a valid email address.',
|
13 |
+
url: 'Please enter a valid URL.',
|
14 |
+
date: 'Please enter a valid date.',
|
15 |
+
dateISO: 'Please enter a valid date (ISO).',
|
16 |
+
number: 'Please enter a valid number.',
|
17 |
+
digits: 'Please enter only digits.',
|
18 |
+
creditcard: 'Please enter a valid credit card number.',
|
19 |
+
equalTo: 'Please enter the same value again.',
|
20 |
+
maxlength: $.validator.format( 'Please enter no more than {0} characters.' ),
|
21 |
+
minlength: $.validator.format( 'Please enter at least {0} characters.' ),
|
22 |
+
rangelength: $.validator.format( 'Please enter a value between {0} and {1} characters long.' ),
|
23 |
+
range: $.validator.format( 'Please enter a value between {0} and {1}.' ),
|
24 |
+
max: $.validator.format( 'Please enter a value less than or equal to {0}.' ),
|
25 |
+
min: $.validator.format( 'Please enter a value greater than or equal to {0}.' ),
|
26 |
+
maxWords: $.validator.format( 'Please enter {0} words or less.' ),
|
27 |
+
minWords: $.validator.format( 'Please enter at least {0} words.' ),
|
28 |
+
rangeWords: $.validator.format( 'Please enter between {0} and {1} words.' ),
|
29 |
+
alphanumeric: 'Letters, numbers, and underscores only please',
|
30 |
+
lettersonly: 'Letters only please',
|
31 |
+
nowhitespace: 'No white space please',
|
32 |
+
phone: 'Please enter a valid phone number. Most US/Canada and International formats accepted.',
|
33 |
+
ipv4: 'Please enter a valid IP v4 address.',
|
34 |
+
ipv6: 'Please enter a valid IP v6 address.',
|
35 |
+
ziprange: 'Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'The specified US ZIP Code is invalid',
|
37 |
+
integer: 'A positive or negative non-decimal number please',
|
38 |
+
vfbUsername: 'This username is already registered. Please choose another one.'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-es_ES.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: ES (Spanish; Español)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: ES (Spanish; Español)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Este campo es obligatorio.",
|
10 |
+
remote: "Por favor, rellena este campo.",
|
11 |
+
email: "Por favor, escribe una dirección de correo válida.",
|
12 |
+
url: "Por favor, escribe una URL válida.",
|
13 |
+
date: "Por favor, escribe una fecha válida.",
|
14 |
+
dateISO: "Por favor, escribe una fecha (ISO) válida.",
|
15 |
+
number: "Por favor, escribe un número entero válido.",
|
16 |
+
digits: "Por favor, escribe sólo dígitos.",
|
17 |
+
creditcard: "Por favor, escribe un número de tarjeta válido.",
|
18 |
+
equalTo: "Por favor, escribe el mismo valor de nuevo.",
|
19 |
+
accept: "Por favor, escribe un valor con una extensión aceptada.",
|
20 |
+
maxlength: $.validator.format( "Por favor, no escribas más de {0} caracteres." ),
|
21 |
+
minlength: $.validator.format( "Por favor, no escribas menos de {0} caracteres." ),
|
22 |
+
rangelength: $.validator.format( "Por favor, escribe un valor entre {0} y {1} caracteres." ),
|
23 |
+
range: $.validator.format( "Por favor, escribe un valor entre {0} y {1}." ),
|
24 |
+
max: $.validator.format( "Por favor, escribe un valor menor o igual a {0}." ),
|
25 |
+
min: $.validator.format( "Por favor, escribe un valor mayor o igual a {0}." ),
|
26 |
+
maxWords: $.validator.format( "Por favor, introduzca {0} palabras o menos." ),
|
27 |
+
minWords: $.validator.format( "Por favor introduzca al menos {0} palabras." ),
|
28 |
+
rangeWords: $.validator.format( "Por favor introduce entre {0} y {1} palabras." ),
|
29 |
+
alphanumeric: "Las letras, números y subrayados por favor",
|
30 |
+
lettersonly: "Cartas solamente por favor",
|
31 |
+
nowhitespace: "No hay espacio en blanco por favor",
|
32 |
+
phone: 'Por favor, introduzca un número de teléfono válido. La mayoría de los formatos de EE.UU. / Canadá e internacionales aceptados.',
|
33 |
+
ipv4: 'Por favor, introduce una dirección IP v4 válida.',
|
34 |
+
ipv6: 'Por favor, introduce una dirección IP v6 válida.',
|
35 |
+
ziprange: 'Su código postal debe estar en el rango 902xx-xxxx a 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'Los EE.UU. Código postal especificado no es válido',
|
37 |
+
integer: 'Un número no decimal positivo o negativo por favor',
|
38 |
+
vfbUsername: 'Este nombre de usuario ya está registrado. Por favor elija otra'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-fr_FR.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: FR (French; français)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: FR (French; français)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Ce champ est obligatoire.",
|
10 |
+
remote: "Veuillez corriger ce champ.",
|
11 |
+
email: "Veuillez fournir une adresse électronique valide.",
|
12 |
+
url: "Veuillez fournir une adresse URL valide.",
|
13 |
+
date: "Veuillez fournir une date valide.",
|
14 |
+
dateISO: "Veuillez fournir une date valide (ISO).",
|
15 |
+
number: "Veuillez fournir un numéro valide.",
|
16 |
+
digits: "Veuillez fournir seulement des chiffres.",
|
17 |
+
creditcard: "Veuillez fournir un numéro de carte de crédit valide.",
|
18 |
+
equalTo: "Veuillez fournir encore la même valeur.",
|
19 |
+
accept: "Veuillez fournir une valeur avec une extension valide.",
|
20 |
+
maxlength: $.validator.format( "Veuillez fournir au plus {0} caractères." ),
|
21 |
+
minlength: $.validator.format( "Veuillez fournir au moins {0} caractères." ),
|
22 |
+
rangelength: $.validator.format( "Veuillez fournir une valeur qui contient entre {0} et {1} caractères." ),
|
23 |
+
range: $.validator.format( "Veuillez fournir une valeur entre {0} et {1}." ),
|
24 |
+
max: $.validator.format( "Veuillez fournir une valeur inférieur ou égal à {0}." ),
|
25 |
+
min: $.validator.format( "Veuillez fournir une valeur supérieur ou égal à {0}." ),
|
26 |
+
maxWords: $.validator.format( "Veuillez fournir au plus {0} mots." ),
|
27 |
+
minWords: $.validator.format( "Veuillez fournir au moins {0} mots." ),
|
28 |
+
rangeWords: $.validator.format( "Veuillez fournir entre {0} et {1} mots." ),
|
29 |
+
alphanumeric: "Veuillez fournir seulement des lettres, nombres, espaces et soulignages.",
|
30 |
+
lettersonly: "Veuillez fournir seulement des lettres.",
|
31 |
+
nowhitespace: "Veuillez ne pas inscrire d'espaces blancs.",
|
32 |
+
phone: 'Veuillez fournir entrez un numéro de téléphone valide. La plupart des formats US / Canada et internationales acceptées.',
|
33 |
+
ipv4: "Veuillez fournir une adresse IP v4 valide.",
|
34 |
+
ipv6: "Veuillez fournir une adresse IP v6 valide.",
|
35 |
+
ziprange: "Veuillez fournir un code postal entre 902xx-xxxx et 905-xx-xxxx.",
|
36 |
+
zipcodeUS: "Les États-Unis Code postal spécifié n'est pas valide",
|
37 |
+
integer: "Veuillez fournir un nombre non décimal qui est positif ou négatif.",
|
38 |
+
vfbUsername: "Ce nom d'utilisateur est déjà enregistré. S'il vous plaît choisir un autre"
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-he_IL.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: HE (Hebrew; עברית)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: HE (Hebrew; עברית)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "השדה הזה הינו שדה חובה",
|
10 |
+
remote: "נא לתקן שדה זה",
|
11 |
+
email: "נא למלא כתובת דוא\"ל חוקית",
|
12 |
+
url: "נא למלא כתובת אינטרנט חוקית",
|
13 |
+
date: "נא למלא תאריך חוקי",
|
14 |
+
dateISO: "נא למלא תאריך חוקי (ISO)",
|
15 |
+
number: "נא למלא מספר",
|
16 |
+
digits: "נא למלא רק מספרים",
|
17 |
+
creditcard: "נא למלא מספר כרטיס אשראי חוקי",
|
18 |
+
equalTo: "נא למלא את אותו ערך שוב",
|
19 |
+
accept: "נא למלא ערך עם סיומת חוקית",
|
20 |
+
maxlength: $.validator.format( ".נא לא למלא יותר מ- {0} תווים" ),
|
21 |
+
minlength: $.validator.format( "נא למלא לפחות {0} תווים" ),
|
22 |
+
rangelength: $.validator.format( "נא למלא ערך בין {0} ל- {1} תווים" ),
|
23 |
+
range: $.validator.format( "נא למלא ערך בין {0} ל- {1}" ),
|
24 |
+
max: $.validator.format( "נא למלא ערך קטן או שווה ל- {0}" ),
|
25 |
+
min: $.validator.format( "נא למלא ערך גדול או שווה ל- {0}" ),
|
26 |
+
maxWords: $.validator.format( "נא להזין את {0} מילות או פחות." ),
|
27 |
+
minWords: $.validator.format( "נא להזין לפחות מילות {0}. " ),
|
28 |
+
rangeWords: $.validator.format( "נא להזין בין {0} ו {1} מילות. " ),
|
29 |
+
alphanumeric: "אותיות, מספרים, ומדגיש רק בבקשה ",
|
30 |
+
lettersonly: "רק אותיות בבקשה ",
|
31 |
+
nowhitespace: "אין חלל לבן בבקשה",
|
32 |
+
phone: 'נא להזין מספר טלפון חוקי. רוב פורמטי ארה"ב / קנדה והבינלאומית מקובלים. ',
|
33 |
+
ipv4: 'נא להזין את כתובת ה-IP v4 בתוקף. ',
|
34 |
+
ipv6: 'נא להזין את כתובת ה-IP v6 בתוקף. ',
|
35 |
+
ziprange: 'מיקוד שלך חייב להיות ב902xx-XXXX טווח ל905-XX-XXXX ',
|
36 |
+
zipcodeUS: 'המיקוד בארה"ב שצוין אינו חוקי ',
|
37 |
+
integer: 'מספר שאינו עשרוני חיובי או שלילי בבקשה ',
|
38 |
+
vfbUsername: 'שם משתמש זה כבר רשום. אנא בחר אחד אחר'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-hu_HU.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: HU (Hungarian; Magyar)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: HU (Hungarian; Magyar)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Kötelező megadni.",
|
10 |
+
remote: "Kérem javítsa ki ezt a mezőt.",
|
11 |
+
email: "Érvényes e-mail címnek kell lennie.",
|
12 |
+
url: "Érvényes URL-nek kell lennie.",
|
13 |
+
date: "Dátumnak kell lennie.",
|
14 |
+
dateISO: "Kérem írjon be egy érvényes dátumot (ISO).",
|
15 |
+
number: "Számnak kell lennie.",
|
16 |
+
digits: "Csak számjegyek lehetnek.",
|
17 |
+
creditcard: "Érvényes hitelkártyaszámnak kell lennie.",
|
18 |
+
equalTo: "Meg kell egyeznie a két értéknek.",
|
19 |
+
accept: "Adjon meg egy értéket, megfelelő végződéssel.",
|
20 |
+
maxlength: $.validator.format( "Legfeljebb {0} karakter hosszú legyen." ),
|
21 |
+
minlength: $.validator.format( "Legalább {0} karakter hosszú legyen." ),
|
22 |
+
rangelength: $.validator.format( "Legalább {0} és legfeljebb {1} karakter hosszú legyen." ),
|
23 |
+
range: $.validator.format( "{0} és {1} közé kell esnie." ),
|
24 |
+
max: $.validator.format( "Nem lehet nagyobb, mint {0}." ),
|
25 |
+
min: $.validator.format( "Nem lehet kisebb, mint {0}." ),
|
26 |
+
maxWords: $.validator.format( "Kérjük, adja meg {0} szó, vagy kevesebb." ),
|
27 |
+
minWords: $.validator.format( "Kérjük, adja meg legalább {0} szó." ),
|
28 |
+
rangeWords: $.validator.format( "Kérjük, adja meg {0} {1} szavakat." ),
|
29 |
+
alphanumeric: "Betűk, számok és aláhúzás csak kérjük",
|
30 |
+
lettersonly: "Letters csak kérlek",
|
31 |
+
nowhitespace: "No white space kérlek",
|
32 |
+
phone: 'Adjon meg egy érvényes telefonszámot. A legtöbb USA / Kanada és nemzetközi formátumban elfogadott.',
|
33 |
+
ipv4: 'Adjon meg egy érvényes IP v4-címet.',
|
34 |
+
ipv6: 'Adjon meg egy érvényes IP v6-címet.',
|
35 |
+
ziprange: 'A zip-kódot kell a tartományban 902xx-xxxx a 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'A megadott US irányítószám érvénytelen',
|
37 |
+
integer: 'A pozitív vagy negatív nem decimális számot kérjük',
|
38 |
+
vfbUsername: 'Ez a felhasználónév már regisztrálva van. Kérjük, válasszon egy másikat'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-id_ID.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: ID (Indonesian)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: ID (Indonesian)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Field ini harus diisi.",
|
10 |
+
remote: "Harap perbaiki field ini.",
|
11 |
+
email: "Harap masukan alamat email yang valid.",
|
12 |
+
url: "Harap masukan URL yang valid.",
|
13 |
+
date: "Harap masukan tanggal yang valid.",
|
14 |
+
dateISO: "Harap masukan tanggal yang valid (ISO).",
|
15 |
+
number: "Harap masukan angka yang valid.",
|
16 |
+
digits: "Harap masukan hanya digit.",
|
17 |
+
creditcard: "Harap masukan nomor kartu kredit yang valid.",
|
18 |
+
equalTo: "Harap masukan nilai yang sama lagi.",
|
19 |
+
accept: "Harap masukan nilai dengan ekstensi yang valid.",
|
20 |
+
maxlength: $.validator.format( "Harap masukan tidak lebih dari {0} karakter." ),
|
21 |
+
minlength: $.validator.format( "Harap masukan sedikitnya {0} karakter." ),
|
22 |
+
rangelength: $.validator.format( "Harap masukan antara {0} dan {1} karakter." ),
|
23 |
+
range: $.validator.format( "Harap masukan nilai antara {0} dan {1}." ),
|
24 |
+
max: $.validator.format( "Harap masukan nilai lebih kecil atau sama dengan {0}." ),
|
25 |
+
min: $.validator.format( "Harap masukan nilai lebih besar atau sama dengan {0}." ),
|
26 |
+
maxWords: $.validator.format( "Harap masukan {0} kata atau kurang." ),
|
27 |
+
minWords: $.validator.format( "Harap masukan sedikitnya {0} kata." ),
|
28 |
+
rangeWords: $.validator.format( "Harap masukan antara {0} dan {1} kata." ),
|
29 |
+
alphanumeric: "Harap masukan hanya karakter, angka atau garis bawah.",
|
30 |
+
lettersonly: "Harap masukan hanya karakter.",
|
31 |
+
nowhitespace: "Tidak boleh ada spasi.",
|
32 |
+
phone: 'Masukkan nomor telepon yang valid. Kebanyakan format AS / Kanada dan International diterima.',
|
33 |
+
ipv4: 'Silahkan masukkan alamat IP v4 yang valid.',
|
34 |
+
ipv6: 'Silahkan masukkan alamat IP v6 valid.',
|
35 |
+
ziprange: 'Anda ZIP-kode harus dalam kisaran 902xx-xxxx untuk 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'AS ZIP Code yang ditentukan tidak valid',
|
37 |
+
integer: 'Sejumlah non-desimal positif atau negatif silahkan',
|
38 |
+
vfbUsername: 'Username sudah terdaftar. Silahkan pilih yang lain'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-it_IT.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: IT (Italian; Italiano)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: IT (Italian; Italiano)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Campo obbligatorio.",
|
10 |
+
remote: "Controlla questo campo.",
|
11 |
+
email: "Inserisci un indirizzo email valido.",
|
12 |
+
url: "Inserisci un indirizzo web valido.",
|
13 |
+
date: "Inserisci una data valida.",
|
14 |
+
dateISO: "Inserisci una data valida (ISO).",
|
15 |
+
number: "Inserisci un numero valido.",
|
16 |
+
digits: "Inserisci solo numeri.",
|
17 |
+
creditcard: "Inserisci un numero di carta di credito valido.",
|
18 |
+
equalTo: "Il valore non corrisponde.",
|
19 |
+
accept: "Inserisci un valore con un'estensione valida.",
|
20 |
+
maxlength: $.validator.format( "Non inserire più di {0} caratteri." ),
|
21 |
+
minlength: $.validator.format( "Inserisci almeno {0} caratteri." ),
|
22 |
+
rangelength: $.validator.format( "Inserisci un valore compreso tra {0} e {1} caratteri." ),
|
23 |
+
range: $.validator.format( "Inserisci un valore compreso tra {0} e {1}." ),
|
24 |
+
max: $.validator.format( "Inserisci un valore minore o uguale a {0}." ),
|
25 |
+
min: $.validator.format( "Inserisci un valore maggiore o uguale a {0}." ),
|
26 |
+
maxWords: $.validator.format( "Inserisci {0} parole o meno." ),
|
27 |
+
minWords: $.validator.format( "Inserisci almeno {0} parole." ),
|
28 |
+
rangeWords: $.validator.format( "Inserisci tra {0} e {1} parole." ),
|
29 |
+
alphanumeric: "Lettere, numeri e underscore solo per favore",
|
30 |
+
lettersonly: "Lettere solo per favore",
|
31 |
+
nowhitespace: "Nessuno spazio bianco per favore",
|
32 |
+
phone: 'Si prega di inserire un numero di telefono valido. La maggior parte dei formati di US / Canada e internazionali accettate.',
|
33 |
+
ipv4: 'Si prega di inserire un indirizzo IP v4 valido.',
|
34 |
+
ipv6: 'Si prega di inserire un indirizzo IP v6 valido.',
|
35 |
+
ziprange: 'Il tuo ZIP-codice deve essere nel range 902xx-xxxx a 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'Gli Stati Uniti CAP specificato non è valido',
|
37 |
+
integer: 'Un numero non decimale positivo o negativo per favore',
|
38 |
+
vfbUsername: 'Questo nome utente è già registrato. Si prega di scegliere un altro'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-ja_JP.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: JA (Japanese; 日本語)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: JA (Japanese; 日本語)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "このフィールドは必須です。",
|
10 |
+
remote: "このフィールドを修正してください。",
|
11 |
+
email: "有効なEメールアドレスを入力してください。",
|
12 |
+
url: "有効なURLを入力してください。",
|
13 |
+
date: "有効な日付を入力してください。",
|
14 |
+
dateISO: "有効な日付(ISO)を入力してください。",
|
15 |
+
number: "有効な数字を入力してください。",
|
16 |
+
digits: "数字のみを入力してください。",
|
17 |
+
creditcard: "有効なクレジットカード番号を入力してください。",
|
18 |
+
equalTo: "同じ値をもう一度入力してください。",
|
19 |
+
accept: "有効な拡張子を含む値を入力してください。",
|
20 |
+
maxlength: $.validator.format( "{0} 文字以内で入力してください。" ),
|
21 |
+
minlength: $.validator.format( "{0} 文字以上で入力してください。" ),
|
22 |
+
rangelength: $.validator.format( "{0} 文字から {1} 文字までの値を入力してください。" ),
|
23 |
+
range: $.validator.format( "{0} から {1} までの値を入力してください。" ),
|
24 |
+
max: $.validator.format( "{0} 以下の値を入力してください。" ),
|
25 |
+
min: $.validator.format( "{0} 以上の値を入力してください。" ),
|
26 |
+
maxWords: $.validator.format( "{0}字以内で入力してください。" ),
|
27 |
+
minWords: $.validator.format( "少なくとも{0}の言葉を入力してください。" ),
|
28 |
+
rangeWords: $.validator.format( "{0}と{1}単語の間で入力してください。" ),
|
29 |
+
alphanumeric: "文字、数字、およびアンダースコアのみでお願いします",
|
30 |
+
lettersonly: "手紙のみでお願いします",
|
31 |
+
nowhitespace: "に空白をして下さい",
|
32 |
+
phone: '有効な電話番号を入力してください。ほとんどの米国/カナダおよび国際フォーマットが受け入れた。',
|
33 |
+
ipv4: '有効なIP V4アドレスを入力してください。',
|
34 |
+
ipv6: '有効なIP V6アドレスを入力してください。',
|
35 |
+
ziprange: 'あなたの郵便番号は905-XX-XXXXの範囲の902xx-XXXXである必要があります',
|
36 |
+
zipcodeUS: '指定された米国の郵便番号が無効です',
|
37 |
+
integer: '正または負の非小数ください',
|
38 |
+
vfbUsername: 'このユーザー名はすでに登録されています。他の名前を選んでください'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-ko_KR.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: KO (Korean; 한국어)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: KO (Korean; 한국어)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "필수 항목입니다.",
|
10 |
+
remote: "항목을 수정하세요.",
|
11 |
+
email: "유효하지 않은 E-Mail주소입니다.",
|
12 |
+
url: "유효하지 않은 URL입니다.",
|
13 |
+
date: "올바른 날짜를 입력하세요.",
|
14 |
+
dateISO: "올바른 날짜(ISO)를 입력하세요.",
|
15 |
+
number: "유효한 숫자가 아닙니다.",
|
16 |
+
digits: "숫자만 입력 가능합니다.",
|
17 |
+
creditcard: "신용카드 번호가 바르지 않습니다.",
|
18 |
+
equalTo: "같은 값을 다시 입력하세요.",
|
19 |
+
accept: "올바른 확장자가 아닙니다.",
|
20 |
+
maxlength: $.validator.format( "{0}자를 넘을 수 없습니다. " ),
|
21 |
+
minlength: $.validator.format( "{0}자 이상 입력하세요." ),
|
22 |
+
rangelength: $.validator.format( "문자 길이가 {0} 에서 {1} 사이의 값을 입력하세요." ),
|
23 |
+
range: $.validator.format( "{0} 에서 {1} 사이의 값을 입력하세요." ),
|
24 |
+
max: $.validator.format( "{0} 이하의 값을 입력하세요." ),
|
25 |
+
min: $.validator.format( "{0} 이상의 값을 입력하세요." ),
|
26 |
+
maxWords: $.validator.format( "{0} 단어 이하를 입력 해 주시기 바랍니다." ),
|
27 |
+
minWords: $.validator.format( "적어도 {0} 단어를 입력 해주세요." ),
|
28 |
+
rangeWords: $.validator.format( "{0}과 {1} 단어 사이에 입력하십시오." ),
|
29 |
+
alphanumeric: "문자, 숫자, 그리고 밑줄 만주세요",
|
30 |
+
lettersonly: "문자 만주세요",
|
31 |
+
nowhitespace: "에 공백하시기 바랍니다",
|
32 |
+
phone: '올바른 전화 번호를 입력하세요. 대부분의 미국 / 캐나다 및 국제 형식으로 받아 들였다.',
|
33 |
+
ipv4: '유효한 IP V4 주소를 입력하십시오.',
|
34 |
+
ipv6: '유효한 IP V6 주소를 입력 해주십시오.',
|
35 |
+
ziprange: '귀하의 ZIP 코드는 905-XX-XXXX의 범위의 902xx-XXXX에 있어야합니다',
|
36 |
+
zipcodeUS: '지정된 미국의 우편 번호가 잘못되었습니다',
|
37 |
+
integer: '양수 또는 음수가 아닌 십진수주세요',
|
38 |
+
vfbUsername: '이 사용자 이름은 이미 등록되어 있습니다. 또 다른 하나를 선택하십시오'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-nl_NL.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: NL (Dutch; Nederlands, Vlaams)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: NL (Dutch; Nederlands, Vlaams)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Dit is een verplicht veld.",
|
10 |
+
remote: "Controleer dit veld.",
|
11 |
+
email: "Vul hier een geldig e-mailadres in.",
|
12 |
+
url: "Vul hier een geldige URL in.",
|
13 |
+
date: "Vul hier een geldige datum in.",
|
14 |
+
dateISO: "Vul hier een geldige datum in (ISO-formaat).",
|
15 |
+
number: "Vul hier een geldig getal in.",
|
16 |
+
digits: "Vul hier alleen getallen in.",
|
17 |
+
creditcard: "Vul hier een geldig creditcardnummer in.",
|
18 |
+
equalTo: "Vul hier dezelfde waarde in.",
|
19 |
+
accept: "Vul hier een waarde in met een geldige extensie.",
|
20 |
+
maxlength: $.validator.format( "Vul hier maximaal {0} tekens in." ),
|
21 |
+
minlength: $.validator.format( "Vul hier minimaal {0} tekens in." ),
|
22 |
+
rangelength: $.validator.format( "Vul hier een waarde in van minimaal {0} en maximaal {1} tekens." ),
|
23 |
+
range: $.validator.format( "Vul hier een waarde in van minimaal {0} en maximaal {1}." ),
|
24 |
+
max: $.validator.format( "Vul hier een waarde in kleiner dan of gelijk aan {0}." ),
|
25 |
+
min: $.validator.format( "Vul hier een waarde in groter dan of gelijk aan {0}." ),
|
26 |
+
maxWords: $.validator.format( "Vul hier {0} woorden of minder." ),
|
27 |
+
minWords: $.validator.format( "Vul hier minimaal {0} woorden." ),
|
28 |
+
rangeWords: $.validator.format( "Vul hier tussen {0} en {1} woorden." ),
|
29 |
+
alphanumeric: "Letters, cijfers, en onderstreept alleen maar te behagen",
|
30 |
+
lettersonly: "Brieven slechts tevreden",
|
31 |
+
nowhitespace: "Geen witte ruimte alsjeblieft",
|
32 |
+
phone: 'Vul een geldig telefoonnummer. De meeste VS / Canada en internationale formats geaccepteerd. ',
|
33 |
+
ipv4: 'Vul een geldig IP v4 adres.',
|
34 |
+
ipv6: 'Vul een geldig IP v6 adres.',
|
35 |
+
ziprange: 'Uw postcode moet in het bereik 902xx-xxxx zijn om 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'De opgegeven US postcode is ongeldig',
|
37 |
+
integer: 'Een positieve of negatieve niet-decimaal getal aub',
|
38 |
+
vfbUsername: 'Deze gebruikersnaam is al geregistreerd. Kies een andere naam'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-pl_PL.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: PL (Polish; język polski, polszczyzna)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: PL (Polish; język polski, polszczyzna)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "To pole jest wymagane.",
|
10 |
+
remote: "Proszę o wypełnienie tego pola.",
|
11 |
+
email: "Proszę o podanie prawidłowego adresu email.",
|
12 |
+
url: "Proszę o podanie prawidłowego URL.",
|
13 |
+
date: "Proszę o podanie prawidłowej daty.",
|
14 |
+
dateISO: "Proszę o podanie prawidłowej daty (ISO).",
|
15 |
+
number: "Proszę o podanie prawidłowej liczby.",
|
16 |
+
digits: "Proszę o podanie samych cyfr.",
|
17 |
+
creditcard: "Proszę o podanie prawidłowej karty kredytowej.",
|
18 |
+
equalTo: "Proszę o podanie tej samej wartości ponownie.",
|
19 |
+
accept: "Proszę o podanie wartości z prawidłowym rozszerzeniem.",
|
20 |
+
maxlength: $.validator.format( "Proszę o podanie nie więcej niż {0} znaków." ),
|
21 |
+
minlength: $.validator.format( "Proszę o podanie przynajmniej {0} znaków." ),
|
22 |
+
rangelength: $.validator.format( "Proszę o podanie wartości o długości od {0} do {1} znaków." ),
|
23 |
+
range: $.validator.format( "Proszę o podanie wartości z przedziału od {0} do {1}." ),
|
24 |
+
max: $.validator.format( "Proszę o podanie wartości mniejszej bądź równej {0}." ),
|
25 |
+
min: $.validator.format( "Proszę o podanie wartości większej bądź równej {0}." ),
|
26 |
+
maxWords: $.validator.format( "Proszę o podanie {0} lub mniej słów." ),
|
27 |
+
minWords: $.validator.format( "Proszę o podanie najmniej {0} słowa" ),
|
28 |
+
rangeWords: $.validator.format( "Proszę o podanie między {0} i {1} słów." ),
|
29 |
+
alphanumeric: "Liter, cyfr, podkreśleń i tylko proszę",
|
30 |
+
lettersonly: "Proszę tylko litery",
|
31 |
+
nowhitespace: "Proszę nie spacje",
|
32 |
+
phone: 'Proszę podać poprawny numer telefonu. Przyjmujemy większość formatów US / Kanada i międzynarodowe.',
|
33 |
+
ipv4: 'Proszę podać adres IP v4.',
|
34 |
+
ipv6: 'Proszę podać adres IP v6.',
|
35 |
+
ziprange: 'Twój kod pocztowy musi być w zakresie 902xx do 905-xxxx-xxxx-xx',
|
36 |
+
zipcodeUS: 'Określone US kod pocztowy jest nieprawidłowy',
|
37 |
+
integer: 'Dodatnia lub ujemna liczba dziesiętna proszę nie',
|
38 |
+
vfbUsername: 'Ta nazwa użytkownika jest już zarejestrowana. Wybierz inny',
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-pt_BR.js
CHANGED
@@ -4,36 +4,39 @@
|
|
4 |
* Region: BR (Brazil)
|
5 |
*/
|
6 |
(function($) {
|
7 |
-
$.extend(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
4 |
* Region: BR (Brazil)
|
5 |
*/
|
6 |
(function($) {
|
7 |
+
$.extend(
|
8 |
+
$.validator.messages,
|
9 |
+
{
|
10 |
+
required: "Este campo é requerido.",
|
11 |
+
remote: "Por favor, corrija este campo.",
|
12 |
+
email: "Por favor, forneça um endereço de email válido.",
|
13 |
+
url: "Por favor, forneça uma URL válida.",
|
14 |
+
date: "Por favor, forneça uma data válida.",
|
15 |
+
dateISO: "Por favor, forneça uma data válida (ISO).",
|
16 |
+
number: "Por favor, forneça um número válido.",
|
17 |
+
digits: "Por favor, forneça somente dígitos.",
|
18 |
+
creditcard: "Por favor, forneça um cartão de crédito válido.",
|
19 |
+
equalTo: "Por favor, forneça o mesmo valor novamente.",
|
20 |
+
accept: "Por favor, forneça um valor com uma extensão válida.",
|
21 |
+
maxlength: $.validator.format( "Por favor, forneça não mais que {0} caracteres." ),
|
22 |
+
minlength: $.validator.format( "Por favor, forneça ao menos {0} caracteres." ),
|
23 |
+
rangelength: $.validator.format( "Por favor, forneça um valor entre {0} e {1} caracteres de comprimento." ),
|
24 |
+
range: $.validator.format( "Por favor, forneça um valor entre {0} e {1}." ),
|
25 |
+
max: $.validator.format( "Por favor, forneça um valor menor ou igual a {0}." ),
|
26 |
+
min: $.validator.format( "Por favor, forneça um valor maior ou igual a {0}." ),
|
27 |
+
maxWords: $.validator.format( "Por favor entre {0} palavras ou menos." ),
|
28 |
+
minWords: $.validator.format( "Por favor, insira pelo menos {0} palavras." ),
|
29 |
+
rangeWords: $.validator.format( "Por favor, insira entre {0} e {1} palavras." ),
|
30 |
+
alphanumeric: "Letras, números e sublinhados só por favor",
|
31 |
+
lettersonly: "Cartas só por favor",
|
32 |
+
nowhitespace: "No espaço em branco, por favor",
|
33 |
+
phone: 'Por favor insira um número de telefone válido. A maioria dos formatos EUA / Canadá e internacionais aceitos. ',
|
34 |
+
ipv4: 'Por favor insira um endereço de IP v4 válido.',
|
35 |
+
ipv6: 'Por favor insira um endereço de IP v6 válido.',
|
36 |
+
ziprange: 'O CEP-código deve estar no intervalo 902xx-xxxx a 905-xx-xxxx',
|
37 |
+
zipcodeUS: 'O CEP EUA especificado é inválido',
|
38 |
+
integer: 'Um número não decimal positivo ou negativo, por favor',
|
39 |
+
vfbUsername: 'Este nome de usuário já está registrado. Por favor escolha outro'
|
40 |
+
}
|
41 |
+
);
|
42 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-pt_PT.js
CHANGED
@@ -4,36 +4,39 @@
|
|
4 |
* Region: PT (Portugal)
|
5 |
*/
|
6 |
(function($) {
|
7 |
-
$.extend(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
4 |
* Region: PT (Portugal)
|
5 |
*/
|
6 |
(function($) {
|
7 |
+
$.extend(
|
8 |
+
$.validator.messages,
|
9 |
+
{
|
10 |
+
required: "Campo de preenchimento obrigatório.",
|
11 |
+
remote: "Por favor, corrija este campo.",
|
12 |
+
email: "Por favor, introduza um endereço eletrónico válido.",
|
13 |
+
url: "Por favor, introduza um URL válido.",
|
14 |
+
date: "Por favor, introduza uma data válida.",
|
15 |
+
dateISO: "Por favor, introduza uma data válida (ISO).",
|
16 |
+
number: "Por favor, introduza um número válido.",
|
17 |
+
digits: "Por favor, introduza apenas dígitos.",
|
18 |
+
creditcard: "Por favor, introduza um número de cartão de crédito válido.",
|
19 |
+
equalTo: "Por favor, introduza de novo o mesmo valor.",
|
20 |
+
accept: "Por favor, introduza um ficheiro com uma extensão válida.",
|
21 |
+
maxlength: $.validator.format( "Por favor, não introduza mais do que {0} caracteres." ),
|
22 |
+
minlength: $.validator.format( "Por favor, introduza pelo menos {0} caracteres." ),
|
23 |
+
rangelength: $.validator.format( "Por favor, introduza entre {0} e {1} caracteres." ),
|
24 |
+
range: $.validator.format( "Por favor, introduza um valor entre {0} e {1}." ),
|
25 |
+
max: $.validator.format( "Por favor, introduza um valor menor ou igual a {0}." ),
|
26 |
+
min: $.validator.format( "Por favor, introduza um valor maior ou igual a {0}." ),
|
27 |
+
maxWords: $.validator.format( "Por favor entre {0} palavras ou menos." ),
|
28 |
+
minWords: $.validator.format( "Por favor, insira pelo menos {0} palavras." ),
|
29 |
+
rangeWords: $.validator.format( "Por favor, insira entre {0} e {1} palavras." ),
|
30 |
+
alphanumeric: "Letras, números e sublinhados só por favor",
|
31 |
+
lettersonly: "Cartas só por favor",
|
32 |
+
nowhitespace: "No espaço em branco, por favor",
|
33 |
+
phone: 'Por favor insira um número de telefone válido. A maioria dos formatos EUA / Canadá e internacionais aceitos. ',
|
34 |
+
ipv4: 'Por favor insira um endereço de IP v4 válido.',
|
35 |
+
ipv6: 'Por favor insira um endereço de IP v6 válido.',
|
36 |
+
ziprange: 'O CEP-código deve estar no intervalo 902xx-xxxx a 905-xx-xxxx',
|
37 |
+
zipcodeUS: 'O CEP EUA especificado é inválido',
|
38 |
+
integer: 'Um número não decimal positivo ou negativo, por favor',
|
39 |
+
vfbUsername: 'Este nome de usuário já está registrado. Por favor escolha outro'
|
40 |
+
}
|
41 |
+
);
|
42 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-ro_RO.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: RO (Romanian, limba română)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
38 |
}(jQuery));
|
3 |
* Locale: RO (Romanian, limba română)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Acest câmp este obligatoriu.",
|
10 |
+
remote: "Te rugăm să completezi acest câmp.",
|
11 |
+
email: "Te rugăm să introduci o adresă de email validă",
|
12 |
+
url: "Te rugăm sa introduci o adresă URL validă.",
|
13 |
+
date: "Te rugăm să introduci o dată corectă.",
|
14 |
+
dateISO: "Te rugăm să introduci o dată (ISO) corectă.",
|
15 |
+
number: "Te rugăm să introduci un număr întreg valid.",
|
16 |
+
digits: "Te rugăm să introduci doar cifre.",
|
17 |
+
creditcard: "Te rugăm să introduci un numar de carte de credit valid.",
|
18 |
+
equalTo: "Te rugăm să reintroduci valoarea.",
|
19 |
+
accept: "Te rugăm să introduci o valoare cu o extensie validă.",
|
20 |
+
maxlength: $.validator.format( "Te rugăm să nu introduci mai mult de {0} caractere." ),
|
21 |
+
minlength: $.validator.format( "Te rugăm să introduci cel puțin {0} caractere." ),
|
22 |
+
rangelength: $.validator.format( "Te rugăm să introduci o valoare între {0} și {1} caractere." ),
|
23 |
+
range: $.validator.format( "Te rugăm să introduci o valoare între {0} și {1}." ),
|
24 |
+
max: $.validator.format( "Te rugăm să introduci o valoare egal sau mai mică decât {0}." ),
|
25 |
+
min: $.validator.format( "Te rugăm să introduci o valoare egal sau mai mare decât {0}." ),
|
26 |
+
maxWords: $.validator.format( "Te rugăm să introduci {0} de cuvinte sau mai puțin" ),
|
27 |
+
minWords: $.validator.format( "Te rugăm să introduci cel putin {0} cuvinte." ),
|
28 |
+
rangeWords: $.validator.format( "Te rugăm să introduci {0} și {1} cuvinte" ),
|
29 |
+
alphanumeric: "Litere, numere, și subliniază numai vă rog",
|
30 |
+
lettersonly: "Scrisori doar vă rog",
|
31 |
+
nowhitespace: "Nu există spațiu alb, vă rugăm",
|
32 |
+
phone: 'Vă rugăm să introduceți un număr de telefon valid. Cele mai multe formate de SUA / Canada și internaționale acceptate.',
|
33 |
+
ipv4: 'Vă rugăm să introduceți o adresă validă IP v4.',
|
34 |
+
ipv6: 'Vă rugăm să introduceți o adresă validă IP v6.',
|
35 |
+
ziprange: 'Dvs. ZIP-cod trebuie să fie în gama 902xx-xxxx a 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'Specificat SUA cod poștal este nevalid',
|
37 |
+
integer: 'Un număr de non-zecimal pozitiv sau negativ, vă rugăm',
|
38 |
+
vfbUsername: 'Acest nume de utilizator este deja înregistrat. Vă rugăm să alegeți un alt unul'
|
39 |
+
}
|
40 |
+
);
|
41 |
}(jQuery));
|
public/assets/js/i18n/validate/messages-ru_RU.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: RU (Russian; русский язык)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: RU (Russian; русский язык)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Это поле необходимо заполнить.",
|
10 |
+
remote: "Пожалуйста, введите правильное значение.",
|
11 |
+
email: "Пожалуйста, введите корректный адрес электронной почты.",
|
12 |
+
url: "Пожалуйста, введите корректный URL.",
|
13 |
+
date: "Пожалуйста, введите корректную дату.",
|
14 |
+
dateISO: "Пожалуйста, введите корректную дату в формате ISO.",
|
15 |
+
number: "Пожалуйста, введите число.",
|
16 |
+
digits: "Пожалуйста, вводите только цифры.",
|
17 |
+
creditcard: "Пожалуйста, введите правильный номер кредитной карты.",
|
18 |
+
equalTo: "Пожалуйста, введите такое же значение ещё раз.",
|
19 |
+
accept: "Пожалуйста, выберите файл с правильным расширением.",
|
20 |
+
maxlength: $.validator.format( "Пожалуйста, введите не больше {0} символов." ),
|
21 |
+
minlength: $.validator.format( "Пожалуйста, введите не меньше {0} символов." ),
|
22 |
+
rangelength: $.validator.format( "Пожалуйста, введите значение длиной от {0} до {1} символов." ),
|
23 |
+
range: $.validator.format( "Пожалуйста, введите число от {0} до {1}." ),
|
24 |
+
max: $.validator.format( "Пожалуйста, введите число, меньшее или равное {0}." ),
|
25 |
+
min: $.validator.format( "Пожалуйста, введите число, большее или равное {0}." ),
|
26 |
+
maxWords: $.validator.format( "Пожалуйста, введите {0} слова или меньше." ),
|
27 |
+
minWords: $.validator.format( "Пожалуйста, введите по крайней мере {0} слова." ),
|
28 |
+
rangeWords: $.validator.format( "Пожалуйста, введите между {0} и {1} слов." ),
|
29 |
+
alphanumeric: "Буквы, цифры и подчеркивает только пожалуйста",
|
30 |
+
lettersonly: "Письма только пожалуйста",
|
31 |
+
nowhitespace: "Нет пробел пожалуйста",
|
32 |
+
phone: 'Пожалуйста, введите действительный номер телефона. Принимаются Большинство форматов США / Канада и международных.',
|
33 |
+
ipv4: 'Пожалуйста, введите действительный адрес IP v4.',
|
34 |
+
ipv6: 'Пожалуйста, введите действительный адрес IP v6.',
|
35 |
+
ziprange: 'Ваш архив код должен находиться в диапазоне от 902xx-XXXX в 905-хх-хххх',
|
36 |
+
zipcodeUS: 'Указанный США ZIP код недействителен',
|
37 |
+
integer: 'Положительное или отрицательное, не десятичное число пожалуйста',
|
38 |
+
vfbUsername: 'Это имя пользователя уже зарегистрировано. Пожалуйста, выберите другое'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-sv_SE.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: SV (Swedish; Svenska)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: SV (Swedish; Svenska)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Detta fält är obligatoriskt.",
|
10 |
+
remote: "Åtgärda detta område.",
|
11 |
+
email: "Ange en korrekt e-postadress.",
|
12 |
+
url: "Ange en korrekt URL.",
|
13 |
+
date: "Ange ett korrekt datum.",
|
14 |
+
dateISO: "Ange ett korrekt datum (ÅÅÅÅ-MM-DD).",
|
15 |
+
number: "Ange ett korrekt nummer.",
|
16 |
+
digits: "Ange endast siffror.",
|
17 |
+
creditcard: "Ange ett korrekt kreditkortsnummer.",
|
18 |
+
equalTo: "Ange samma värde igen.",
|
19 |
+
accept: "Ange ett värde med en giltig domän.",
|
20 |
+
maxlength: $.validator.format( "Du får ange högst {0} tecken." ),
|
21 |
+
minlength: $.validator.format( "Du måste ange minst {0} tecken." ),
|
22 |
+
rangelength: $.validator.format( "Ange minst {0} och max {1} tecken." ),
|
23 |
+
range: $.validator.format( "Ange ett värde mellan {0} och {1}." ),
|
24 |
+
max: $.validator.format( "Ange ett värde som är mindre eller lika med {0}." ),
|
25 |
+
min: $.validator.format( "Ange ett värde som är större eller lika med {0}." ),
|
26 |
+
maxWords: $.validator.format( "Ange {0} ord eller mindre." ),
|
27 |
+
minWords: $.validator.format( "Ange minst {0} ord." ),
|
28 |
+
rangeWords: $.validator.format( "Ange mellan {0} och {1} ord." ),
|
29 |
+
alphanumeric: "Bokstäver, siffror och understreck bara snälla",
|
30 |
+
lettersonly: "Brev bara snälla",
|
31 |
+
nowhitespace: "Inga blank vänligen",
|
32 |
+
phone: 'Ange ett giltigt telefonnummer. De flesta USA / Kanada och internationella format accepteras.',
|
33 |
+
ipv4: 'Ange en giltig IP v4-adress.',
|
34 |
+
ipv6: 'Ange en giltig IP v6-adress.',
|
35 |
+
ziprange: 'Din ZIP-kod måste ligga i intervallet 902xx-xxxx till 905-xx-xxxx',
|
36 |
+
zipcodeUS: 'Den angivna amerikanska postnummer är ogiltig',
|
37 |
+
integer: 'En positiv eller negativ icke-decimaltal vänligen',
|
38 |
+
vfbUsername: 'Detta användarnamn är upptaget. Var vänlig välj en annan'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-tr_TR.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: TR (Turkish; Türkçe)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: TR (Turkish; Türkçe)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "Bu alanın doldurulması zorunludur.",
|
10 |
+
remote: "Lütfen bu alanı düzeltin.",
|
11 |
+
email: "Lütfen geçerli bir e-posta adresi giriniz.",
|
12 |
+
url: "Lütfen geçerli bir web adresi (URL) giriniz.",
|
13 |
+
date: "Lütfen geçerli bir tarih giriniz.",
|
14 |
+
dateISO: "Lütfen geçerli bir tarih giriniz(ISO formatında)",
|
15 |
+
number: "Lütfen geçerli bir sayı giriniz.",
|
16 |
+
digits: "Lütfen sadece sayısal karakterler giriniz.",
|
17 |
+
creditcard: "Lütfen geçerli bir kredi kartı giriniz.",
|
18 |
+
equalTo: "Lütfen aynı değeri tekrar giriniz.",
|
19 |
+
accept: "Lütfen geçerli uzantıya sahip bir değer giriniz.",
|
20 |
+
maxlength: $.validator.format( "Lütfen en fazla {0} karakter uzunluğunda bir değer giriniz." ),
|
21 |
+
minlength: $.validator.format( "Lütfen en az {0} karakter uzunluğunda bir değer giriniz." ),
|
22 |
+
rangelength: $.validator.format( "Lütfen en az {0} ve en fazla {1} uzunluğunda bir değer giriniz." ),
|
23 |
+
range: $.validator.format( "Lütfen {0} ile {1} arasında bir değer giriniz." ),
|
24 |
+
max: $.validator.format( "Lütfen {0} değerine eşit ya da daha küçük bir değer giriniz." ),
|
25 |
+
min: $.validator.format( "Lütfen {0} değerine eşit ya da daha büyük bir değer giriniz." ),
|
26 |
+
maxWords: $.validator.format( "Lütfen {0} kelime veya daha az girin." ),
|
27 |
+
minWords: $.validator.format( "Lütfen en az {0} kelimeleri giriniz." ),
|
28 |
+
rangeWords: $.validator.format( "Lütfen {0} ve {1} kelimeler arasına girin." ),
|
29 |
+
alphanumeric: "Harfler, sayılar ve alt çizgi sadece lütfen",
|
30 |
+
lettersonly: "Mektuplar sadece lütfen",
|
31 |
+
nowhitespace: "Hiçbir boşluk lütfen",
|
32 |
+
phone: 'Geçerli bir telefon numarası giriniz. Çoğu ABD / Kanada ve Uluslararası formatları kabul.',
|
33 |
+
ipv4: 'Geçerli bir IP v4 adresini girin.',
|
34 |
+
ipv6: 'Geçerli bir IP v6 adresini girin.',
|
35 |
+
ziprange: 'Posta kodu 905-xx-xxxx aralık 902xx-xxxx olmalı',
|
36 |
+
zipcodeUS: 'Belirtilen ABD Posta Kodu geçersiz',
|
37 |
+
integer: 'Bir pozitif veya negatif olmayan ondalık sayı lütfen',
|
38 |
+
vfbUsername: 'Bu kullanıcı adı zaten kayıtlı. Başka bir tane seçiniz'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-zh_CN.js
CHANGED
@@ -3,36 +3,39 @@
|
|
3 |
* Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語)
|
4 |
*/
|
5 |
(function($) {
|
6 |
-
$.extend(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
3 |
* Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語)
|
4 |
*/
|
5 |
(function($) {
|
6 |
+
$.extend(
|
7 |
+
$.validator.messages,
|
8 |
+
{
|
9 |
+
required: "必须填写",
|
10 |
+
remote: "请修正此栏位",
|
11 |
+
email: "请输入有效的电子邮件",
|
12 |
+
url: "请输入有效的网址",
|
13 |
+
date: "请输入有效的日期",
|
14 |
+
dateISO: "请输入有效的日期 (YYYY-MM-DD)",
|
15 |
+
number: "请输入正确的数字",
|
16 |
+
digits: "只可输入数字",
|
17 |
+
creditcard: "请输入有效的信用卡号码",
|
18 |
+
equalTo: "你的输入不相同",
|
19 |
+
accept: "请输入有效的后缀",
|
20 |
+
maxlength: $.validator.format( "最多 {0} 个字" ),
|
21 |
+
minlength: $.validator.format( "最少 {0} 个字" ),
|
22 |
+
rangelength: $.validator.format( "请输入长度为 {0} 至 {1} 之間的字串" ),
|
23 |
+
range: $.validator.format( "请输入 {0} 至 {1} 之间的数值" ),
|
24 |
+
max: $.validator.format( "请输入不大于 {0} 的数值" ),
|
25 |
+
min: $.validator.format( "请输入不小于 {0} 的数值" ),
|
26 |
+
maxWords: $.validator.format( "請輸入{0}字以內。" ),
|
27 |
+
minWords: $.validator.format( "請輸入至少{0}字。" ),
|
28 |
+
rangeWords: $.validator.format( "請{0}和{1}字之間進入。" ),
|
29 |
+
alphanumeric: "字母,數字和下劃線只請",
|
30 |
+
lettersonly: "英皇只請",
|
31 |
+
nowhitespace: "沒有空格,請",
|
32 |
+
phone: '請輸入一個有效的電話號碼。接受大多數美國/加拿大和國際格式。',
|
33 |
+
ipv4: '請輸入一個有效的IP地址卷。',
|
34 |
+
ipv6: '請輸入一個有效的IP v6地址。',
|
35 |
+
ziprange: '您的郵遞區號必須在範圍902xx-XXXX905-XX-XXXX',
|
36 |
+
zipcodeUS: '指定美國郵政編碼無效',
|
37 |
+
integer: '一個正或負的非十進制數,請',
|
38 |
+
vfbUsername: '此用戶名已被註冊。請選擇另外一個'
|
39 |
+
}
|
40 |
+
);
|
41 |
+
}(jQuery));
|
public/assets/js/i18n/validate/messages-zh_TW.js
CHANGED
@@ -4,36 +4,39 @@
|
|
4 |
* Region: TW (Taiwan)
|
5 |
*/
|
6 |
(function($) {
|
7 |
-
$.extend(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
39 |
}(jQuery));
|
4 |
* Region: TW (Taiwan)
|
5 |
*/
|
6 |
(function($) {
|
7 |
+
$.extend(
|
8 |
+
$.validator.messages,
|
9 |
+
{
|
10 |
+
required: "必須填寫",
|
11 |
+
remote: "請修正此欄位",
|
12 |
+
email: "請輸入有效的電子郵件",
|
13 |
+
url: "請輸入有效的網址",
|
14 |
+
date: "請輸入有效的日期",
|
15 |
+
dateISO: "請輸入有效的日期 (YYYY-MM-DD)",
|
16 |
+
number: "請輸入正確的數值",
|
17 |
+
digits: "只可輸入數字",
|
18 |
+
creditcard: "請輸入有效的信用卡號碼",
|
19 |
+
equalTo: "請重複輸入一次",
|
20 |
+
accept: "請輸入有效的後綴",
|
21 |
+
maxlength: $.validator.format( "最多 {0} 個字" ),
|
22 |
+
minlength: $.validator.format( "最少 {0} 個字" ),
|
23 |
+
rangelength: $.validator.format( "請輸入長度為 {0} 至 {1} 之間的字串" ),
|
24 |
+
range: $.validator.format( "請輸入 {0} 至 {1} 之間的數值" ),
|
25 |
+
max: $.validator.format( "請輸入不大於 {0} 的數值" ),
|
26 |
+
min: $.validator.format( "請輸入不小於 {0} 的數值" ),
|
27 |
+
maxWords: $.validator.format( "請輸入{0}字以內。" ),
|
28 |
+
minWords: $.validator.format( "請輸入至少{0}字。" ),
|
29 |
+
rangeWords: $.validator.format( "請{0}和{1}字之間進入。" ),
|
30 |
+
alphanumeric: "字母,數字和下劃線只請",
|
31 |
+
lettersonly: "英皇只請",
|
32 |
+
nowhitespace: "沒有空格,請",
|
33 |
+
phone: '請輸入一個有效的電話號碼。接受大多數美國/加拿大和國際格式。',
|
34 |
+
ipv4: '請輸入一個有效的IP地址卷。',
|
35 |
+
ipv6: '請輸入一個有效的IP v6地址。',
|
36 |
+
ziprange: '您的郵遞區號必須在範圍902xx-XXXX905-XX-XXXX',
|
37 |
+
zipcodeUS: '指定美國郵政編碼無效',
|
38 |
+
integer: '一個正或負的非十進制數,請',
|
39 |
+
vfbUsername: '此用戶名已被註冊。請選擇另外一個'
|
40 |
+
}
|
41 |
+
);
|
42 |
}(jQuery));
|
public/assets/js/vfb-validation.js
CHANGED
@@ -1,48 +1,64 @@
|
|
1 |
-
jQuery(document).ready(
|
2 |
-
|
3 |
-
|
4 |
-
$(
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
-
|
22 |
-
});
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
1 |
+
jQuery( document ).ready(
|
2 |
+
function($) {
|
3 |
+
// !Validate each form on the page
|
4 |
+
$( '.visual-form-builder' ).each(
|
5 |
+
function() {
|
6 |
+
$( this ).validate(
|
7 |
+
{
|
8 |
+
rules: {
|
9 |
+
"vfb-secret":{
|
10 |
+
required: true,
|
11 |
+
digits: true,
|
12 |
+
maxlength:2
|
13 |
+
}
|
14 |
+
},
|
15 |
+
errorClass : 'vfb-error',
|
16 |
+
errorPlacement: function(error, element) {
|
17 |
+
if ( element.is( ':radio' ) || element.is( ':checkbox' ) ) {
|
18 |
+
error.appendTo( element.parent().parent() );
|
19 |
+
} else if ( element.is( ':password' ) ) {
|
20 |
+
error.hide();
|
21 |
+
} else {
|
22 |
+
error.insertAfter( element );
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
);
|
27 |
}
|
28 |
+
);
|
|
|
29 |
|
30 |
+
// Force bullets to hide, but only if list-style-type isn't set
|
31 |
+
$( '.visual-form-builder li:not(.vfb-item-instructions li, .vfb-span li)' ).filter(
|
32 |
+
function(){
|
33 |
+
return $( this ).css( 'list-style-type' ) !== 'none';
|
34 |
+
}
|
35 |
+
).css( 'list-style', 'none' );
|
36 |
|
37 |
+
// !Display jQuery UI date picker
|
38 |
+
$( '.vfb-date-picker' ).each(
|
39 |
+
function(){
|
40 |
+
var vfb_dateFormat = $( this ).attr( 'data-dp-dateFormat' ) ? $( this ).attr( 'data-dp-dateFormat' ) : 'mm/dd/yy';
|
41 |
|
42 |
+
$( this ).datepicker(
|
43 |
+
{
|
44 |
+
dateFormat: vfb_dateFormat
|
45 |
+
}
|
46 |
+
);
|
47 |
+
}
|
48 |
+
);
|
49 |
|
50 |
+
// !Custom validation method to check multiple emails
|
51 |
+
$.validator.addMethod(
|
52 |
+
'phone',
|
53 |
+
function( value, element ) {
|
54 |
+
// Strip out all spaces, periods, dashes, parentheses, and plus signs
|
55 |
+
value = value.replace( /[\+\s\(\)\.\-\ ]/g, '' );
|
56 |
|
57 |
+
return this.optional( element ) || value.length > 9 &&
|
58 |
+
value.match( /^((\+)?[1-9]{1,2})?([-\s\.])?((\(\d{1,4}\))|\d{1,4})(([-\s\.])?[0-9]{1,12}){1,2}$/ );
|
59 |
|
60 |
+
},
|
61 |
+
$.validator.messages.phone
|
62 |
+
);
|
63 |
+
}
|
64 |
+
);
|
public/class-confirmation.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Handles form confirmation actions
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Confirmation {
|
7 |
|
8 |
/**
|
9 |
-
*
|
10 |
*
|
11 |
-
* @var
|
12 |
* @access public
|
13 |
*/
|
14 |
public $form_id;
|
15 |
|
16 |
/**
|
17 |
-
* __construct
|
18 |
*
|
19 |
-
* @
|
20 |
-
*
|
|
|
21 |
*/
|
22 |
public function __construct( $form_id ) {
|
23 |
$this->form_id = $form_id;
|
@@ -26,50 +26,46 @@ class Visual_Form_Builder_Confirmation {
|
|
26 |
/**
|
27 |
* Text message confirmation
|
28 |
*
|
29 |
-
* @
|
30 |
-
* @param mixed $message
|
31 |
-
* @return void
|
32 |
*/
|
33 |
public function text() {
|
34 |
$data = $this->get_settings();
|
35 |
|
36 |
-
$type
|
37 |
-
$message
|
38 |
|
39 |
-
if ( 'text' !== $type )
|
40 |
return;
|
|
|
41 |
|
42 |
return $message;
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
-
*
|
47 |
*
|
48 |
-
* @access public
|
49 |
-
* @param mixed $page
|
50 |
* @return void
|
51 |
*/
|
52 |
public function wp_page() {
|
53 |
$data = $this->get_settings();
|
54 |
|
55 |
-
$type
|
56 |
-
$page
|
57 |
|
58 |
-
if ( 'page' !== $type )
|
59 |
return;
|
|
|
60 |
|
61 |
$permalink = get_permalink( $page );
|
62 |
-
|
63 |
|
64 |
exit();
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
*
|
69 |
*
|
70 |
-
* @
|
71 |
-
* @param mixed $url
|
72 |
-
* @return void
|
73 |
*/
|
74 |
public function redirect() {
|
75 |
$data = $this->get_settings();
|
@@ -77,10 +73,11 @@ class Visual_Form_Builder_Confirmation {
|
|
77 |
$type = isset( $data['form_success_type'] ) ? $data['form_success_type'] : 'text';
|
78 |
$redirect = isset( $data['form_success_message'] ) ? $data['form_success_message'] : '';
|
79 |
|
80 |
-
if ( 'redirect' !== $type )
|
81 |
return;
|
|
|
82 |
|
83 |
-
|
84 |
|
85 |
exit();
|
86 |
}
|
@@ -95,16 +92,16 @@ class Visual_Form_Builder_Confirmation {
|
|
95 |
global $wpdb;
|
96 |
|
97 |
$form_id = $this->get_form_id();
|
98 |
-
if (
|
99 |
return;
|
|
|
100 |
|
101 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
102 |
-
$form = $wpdb->get_row( $wpdb->prepare(
|
103 |
|
104 |
-
if ( $form
|
105 |
return $form;
|
106 |
-
}
|
107 |
-
else {
|
108 |
return false;
|
109 |
}
|
110 |
}
|
@@ -117,14 +114,16 @@ class Visual_Form_Builder_Confirmation {
|
|
117 |
*/
|
118 |
public function get_entry_id() {
|
119 |
$form_id = $this->get_form_id();
|
120 |
-
if (
|
121 |
return;
|
|
|
122 |
|
123 |
$vfbdb = new VFB_Pro_Data();
|
124 |
$settings = $vfbdb->get_form_settings( $form_id );
|
125 |
|
126 |
-
if ( !isset( $settings['data']['last-entry'] ) )
|
127 |
return 0;
|
|
|
128 |
|
129 |
return $settings['data']['last-entry'];
|
130 |
}
|
@@ -133,11 +132,12 @@ class Visual_Form_Builder_Confirmation {
|
|
133 |
* Get form ID
|
134 |
*
|
135 |
* @access private
|
136 |
-
* @return
|
137 |
*/
|
138 |
public function get_form_id() {
|
139 |
-
if ( !isset( $this->form_id ) )
|
140 |
return false;
|
|
|
141 |
|
142 |
return (int) $this->form_id;
|
143 |
}
|
@@ -149,17 +149,24 @@ class Visual_Form_Builder_Confirmation {
|
|
149 |
* @return void
|
150 |
*/
|
151 |
public function submit_check() {
|
152 |
-
// If class form ID hasn't been set, exit
|
153 |
-
if (
|
154 |
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
-
|
157 |
-
if ( !isset( $_POST['vfb-submit'] ) )
|
158 |
return;
|
|
|
159 |
|
160 |
-
// If class form ID doesn't match $_POST form ID, exit
|
161 |
-
if ( $this->get_form_id() !== absint( $_POST['form_id'] ) )
|
162 |
return;
|
|
|
163 |
|
164 |
return true;
|
165 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Handles form confirmation actions
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Confirmation {
|
6 |
|
7 |
/**
|
8 |
+
* Form
|
9 |
*
|
10 |
+
* @var mixed
|
11 |
* @access public
|
12 |
*/
|
13 |
public $form_id;
|
14 |
|
15 |
/**
|
16 |
+
* [__construct description]
|
17 |
*
|
18 |
+
* @param [type] $form_id [$form_id description].
|
19 |
+
*
|
20 |
+
* @return void
|
21 |
*/
|
22 |
public function __construct( $form_id ) {
|
23 |
$this->form_id = $form_id;
|
26 |
/**
|
27 |
* Text message confirmation
|
28 |
*
|
29 |
+
* @return [type] [return description]
|
|
|
|
|
30 |
*/
|
31 |
public function text() {
|
32 |
$data = $this->get_settings();
|
33 |
|
34 |
+
$type = isset( $data['form_success_type'] ) ? $data['form_success_type'] : 'text';
|
35 |
+
$message = isset( $data['form_success_message'] ) ? wp_unslash( html_entity_decode( wp_kses_stripslashes( $data['form_success_message'] ) ) ) : '';
|
36 |
|
37 |
+
if ( 'text' !== $type ) {
|
38 |
return;
|
39 |
+
}
|
40 |
|
41 |
return $message;
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
+
* [wp_page description]
|
46 |
*
|
|
|
|
|
47 |
* @return void
|
48 |
*/
|
49 |
public function wp_page() {
|
50 |
$data = $this->get_settings();
|
51 |
|
52 |
+
$type = isset( $data['form_success_type'] ) ? $data['form_success_type'] : 'text';
|
53 |
+
$page = isset( $data['form_success_message'] ) ? $data['form_success_message'] : '';
|
54 |
|
55 |
+
if ( 'page' !== $type ) {
|
56 |
return;
|
57 |
+
}
|
58 |
|
59 |
$permalink = get_permalink( $page );
|
60 |
+
wp_safe_redirect( esc_url_raw( $permalink ) );
|
61 |
|
62 |
exit();
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
+
* [redirect description]
|
67 |
*
|
68 |
+
* @return [type] [return description]
|
|
|
|
|
69 |
*/
|
70 |
public function redirect() {
|
71 |
$data = $this->get_settings();
|
73 |
$type = isset( $data['form_success_type'] ) ? $data['form_success_type'] : 'text';
|
74 |
$redirect = isset( $data['form_success_message'] ) ? $data['form_success_message'] : '';
|
75 |
|
76 |
+
if ( 'redirect' !== $type ) {
|
77 |
return;
|
78 |
+
}
|
79 |
|
80 |
+
wp_safe_redirect( esc_url_raw( $redirect ) );
|
81 |
|
82 |
exit();
|
83 |
}
|
92 |
global $wpdb;
|
93 |
|
94 |
$form_id = $this->get_form_id();
|
95 |
+
if ( ! $form_id ) {
|
96 |
return;
|
97 |
+
}
|
98 |
|
99 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
100 |
+
$form = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FORMS_TABLE_NAME . " WHERE form_id = %d ORDER BY $order", $form_id ), ARRAY_A );
|
101 |
|
102 |
+
if ( null !== $form ) {
|
103 |
return $form;
|
104 |
+
} else {
|
|
|
105 |
return false;
|
106 |
}
|
107 |
}
|
114 |
*/
|
115 |
public function get_entry_id() {
|
116 |
$form_id = $this->get_form_id();
|
117 |
+
if ( ! $form_id ) {
|
118 |
return;
|
119 |
+
}
|
120 |
|
121 |
$vfbdb = new VFB_Pro_Data();
|
122 |
$settings = $vfbdb->get_form_settings( $form_id );
|
123 |
|
124 |
+
if ( ! isset( $settings['data']['last-entry'] ) ) {
|
125 |
return 0;
|
126 |
+
}
|
127 |
|
128 |
return $settings['data']['last-entry'];
|
129 |
}
|
132 |
* Get form ID
|
133 |
*
|
134 |
* @access private
|
135 |
+
* @return int
|
136 |
*/
|
137 |
public function get_form_id() {
|
138 |
+
if ( ! isset( $this->form_id ) ) {
|
139 |
return false;
|
140 |
+
}
|
141 |
|
142 |
return (int) $this->form_id;
|
143 |
}
|
149 |
* @return void
|
150 |
*/
|
151 |
public function submit_check() {
|
152 |
+
// If class form ID hasn't been set, exit.
|
153 |
+
if ( ! $this->get_form_id() ) {
|
154 |
return;
|
155 |
+
}
|
156 |
+
|
157 |
+
// If form ID hasn't been submitted by $_POST, exit.
|
158 |
+
if ( ! isset( $_POST['vfb-submit'] ) ) {
|
159 |
+
return;
|
160 |
+
}
|
161 |
|
162 |
+
if ( ! isset( $_POST['form_id'] ) ) {
|
|
|
163 |
return;
|
164 |
+
}
|
165 |
|
166 |
+
// If class form ID doesn't match $_POST form ID, exit.
|
167 |
+
if ( $this->get_form_id() !== absint( $_POST['form_id'] ) ) {
|
168 |
return;
|
169 |
+
}
|
170 |
|
171 |
return true;
|
172 |
}
|
public/class-email.php
CHANGED
@@ -1,13 +1,12 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Handles the main email
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Email {
|
7 |
/**
|
8 |
-
*
|
9 |
*
|
10 |
-
* @var
|
11 |
* @access protected
|
12 |
*/
|
13 |
protected $form_id;
|
@@ -18,183 +17,184 @@ class Visual_Form_Builder_Email {
|
|
18 |
* @access public
|
19 |
* @return void
|
20 |
*/
|
21 |
-
public function __construct() {
|
22 |
-
}
|
23 |
|
24 |
/**
|
25 |
-
*
|
26 |
*
|
27 |
* @access public
|
28 |
* @return void
|
29 |
*/
|
30 |
public function email() {
|
31 |
$form_id = $this->get_form_id();
|
32 |
-
if (
|
33 |
return;
|
|
|
34 |
|
35 |
-
// Save Form ID to pass to phpmailer()
|
36 |
$this->form_id = $form_id;
|
37 |
|
38 |
-
// Main Email
|
39 |
$this->notification( $form_id );
|
40 |
|
41 |
/**
|
42 |
* Action that fires after all emails have been processed
|
43 |
*
|
44 |
* Passes the Entry ID and Form ID
|
45 |
-
*
|
46 |
*/
|
47 |
do_action( 'vfb_after_email', $form_id );
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Send out main email
|
52 |
-
*
|
53 |
-
* @
|
|
|
|
|
54 |
*/
|
55 |
public function notification( $form_id ) {
|
56 |
global $wpdb;
|
57 |
|
58 |
-
// Query to get all forms
|
59 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
60 |
-
$form
|
61 |
|
62 |
$form_settings = (object) array(
|
63 |
-
'form_title'
|
64 |
-
'form_subject'
|
65 |
-
'form_to'
|
66 |
-
'form_from'
|
67 |
-
'form_from_name'
|
68 |
-
'form_notification_setting'
|
69 |
-
'form_notification_email_name'
|
70 |
-
'form_notification_email_from'
|
71 |
-
'form_notification_subject'
|
72 |
-
'form_notification_message'
|
73 |
-
'form_notification_entry'
|
74 |
);
|
75 |
-
// Allow the form settings to be filtered (ex: return $form_settings->'form_title' = 'Hello World';)
|
76 |
$form_settings = (object) apply_filters_ref_array( 'vfb_email_form_settings', array( $form_settings, $form_id ) );
|
77 |
|
78 |
-
// Get global settings
|
79 |
-
$vfb_settings
|
80 |
|
81 |
-
// Settings - Max Upload Size
|
82 |
-
$settings_max_upload
|
83 |
|
84 |
-
// Settings - Spam word sensitivity
|
85 |
-
$settings_spam_points
|
86 |
|
87 |
-
// Sender name field ID
|
88 |
$sender = $form->form_email_from_name_override;
|
89 |
|
90 |
-
// Sender email field ID
|
91 |
$email = $form->form_email_from_override;
|
92 |
|
93 |
-
// Notifcation email field ID
|
94 |
$notify = $form->form_notification_email;
|
95 |
|
96 |
-
$reply_to_name
|
97 |
-
$reply_to_email
|
98 |
|
99 |
-
// Use field for sender name
|
100 |
-
if ( !empty( $sender ) && isset( $_POST[ 'vfb-' . $sender ] ) ) {
|
101 |
-
$form_settings->form_from_name = wp_kses_data( $_POST[ 'vfb-' . $sender ] );
|
102 |
-
$reply_to_name
|
103 |
}
|
104 |
|
105 |
-
// Use field for sender email
|
106 |
-
if ( !empty( $email ) && isset( $_POST[ 'vfb-' . $email ] ) ) {
|
107 |
-
$form_settings->form_from = sanitize_email( $_POST[ 'vfb-' . $email ] );
|
108 |
-
$reply_to_email
|
109 |
}
|
110 |
|
111 |
-
// Use field for copy email
|
112 |
-
$copy_email =
|
113 |
|
114 |
-
// Query to get all forms
|
115 |
-
$order
|
116 |
-
$fields = $wpdb->get_results( $wpdb->prepare(
|
117 |
|
118 |
-
// Setup counter for alt rows
|
119 |
$i = $points = 0;
|
120 |
|
121 |
-
// Setup HTML email vars
|
122 |
-
$header
|
123 |
$attachments = array();
|
124 |
|
125 |
-
// Prepare the beginning of the content
|
126 |
$header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
// Loop through each form field and build the body of the message
|
135 |
foreach ( $fields as $field ) {
|
136 |
-
// Handle attachments
|
137 |
-
if (
|
138 |
-
$value = ( isset( $_FILES[ 'vfb-' . $field->field_id ] ) ) ? $_FILES[ 'vfb-' . $field->field_id ] : '';
|
139 |
|
140 |
-
if ( is_array( $value) && $value['size'] > 0 ) {
|
141 |
-
// 25MB is the max size allowed
|
142 |
-
$size
|
143 |
$max_attach_size = $size * 1048576;
|
144 |
|
145 |
-
// Display error if file size has been exceeded
|
146 |
if ( $value['size'] > $max_attach_size ) {
|
147 |
-
wp_die( sprintf(
|
148 |
}
|
149 |
|
150 |
-
// Options array for the wp_handle_upload function. 'test_form' => false
|
151 |
$upload_overrides = array( 'test_form' => false );
|
152 |
|
153 |
-
// We need to include the file that runs the wp_handle_upload function
|
154 |
-
|
155 |
|
156 |
-
// Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array
|
157 |
$uploaded_file = wp_handle_upload( $value, $upload_overrides );
|
158 |
|
159 |
-
// If the wp_handle_upload call returned a local path for the image
|
160 |
if ( isset( $uploaded_file['file'] ) ) {
|
161 |
-
// Retrieve the file type from the file name. Returns an array with extension and mime type
|
162 |
$wp_filetype = wp_check_filetype( basename( $uploaded_file['file'] ), null );
|
163 |
|
164 |
-
// Return the current upload directory location
|
165 |
$wp_upload_dir = wp_upload_dir();
|
166 |
|
167 |
$media_upload = array(
|
168 |
-
'guid'
|
169 |
-
'post_mime_type'
|
170 |
-
'post_title'
|
171 |
-
'post_content'
|
172 |
-
'post_status'
|
173 |
);
|
174 |
|
175 |
-
// Insert attachment into Media Library and get attachment ID
|
176 |
$attach_id = wp_insert_attachment( $media_upload, $uploaded_file['file'] );
|
177 |
|
178 |
-
// Include the file that runs wp_generate_attachment_metadata()
|
179 |
-
|
180 |
-
|
181 |
|
182 |
-
// Setup attachment metadata
|
183 |
$attach_data = wp_generate_attachment_metadata( $attach_id, $uploaded_file['file'] );
|
184 |
|
185 |
-
// Update the attachment metadata
|
186 |
wp_update_attachment_metadata( $attach_id, $attach_data );
|
187 |
|
188 |
$attachments[ 'vfb-' . $field->field_id ] = $uploaded_file['file'];
|
189 |
|
190 |
$data[] = array(
|
191 |
-
'id'
|
192 |
-
'slug'
|
193 |
-
'name'
|
194 |
-
'type'
|
195 |
-
'options'
|
196 |
'parent_id' => $field->field_parent,
|
197 |
-
'value'
|
198 |
);
|
199 |
|
200 |
$body .= sprintf(
|
@@ -202,143 +202,134 @@ class Visual_Form_Builder_Email {
|
|
202 |
<td><strong>%1$s: </strong></td>
|
203 |
<td><a href="%2$s">%2$s</a></td>
|
204 |
</tr>' . "\n",
|
205 |
-
|
206 |
$uploaded_file['url']
|
207 |
);
|
208 |
}
|
209 |
-
}
|
210 |
-
|
211 |
-
$value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? $_POST[ 'vfb-' . $field->field_id ] : '';
|
212 |
$body .= sprintf(
|
213 |
'<tr>
|
214 |
<td><strong>%1$s: </strong></td>
|
215 |
<td>%2$s</td>
|
216 |
</tr>' . "\n",
|
217 |
-
|
218 |
$value
|
219 |
);
|
220 |
}
|
221 |
-
}
|
222 |
-
|
223 |
-
else {
|
224 |
-
$value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? $_POST[ 'vfb-' . $field->field_id ] : '';
|
225 |
|
226 |
-
// If time field, build proper output
|
227 |
-
if ( is_array( $value ) && $field->field_type
|
228 |
$value = $this->format_field( $value, $field->field_type );
|
229 |
-
|
230 |
-
|
231 |
$value = $this->format_field( $value, $field->field_type );
|
232 |
-
|
233 |
-
|
234 |
$value = $this->format_field( $value, $field->field_type );
|
235 |
-
elseif ( 'radio'
|
236 |
-
$value = wp_specialchars_decode(
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
|
241 |
-
// Spam Words - Exploits
|
242 |
$exploits = array( 'content-type', 'bcc:', 'cc:', 'document.cookie', 'onclick', 'onload', 'javascript', 'alert' );
|
243 |
$exploits = apply_filters( 'vfb_spam_words_exploits', $exploits, $form_id );
|
244 |
|
245 |
-
// Spam Words - Exploits
|
246 |
$profanity = array( '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' );
|
247 |
$profanity = apply_filters( 'vfb_spam_words_profanity', $profanity, $form_id );
|
248 |
|
249 |
-
// Spam Words - Misc
|
250 |
$spamwords = array( 'viagra', 'phentermine', 'tramadol', 'adipex', 'advai', 'alprazolam', 'ambien', 'ambian', 'amoxicillin', 'antivert', 'blackjack', 'backgammon', 'holdem', 'poker', 'carisoprodol', 'ciara', 'ciprofloxacin', 'debt', 'dating', 'porn' );
|
251 |
$spamwords = apply_filters( 'vfb_spam_words_misc', $spamwords, $form_id );
|
252 |
|
253 |
-
// Add up points for each spam hit
|
254 |
if ( preg_match( '/(' . implode( '|', $exploits ) . ')/i', $value ) ) {
|
255 |
$points += 2;
|
256 |
-
}
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
elseif ( preg_match( '/(' . implode( '|', $spamwords ) . ')/i', $value ) ) {
|
261 |
-
$points += 1;
|
262 |
}
|
263 |
|
264 |
-
//Sanitize input
|
265 |
$value = $this->sanitize_input( $value, $field->field_type );
|
266 |
-
// Validate input
|
267 |
$this->validate_input( $value, $field->field_name, $field->field_type, $field->field_required );
|
268 |
|
269 |
$removed_field_types = array( 'verification', 'secret', 'submit' );
|
270 |
|
271 |
-
// Don't add certain fields to the email
|
272 |
if ( ! in_array( $field->field_type, $removed_field_types ) ) {
|
273 |
-
if ( $field->field_type
|
274 |
$body .= sprintf(
|
275 |
'<tr style="background-color:#393E40;color:white;font-size:14px;">
|
276 |
<td colspan="2">%1$s</td>
|
277 |
</tr>' . "\n",
|
278 |
-
|
279 |
-
);
|
280 |
-
}
|
281 |
-
elseif ( $field->field_type == 'section' ) {
|
282 |
$body .= sprintf(
|
283 |
'<tr style="background-color:#6E7273;color:white;font-size:14px;">
|
284 |
<td colspan="2">%1$s</td>
|
285 |
</tr>' . "\n",
|
286 |
-
|
287 |
-
);
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
);
|
301 |
-
}
|
302 |
}
|
303 |
|
304 |
$data[] = array(
|
305 |
-
'id'
|
306 |
-
'slug'
|
307 |
-
'name'
|
308 |
-
'type'
|
309 |
-
'options'
|
310 |
'parent_id' => $field->field_parent,
|
311 |
-
'value'
|
312 |
);
|
313 |
}
|
314 |
|
315 |
-
// If the user accumulates more than 4 points, it might be spam
|
316 |
if ( $points > $settings_spam_points ) {
|
317 |
-
wp_die(
|
318 |
}
|
319 |
}
|
320 |
|
321 |
-
// Setup our entries data
|
322 |
$entry = array(
|
323 |
-
'form_id'
|
324 |
-
'data'
|
325 |
-
'subject'
|
326 |
-
'sender_name'
|
327 |
-
'sender_email'
|
328 |
-
'emails_to'
|
329 |
-
'date_submitted'
|
330 |
-
'ip_address'
|
331 |
);
|
332 |
|
333 |
-
// Settings - Disable Saving Entries
|
334 |
$settings_disable_saving = isset( $vfb_settings['disable-saving-entries'] ) ? $vfb_settings['disable-saving-entries'] : '';
|
335 |
|
336 |
-
// Insert this data into the entries table if setting is not set
|
337 |
if ( empty( $settings_disable_saving ) ) {
|
338 |
$wpdb->insert( VFB_WP_ENTRIES_TABLE_NAME, $entry );
|
339 |
}
|
340 |
|
341 |
-
// Close out the content
|
342 |
$footer .= '<tr>
|
343 |
<td class="footer" height="61" align="left" valign="middle" colspan="2">
|
344 |
<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>
|
@@ -348,25 +339,24 @@ class Visual_Form_Builder_Email {
|
|
348 |
</body>
|
349 |
</html>' . "\n";
|
350 |
|
351 |
-
// Build complete HTML email
|
352 |
$message = $header . $body . $footer;
|
353 |
|
354 |
-
// Wrap lines longer than 70 words to meet email standards
|
355 |
$message = wordwrap( $message, 70 );
|
356 |
|
357 |
-
// Decode HTML for message so it outputs properly
|
358 |
-
$notify_message = ( $form_settings->form_notification_message
|
359 |
|
360 |
-
// Initialize header filter vars
|
361 |
-
$header_from_name
|
362 |
-
$header_from
|
363 |
-
$header_content_type
|
364 |
|
365 |
-
// Either prepend the notification message to the submitted entry, or send by itself
|
366 |
-
if ( $form_settings->form_notification_entry
|
367 |
$auto_response_email = $header . $notify_message . $body . $footer;
|
368 |
-
}
|
369 |
-
else {
|
370 |
$auto_response_email = sprintf(
|
371 |
'%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',
|
372 |
$header,
|
@@ -375,138 +365,145 @@ class Visual_Form_Builder_Email {
|
|
375 |
);
|
376 |
}
|
377 |
|
|
|
|
|
378 |
|
379 |
-
//
|
380 |
-
$from_name = ( $header_from_name == '' ) ? 'WordPress' : $header_from_name;
|
381 |
-
|
382 |
-
// Use the admin_email as the From email
|
383 |
$from_email = get_option( 'admin_email' );
|
384 |
|
385 |
// Get the site domain and get rid of www.
|
386 |
-
$sitename = strtolower( $_SERVER['SERVER_NAME'] );
|
387 |
-
if ( substr( $sitename, 0, 4 )
|
388 |
$sitename = substr( $sitename, 4 );
|
|
|
389 |
|
390 |
-
// Get the domain from the admin_email
|
391 |
list( $user, $domain ) = explode( '@', $from_email );
|
392 |
|
393 |
-
// If site domain and admin_email domain match, use admin_email, otherwise a same domain email must be created
|
394 |
$from_email = ( $sitename == $domain ) ? $from_email : "wordpress@$sitename";
|
395 |
|
396 |
-
// Settings - Sender Mail Header
|
397 |
$settings_sender_header = isset( $vfb_settings['sender-mail-header'] ) ? $vfb_settings['sender-mail-header'] : $from_email;
|
398 |
|
399 |
-
// Allow Sender email to be filtered
|
400 |
$from_email = apply_filters( 'vfb_sender_mail_header', $settings_sender_header, $form_id );
|
401 |
|
402 |
$reply_to = "\"$from_name\" <$header_from>";
|
403 |
$headers[] = "Sender: $from_email";
|
404 |
$headers[] = "From: $reply_to";
|
405 |
$headers[] = "Reply-To: $reply_to";
|
406 |
-
$headers[] = "Content-Type: $header_content_type; charset=\"" . get_option('blog_charset') . "
|
407 |
|
408 |
-
$form_subject
|
409 |
$notify_subject = wp_specialchars_decode( $form_settings->form_notification_subject, ENT_QUOTES );
|
410 |
|
411 |
-
// Sanitize main emails_to
|
412 |
$emails_to = array_map( 'sanitize_email', $form_settings->form_to );
|
413 |
|
414 |
-
// Send the mail
|
415 |
foreach ( $emails_to as $email ) {
|
416 |
wp_mail( $email, $form_subject, $message, $headers, $attachments );
|
417 |
}
|
418 |
|
419 |
-
// Send auto-responder email
|
420 |
-
if ( $form_settings->form_notification_setting
|
421 |
-
$attachments = ( $form_settings->form_notification_entry
|
422 |
|
423 |
-
// Reset headers for notification email
|
424 |
-
$reply_name
|
425 |
-
$reply_email
|
426 |
-
$reply_to
|
427 |
-
$headers[]
|
428 |
-
$headers[]
|
429 |
-
$headers[]
|
430 |
-
$headers[]
|
431 |
|
432 |
-
// Send the mail
|
433 |
wp_mail( $copy_email, $notify_subject, $auto_response_email, $headers, $attachments );
|
434 |
}
|
435 |
}
|
436 |
|
437 |
/**
|
438 |
* [format_field description]
|
439 |
-
*
|
440 |
-
* @param
|
|
|
441 |
* @return [type] [description]
|
442 |
*/
|
443 |
public function format_field( $value, $type = '' ) {
|
444 |
-
|
445 |
$output = '';
|
446 |
|
447 |
-
// Basic check for type when not set
|
448 |
if ( empty( $type ) ) {
|
449 |
-
if ( is_array( $value ) && array_key_exists( 'address', $value ) )
|
450 |
$type = 'address';
|
451 |
-
elseif ( is_array( $value ) && array_key_exists( 'hour', $value ) && array_key_exists( 'min', $value ) )
|
452 |
$type = 'time';
|
453 |
-
elseif ( is_array( $value ) )
|
454 |
$type = 'checkbox';
|
455 |
-
else
|
456 |
$type = 'default';
|
|
|
457 |
}
|
458 |
|
459 |
-
// Build array'd form item output
|
460 |
-
switch( $type ) {
|
461 |
|
462 |
-
case 'time'
|
463 |
$output = ( array_key_exists( 'ampm', $value ) ) ? substr_replace( implode( ':', $value ), ' ', 5, 1 ) : implode( ':', $value );
|
464 |
-
|
465 |
|
466 |
-
case 'address'
|
467 |
-
if ( !empty( $value['address'] ) )
|
468 |
$output .= $value['address'];
|
|
|
469 |
|
470 |
-
if ( !empty( $value['address-2'] ) ) {
|
471 |
-
if ( !empty( $output ) )
|
472 |
$output .= '<br>';
|
|
|
473 |
$output .= $value['address-2'];
|
474 |
}
|
475 |
|
476 |
-
if ( !empty( $value['city'] ) ) {
|
477 |
-
if ( !empty( $output ) )
|
478 |
$output .= '<br>';
|
|
|
479 |
$output .= $value['city'];
|
480 |
}
|
481 |
-
if ( !empty( $value['state'] ) ) {
|
482 |
-
if ( !empty( $output ) && empty( $value['city'] ) )
|
483 |
$output .= '<br>';
|
484 |
-
elseif ( !empty( $output ) && !empty( $value['city'] ) )
|
485 |
$output .= ', ';
|
|
|
486 |
$output .= $value['state'];
|
487 |
}
|
488 |
-
if ( !empty( $value['zip'] ) ) {
|
489 |
-
if ( !empty( $output ) && ( empty( $value['city'] ) && empty( $value['state'] ) ) )
|
490 |
$output .= '<br>';
|
491 |
-
elseif ( !empty( $output ) && ( !empty( $value['city'] ) || !empty( $value['state'] ) ) )
|
492 |
$output .= ' ';
|
|
|
493 |
$output .= $value['zip'];
|
494 |
}
|
495 |
-
if ( !empty( $value['country'] ) ) {
|
496 |
-
if ( !empty( $output ) )
|
497 |
$output .= '<br>';
|
|
|
498 |
$output .= $value['country'];
|
499 |
}
|
500 |
|
501 |
-
|
502 |
|
503 |
-
case 'checkbox'
|
504 |
$output = esc_html( implode( ', ', $value ) );
|
505 |
-
|
506 |
|
507 |
-
default
|
508 |
-
$output = wp_specialchars_decode(
|
509 |
-
|
510 |
}
|
511 |
|
512 |
return $output;
|
@@ -515,96 +512,96 @@ class Visual_Form_Builder_Email {
|
|
515 |
/**
|
516 |
* Validate the input
|
517 |
*
|
518 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
519 |
*/
|
520 |
public function validate_input( $data, $name, $type, $required ) {
|
521 |
-
|
522 |
-
|
523 |
-
wp_die( "<h1>$name</h1><br>" . __( 'This field is required and cannot be empty.', 'visual-form-builder' ), $name, array( 'back_link' => true ) );
|
524 |
}
|
525 |
|
526 |
if ( strlen( $data ) > 0 ) {
|
527 |
-
switch( $type ) {
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
wp_die( "<h1>$name</h1><br>" . __( 'Not a valid email address', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
532 |
}
|
533 |
|
534 |
break;
|
535 |
|
536 |
-
case 'number'
|
537 |
-
case 'currency'
|
538 |
-
if ( !is_numeric( $data ) ) {
|
539 |
-
wp_die( "<h1>$name</h1><br>" .
|
540 |
}
|
541 |
|
542 |
break;
|
543 |
|
544 |
-
case 'phone'
|
545 |
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 ) ) {
|
546 |
return true;
|
547 |
-
}
|
548 |
-
|
549 |
-
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 ) );
|
550 |
}
|
551 |
|
552 |
break;
|
553 |
|
554 |
-
case 'url'
|
555 |
-
if ( !preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $data ) ) {
|
556 |
-
wp_die( "<h1>$name</h1><br>" .
|
557 |
}
|
558 |
|
559 |
break;
|
560 |
-
|
561 |
-
default :
|
562 |
-
return true;
|
563 |
-
break;
|
564 |
-
|
565 |
}
|
|
|
|
|
566 |
}
|
567 |
}
|
568 |
|
569 |
/**
|
570 |
* Sanitize the input
|
571 |
*
|
572 |
-
* @
|
|
|
|
|
|
|
573 |
*/
|
574 |
public function sanitize_input( $data, $type ) {
|
575 |
if ( strlen( $data ) > 0 ) {
|
576 |
-
switch( $type ) {
|
577 |
-
case 'text'
|
578 |
return sanitize_text_field( $data );
|
579 |
-
|
580 |
|
581 |
-
case 'textarea'
|
582 |
return wp_strip_all_tags( $data );
|
583 |
-
|
584 |
|
585 |
-
case 'email'
|
586 |
return sanitize_email( $data );
|
587 |
-
|
588 |
|
589 |
-
case 'html'
|
590 |
return wp_kses_data( force_balance_tags( $data ) );
|
591 |
-
|
592 |
|
593 |
-
case 'min'
|
594 |
-
case 'max'
|
595 |
-
case 'digits'
|
596 |
return preg_replace( '/\D/i', '', $data );
|
597 |
-
|
598 |
|
599 |
-
case 'address'
|
600 |
$allowed_html = array( 'br' => array() );
|
601 |
return wp_kses( $data, $allowed_html );
|
602 |
-
|
603 |
-
|
604 |
-
default :
|
605 |
-
return wp_kses_data( $data );
|
606 |
-
break;
|
607 |
}
|
|
|
|
|
608 |
}
|
609 |
}
|
610 |
|
@@ -612,11 +609,12 @@ class Visual_Form_Builder_Email {
|
|
612 |
* Get form ID
|
613 |
*
|
614 |
* @access private
|
615 |
-
* @return
|
616 |
*/
|
617 |
private function get_form_id() {
|
618 |
-
if ( !isset( $_POST['form_id'] ) )
|
619 |
return false;
|
|
|
620 |
|
621 |
return (int) $_POST['form_id'];
|
622 |
}
|
@@ -628,13 +626,15 @@ class Visual_Form_Builder_Email {
|
|
628 |
* @return void
|
629 |
*/
|
630 |
public function submit_check() {
|
631 |
-
// If form ID hasn't been submitted by $_POST, exit
|
632 |
-
if (
|
633 |
return;
|
|
|
634 |
|
635 |
-
// If form ID hasn't been submitted by $_POST, exit
|
636 |
-
if ( !isset( $_POST['vfb-submit'] ) )
|
637 |
return;
|
|
|
638 |
|
639 |
return true;
|
640 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Handles the main email
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Email {
|
6 |
/**
|
7 |
+
* Form_id
|
8 |
*
|
9 |
+
* @var mixed
|
10 |
* @access protected
|
11 |
*/
|
12 |
protected $form_id;
|
17 |
* @access public
|
18 |
* @return void
|
19 |
*/
|
20 |
+
public function __construct() {}
|
|
|
21 |
|
22 |
/**
|
23 |
+
* Email function.
|
24 |
*
|
25 |
* @access public
|
26 |
* @return void
|
27 |
*/
|
28 |
public function email() {
|
29 |
$form_id = $this->get_form_id();
|
30 |
+
if ( ! $form_id ) {
|
31 |
return;
|
32 |
+
}
|
33 |
|
34 |
+
// Save Form ID to pass to phpmailer().
|
35 |
$this->form_id = $form_id;
|
36 |
|
37 |
+
// Main Email.
|
38 |
$this->notification( $form_id );
|
39 |
|
40 |
/**
|
41 |
* Action that fires after all emails have been processed
|
42 |
*
|
43 |
* Passes the Entry ID and Form ID
|
|
|
44 |
*/
|
45 |
do_action( 'vfb_after_email', $form_id );
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
* Send out main email
|
50 |
+
*
|
51 |
+
* @param [type] $form_id [$form_id description].
|
52 |
+
*
|
53 |
+
* @return void
|
54 |
*/
|
55 |
public function notification( $form_id ) {
|
56 |
global $wpdb;
|
57 |
|
58 |
+
// Query to get all forms.
|
59 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
60 |
+
$form = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FORMS_TABLE_NAME . " WHERE form_id = %d ORDER BY $order", $form_id ) );
|
61 |
|
62 |
$form_settings = (object) array(
|
63 |
+
'form_title' => wp_unslash( html_entity_decode( $form->form_title, ENT_QUOTES, 'UTF-8' ) ),
|
64 |
+
'form_subject' => wp_unslash( html_entity_decode( $form->form_email_subject, ENT_QUOTES, 'UTF-8' ) ),
|
65 |
+
'form_to' => is_array( unserialize( $form->form_email_to ) ) ? unserialize( $form->form_email_to ) : explode( ',', unserialize( $form->form_email_to ) ),
|
66 |
+
'form_from' => wp_unslash( $form->form_email_from ),
|
67 |
+
'form_from_name' => wp_unslash( $form->form_email_from_name ),
|
68 |
+
'form_notification_setting' => wp_unslash( $form->form_notification_setting ),
|
69 |
+
'form_notification_email_name' => wp_unslash( $form->form_notification_email_name ),
|
70 |
+
'form_notification_email_from' => wp_unslash( $form->form_notification_email_from ),
|
71 |
+
'form_notification_subject' => wp_unslash( html_entity_decode( $form->form_notification_subject, ENT_QUOTES, 'UTF-8' ) ),
|
72 |
+
'form_notification_message' => wp_unslash( $form->form_notification_message ),
|
73 |
+
'form_notification_entry' => wp_unslash( $form->form_notification_entry ),
|
74 |
);
|
75 |
+
// Allow the form settings to be filtered (ex: return $form_settings->'form_title' = 'Hello World';).
|
76 |
$form_settings = (object) apply_filters_ref_array( 'vfb_email_form_settings', array( $form_settings, $form_id ) );
|
77 |
|
78 |
+
// Get global settings.
|
79 |
+
$vfb_settings = get_option( 'vfb-settings' );
|
80 |
|
81 |
+
// Settings - Max Upload Size.
|
82 |
+
$settings_max_upload = isset( $vfb_settings['max-upload-size'] ) ? $vfb_settings['max-upload-size'] : 25;
|
83 |
|
84 |
+
// Settings - Spam word sensitivity.
|
85 |
+
$settings_spam_points = isset( $vfb_settings['spam-points'] ) ? $vfb_settings['spam-points'] : 4;
|
86 |
|
87 |
+
// Sender name field ID.
|
88 |
$sender = $form->form_email_from_name_override;
|
89 |
|
90 |
+
// Sender email field ID.
|
91 |
$email = $form->form_email_from_override;
|
92 |
|
93 |
+
// Notifcation email field ID.
|
94 |
$notify = $form->form_notification_email;
|
95 |
|
96 |
+
$reply_to_name = $form_settings->form_from_name;
|
97 |
+
$reply_to_email = $form_settings->form_from;
|
98 |
|
99 |
+
// Use field for sender name.
|
100 |
+
if ( ! empty( $sender ) && isset( $_POST[ 'vfb-' . $sender ] ) ) {
|
101 |
+
$form_settings->form_from_name = wp_kses_data( wp_unslash( $_POST[ 'vfb-' . $sender ] ) );
|
102 |
+
$reply_to_name = $form_settings->form_from_name;
|
103 |
}
|
104 |
|
105 |
+
// Use field for sender email.
|
106 |
+
if ( ! empty( $email ) && isset( $_POST[ 'vfb-' . $email ] ) ) {
|
107 |
+
$form_settings->form_from = sanitize_email( wp_unslash( $_POST[ 'vfb-' . $email ] ) );
|
108 |
+
$reply_to_email = $form_settings->form_from;
|
109 |
}
|
110 |
|
111 |
+
// Use field for copy email.
|
112 |
+
$copy_email = ! empty( $notify ) && isset( $_POST[ 'vfb-' . $notify ] ) ? sanitize_email( wp_unslash( $_POST[ 'vfb-' . $notify ] ) ) : '';
|
113 |
|
114 |
+
// Query to get all forms.
|
115 |
+
$order = sanitize_sql_orderby( 'field_sequence ASC' );
|
116 |
+
$fields = $wpdb->get_results( $wpdb->prepare( 'SELECT field_id, field_key, field_name, field_type, field_options, field_parent, field_required FROM ' . VFB_WP_FIELDS_TABLE_NAME . " WHERE form_id = %d ORDER BY $order", $form_id ) );
|
117 |
|
118 |
+
// Setup counter for alt rows.
|
119 |
$i = $points = 0;
|
120 |
|
121 |
+
// Setup HTML email vars.
|
122 |
+
$header = $body = $message = $footer = $html_email = $auto_response_email = '';
|
123 |
$attachments = array();
|
124 |
|
125 |
+
// Prepare the beginning of the content.
|
126 |
$header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
127 |
+
<html>
|
128 |
+
<head>
|
129 |
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
130 |
+
<title>HTML Email</title>
|
131 |
+
</head>
|
132 |
+
<body><table rules="all" style="border-color: #666;" cellpadding="10">' . "\n";
|
133 |
+
|
134 |
+
// Loop through each form field and build the body of the message.
|
135 |
foreach ( $fields as $field ) {
|
136 |
+
// Handle attachments.
|
137 |
+
if ( 'file-upload' === $field->field_type ) {
|
138 |
+
$value = ( isset( $_FILES[ 'vfb-' . $field->field_id ] ) ) ? wp_unslash( $_FILES[ 'vfb-' . $field->field_id ] ) : '';
|
139 |
|
140 |
+
if ( is_array( $value ) && $value['size'] > 0 ) {
|
141 |
+
// 25MB is the max size allowed.
|
142 |
+
$size = apply_filters( 'vfb_max_file_size', $settings_max_upload );
|
143 |
$max_attach_size = $size * 1048576;
|
144 |
|
145 |
+
// Display error if file size has been exceeded.
|
146 |
if ( $value['size'] > $max_attach_size ) {
|
147 |
+
wp_die( sprintf( esc_html__( 'File size exceeds %dMB. Please decrease the file size and try again.', 'visual-form-builder' ), absint( $size ) ), '', array( 'back_link' => true ) );
|
148 |
}
|
149 |
|
150 |
+
// Options array for the wp_handle_upload function. 'test_form' => false.
|
151 |
$upload_overrides = array( 'test_form' => false );
|
152 |
|
153 |
+
// We need to include the file that runs the wp_handle_upload function.
|
154 |
+
include_once ABSPATH . 'wp-admin/includes/file.php';
|
155 |
|
156 |
+
// Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array.
|
157 |
$uploaded_file = wp_handle_upload( $value, $upload_overrides );
|
158 |
|
159 |
+
// If the wp_handle_upload call returned a local path for the image.
|
160 |
if ( isset( $uploaded_file['file'] ) ) {
|
161 |
+
// Retrieve the file type from the file name. Returns an array with extension and mime type.
|
162 |
$wp_filetype = wp_check_filetype( basename( $uploaded_file['file'] ), null );
|
163 |
|
164 |
+
// Return the current upload directory location.
|
165 |
$wp_upload_dir = wp_upload_dir();
|
166 |
|
167 |
$media_upload = array(
|
168 |
+
'guid' => $wp_upload_dir['url'] . '/' . basename( $uploaded_file['file'] ),
|
169 |
+
'post_mime_type' => $wp_filetype['type'],
|
170 |
+
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $uploaded_file['file'] ) ),
|
171 |
+
'post_content' => '',
|
172 |
+
'post_status' => 'inherit',
|
173 |
);
|
174 |
|
175 |
+
// Insert attachment into Media Library and get attachment ID.
|
176 |
$attach_id = wp_insert_attachment( $media_upload, $uploaded_file['file'] );
|
177 |
|
178 |
+
// Include the file that runs wp_generate_attachment_metadata().
|
179 |
+
include_once ABSPATH . 'wp-admin/includes/image.php';
|
180 |
+
include_once ABSPATH . 'wp-admin/includes/media.php';
|
181 |
|
182 |
+
// Setup attachment metadata.
|
183 |
$attach_data = wp_generate_attachment_metadata( $attach_id, $uploaded_file['file'] );
|
184 |
|
185 |
+
// Update the attachment metadata.
|
186 |
wp_update_attachment_metadata( $attach_id, $attach_data );
|
187 |
|
188 |
$attachments[ 'vfb-' . $field->field_id ] = $uploaded_file['file'];
|
189 |
|
190 |
$data[] = array(
|
191 |
+
'id' => $field->field_id,
|
192 |
+
'slug' => $field->field_key,
|
193 |
+
'name' => $field->field_name,
|
194 |
+
'type' => $field->field_type,
|
195 |
+
'options' => $field->field_options,
|
196 |
'parent_id' => $field->field_parent,
|
197 |
+
'value' => $uploaded_file['url'],
|
198 |
);
|
199 |
|
200 |
$body .= sprintf(
|
202 |
<td><strong>%1$s: </strong></td>
|
203 |
<td><a href="%2$s">%2$s</a></td>
|
204 |
</tr>' . "\n",
|
205 |
+
esc_html( wp_unslash( $field->field_name ) ),
|
206 |
$uploaded_file['url']
|
207 |
);
|
208 |
}
|
209 |
+
} else {
|
210 |
+
$value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'vfb-' . $field->field_id ] ) ) : '';
|
|
|
211 |
$body .= sprintf(
|
212 |
'<tr>
|
213 |
<td><strong>%1$s: </strong></td>
|
214 |
<td>%2$s</td>
|
215 |
</tr>' . "\n",
|
216 |
+
esc_html( wp_unslash( $field->field_name ) ),
|
217 |
$value
|
218 |
);
|
219 |
}
|
220 |
+
} else {
|
221 |
+
$value = ( isset( $_POST[ 'vfb-' . $field->field_id ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'vfb-' . $field->field_id ] ) ) : '';
|
|
|
|
|
222 |
|
223 |
+
// If time field, build proper output.
|
224 |
+
if ( is_array( $value ) && 'time' === $field->field_type ) {
|
225 |
$value = $this->format_field( $value, $field->field_type );
|
226 |
+
} elseif ( is_array( $value ) && 'address' === $field->field_type ) {
|
227 |
+
// If address field, build proper output.
|
228 |
$value = $this->format_field( $value, $field->field_type );
|
229 |
+
} elseif ( is_array( $value ) ) {
|
230 |
+
// If multiple values, build the list.
|
231 |
$value = $this->format_field( $value, $field->field_type );
|
232 |
+
} elseif ( 'radio' === $field->field_type ) {
|
233 |
+
$value = wp_specialchars_decode( wp_unslash( esc_html( $value ) ), ENT_QUOTES );
|
234 |
+
} else {
|
235 |
+
$value = html_entity_decode( wp_unslash( esc_html( $value ) ), ENT_QUOTES, 'UTF-8' ); // Lastly, handle single values.
|
236 |
+
}
|
237 |
|
238 |
+
// Spam Words - Exploits.
|
239 |
$exploits = array( 'content-type', 'bcc:', 'cc:', 'document.cookie', 'onclick', 'onload', 'javascript', 'alert' );
|
240 |
$exploits = apply_filters( 'vfb_spam_words_exploits', $exploits, $form_id );
|
241 |
|
242 |
+
// Spam Words - Exploits.
|
243 |
$profanity = array( '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' );
|
244 |
$profanity = apply_filters( 'vfb_spam_words_profanity', $profanity, $form_id );
|
245 |
|
246 |
+
// Spam Words - Misc.
|
247 |
$spamwords = array( 'viagra', 'phentermine', 'tramadol', 'adipex', 'advai', 'alprazolam', 'ambien', 'ambian', 'amoxicillin', 'antivert', 'blackjack', 'backgammon', 'holdem', 'poker', 'carisoprodol', 'ciara', 'ciprofloxacin', 'debt', 'dating', 'porn' );
|
248 |
$spamwords = apply_filters( 'vfb_spam_words_misc', $spamwords, $form_id );
|
249 |
|
250 |
+
// Add up points for each spam hit.
|
251 |
if ( preg_match( '/(' . implode( '|', $exploits ) . ')/i', $value ) ) {
|
252 |
$points += 2;
|
253 |
+
} elseif ( preg_match( '/(' . implode( '|', $profanity ) . ')/i', $value ) ) {
|
254 |
+
++$points;
|
255 |
+
} elseif ( preg_match( '/(' . implode( '|', $spamwords ) . ')/i', $value ) ) {
|
256 |
+
++$points;
|
|
|
|
|
257 |
}
|
258 |
|
259 |
+
// Sanitize input.
|
260 |
$value = $this->sanitize_input( $value, $field->field_type );
|
261 |
+
// Validate input.
|
262 |
$this->validate_input( $value, $field->field_name, $field->field_type, $field->field_required );
|
263 |
|
264 |
$removed_field_types = array( 'verification', 'secret', 'submit' );
|
265 |
|
266 |
+
// Don't add certain fields to the email.
|
267 |
if ( ! in_array( $field->field_type, $removed_field_types ) ) {
|
268 |
+
if ( 'fieldset' === $field->field_type ) {
|
269 |
$body .= sprintf(
|
270 |
'<tr style="background-color:#393E40;color:white;font-size:14px;">
|
271 |
<td colspan="2">%1$s</td>
|
272 |
</tr>' . "\n",
|
273 |
+
wp_unslash( $field->field_name )
|
274 |
+
); } elseif ( 'section' === $field->field_type ) {
|
|
|
|
|
275 |
$body .= sprintf(
|
276 |
'<tr style="background-color:#6E7273;color:white;font-size:14px;">
|
277 |
<td colspan="2">%1$s</td>
|
278 |
</tr>' . "\n",
|
279 |
+
wp_unslash( $field->field_name )
|
280 |
+
); } else {
|
281 |
+
// Convert new lines to break tags for textarea in html.
|
282 |
+
$display_value = ( 'textarea' == $field->field_type ) ? nl2br( $value ) : $value;
|
283 |
+
|
284 |
+
$body .= sprintf(
|
285 |
+
'<tr>
|
286 |
+
<td><strong>%1$s: </strong></td>
|
287 |
+
<td>%2$s</td>
|
288 |
+
</tr>' . "\n",
|
289 |
+
wp_unslash( $field->field_name ),
|
290 |
+
$display_value
|
291 |
+
);
|
292 |
+
}
|
|
|
|
|
293 |
}
|
294 |
|
295 |
$data[] = array(
|
296 |
+
'id' => $field->field_id,
|
297 |
+
'slug' => $field->field_key,
|
298 |
+
'name' => $field->field_name,
|
299 |
+
'type' => $field->field_type,
|
300 |
+
'options' => $field->field_options,
|
301 |
'parent_id' => $field->field_parent,
|
302 |
+
'value' => esc_html( $value ),
|
303 |
);
|
304 |
}
|
305 |
|
306 |
+
// If the user accumulates more than 4 points, it might be spam.
|
307 |
if ( $points > $settings_spam_points ) {
|
308 |
+
wp_die( esc_html__( 'Your responses look too much like spam and could not be sent at this time.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
309 |
}
|
310 |
}
|
311 |
|
312 |
+
// Setup our entries data.
|
313 |
$entry = array(
|
314 |
+
'form_id' => $form_id,
|
315 |
+
'data' => serialize( $data ),
|
316 |
+
'subject' => $form_settings->form_subject,
|
317 |
+
'sender_name' => $form_settings->form_from_name,
|
318 |
+
'sender_email' => $form_settings->form_from,
|
319 |
+
'emails_to' => serialize( $form_settings->form_to ),
|
320 |
+
'date_submitted' => date_i18n( 'Y-m-d H:i:s' ),
|
321 |
+
'ip_address' => isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '',
|
322 |
);
|
323 |
|
324 |
+
// Settings - Disable Saving Entries.
|
325 |
$settings_disable_saving = isset( $vfb_settings['disable-saving-entries'] ) ? $vfb_settings['disable-saving-entries'] : '';
|
326 |
|
327 |
+
// Insert this data into the entries table if setting is not set.
|
328 |
if ( empty( $settings_disable_saving ) ) {
|
329 |
$wpdb->insert( VFB_WP_ENTRIES_TABLE_NAME, $entry );
|
330 |
}
|
331 |
|
332 |
+
// Close out the content.
|
333 |
$footer .= '<tr>
|
334 |
<td class="footer" height="61" align="left" valign="middle" colspan="2">
|
335 |
<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>
|
339 |
</body>
|
340 |
</html>' . "\n";
|
341 |
|
342 |
+
// Build complete HTML email.
|
343 |
$message = $header . $body . $footer;
|
344 |
|
345 |
+
// Wrap lines longer than 70 words to meet email standards.
|
346 |
$message = wordwrap( $message, 70 );
|
347 |
|
348 |
+
// Decode HTML for message so it outputs properly.
|
349 |
+
$notify_message = ! empty( $form_settings->form_notification_message ) ? html_entity_decode( $form_settings->form_notification_message ) : '';
|
350 |
|
351 |
+
// Initialize header filter vars.
|
352 |
+
$header_from_name = function_exists( 'mb_encode_mimeheader' ) ? mb_encode_mimeheader( wp_unslash( $reply_to_name ) ) : wp_unslash( $reply_to_name );
|
353 |
+
$header_from = $reply_to_email;
|
354 |
+
$header_content_type = 'text/html';
|
355 |
|
356 |
+
// Either prepend the notification message to the submitted entry, or send by itself.
|
357 |
+
if ( ! empty( $form_settings->form_notification_entry ) ) {
|
358 |
$auto_response_email = $header . $notify_message . $body . $footer;
|
359 |
+
} else {
|
|
|
360 |
$auto_response_email = sprintf(
|
361 |
'%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',
|
362 |
$header,
|
365 |
);
|
366 |
}
|
367 |
|
368 |
+
// Build email headers.
|
369 |
+
$from_name = empty( $header_from_name ) ? 'WordPress' : $header_from_name;
|
370 |
|
371 |
+
// Use the admin_email as the From email.
|
|
|
|
|
|
|
372 |
$from_email = get_option( 'admin_email' );
|
373 |
|
374 |
// Get the site domain and get rid of www.
|
375 |
+
$sitename = isset( $_SERVER['SERVER_NAME'] ) ? strtolower( sanitize_text_field( wp_unslash( $_SERVER['SERVER_NAME'] ) ) ) : 'localhost';
|
376 |
+
if ( substr( $sitename, 0, 4 ) === 'www.' ) {
|
377 |
$sitename = substr( $sitename, 4 );
|
378 |
+
}
|
379 |
|
380 |
+
// Get the domain from the admin_email.
|
381 |
list( $user, $domain ) = explode( '@', $from_email );
|
382 |
|
383 |
+
// If site domain and admin_email domain match, use admin_email, otherwise a same domain email must be created.
|
384 |
$from_email = ( $sitename == $domain ) ? $from_email : "wordpress@$sitename";
|
385 |
|
386 |
+
// Settings - Sender Mail Header.
|
387 |
$settings_sender_header = isset( $vfb_settings['sender-mail-header'] ) ? $vfb_settings['sender-mail-header'] : $from_email;
|
388 |
|
389 |
+
// Allow Sender email to be filtered.
|
390 |
$from_email = apply_filters( 'vfb_sender_mail_header', $settings_sender_header, $form_id );
|
391 |
|
392 |
$reply_to = "\"$from_name\" <$header_from>";
|
393 |
$headers[] = "Sender: $from_email";
|
394 |
$headers[] = "From: $reply_to";
|
395 |
$headers[] = "Reply-To: $reply_to";
|
396 |
+
$headers[] = "Content-Type: $header_content_type; charset=\"" . get_option( 'blog_charset' ) . '"';
|
397 |
|
398 |
+
$form_subject = wp_specialchars_decode( $form_settings->form_subject, ENT_QUOTES );
|
399 |
$notify_subject = wp_specialchars_decode( $form_settings->form_notification_subject, ENT_QUOTES );
|
400 |
|
401 |
+
// Sanitize main emails_to.
|
402 |
$emails_to = array_map( 'sanitize_email', $form_settings->form_to );
|
403 |
|
404 |
+
// Send the mail.
|
405 |
foreach ( $emails_to as $email ) {
|
406 |
wp_mail( $email, $form_subject, $message, $headers, $attachments );
|
407 |
}
|
408 |
|
409 |
+
// Send auto-responder email.
|
410 |
+
if ( ! empty( $form_settings->form_notification_setting ) ) {
|
411 |
+
$attachments = ! empty( $form_settings->form_notification_entry ) ? $attachments : '';
|
412 |
|
413 |
+
// Reset headers for notification email.
|
414 |
+
$reply_name = function_exists( 'mb_encode_mimeheader' ) ? mb_encode_mimeheader( stripslashes( $form_settings->form_notification_email_name ) ) : wp_unslash( $form_settings->form_notification_email_name );
|
415 |
+
$reply_email = $form_settings->form_notification_email_from;
|
416 |
+
$reply_to = "\"$reply_name\" <$reply_email>";
|
417 |
+
$headers[] = "Sender: $from_email";
|
418 |
+
$headers[] = "From: $reply_to";
|
419 |
+
$headers[] = "Reply-To: $reply_to";
|
420 |
+
$headers[] = "Content-Type: $header_content_type; charset=\"" . get_option( 'blog_charset' ) . '"';
|
421 |
|
422 |
+
// Send the mail.
|
423 |
wp_mail( $copy_email, $notify_subject, $auto_response_email, $headers, $attachments );
|
424 |
}
|
425 |
}
|
426 |
|
427 |
/**
|
428 |
* [format_field description]
|
429 |
+
*
|
430 |
+
* @param [type] $value [description].
|
431 |
+
* @param string $type [description].
|
432 |
* @return [type] [description]
|
433 |
*/
|
434 |
public function format_field( $value, $type = '' ) {
|
|
|
435 |
$output = '';
|
436 |
|
437 |
+
// Basic check for type when not set.
|
438 |
if ( empty( $type ) ) {
|
439 |
+
if ( is_array( $value ) && array_key_exists( 'address', $value ) ) {
|
440 |
$type = 'address';
|
441 |
+
} elseif ( is_array( $value ) && array_key_exists( 'hour', $value ) && array_key_exists( 'min', $value ) ) {
|
442 |
$type = 'time';
|
443 |
+
} elseif ( is_array( $value ) ) {
|
444 |
$type = 'checkbox';
|
445 |
+
} else {
|
446 |
$type = 'default';
|
447 |
+
}
|
448 |
}
|
449 |
|
450 |
+
// Build array'd form item output.
|
451 |
+
switch ( $type ) {
|
452 |
|
453 |
+
case 'time':
|
454 |
$output = ( array_key_exists( 'ampm', $value ) ) ? substr_replace( implode( ':', $value ), ' ', 5, 1 ) : implode( ':', $value );
|
455 |
+
break;
|
456 |
|
457 |
+
case 'address':
|
458 |
+
if ( ! empty( $value['address'] ) ) {
|
459 |
$output .= $value['address'];
|
460 |
+
}
|
461 |
|
462 |
+
if ( ! empty( $value['address-2'] ) ) {
|
463 |
+
if ( ! empty( $output ) ) {
|
464 |
$output .= '<br>';
|
465 |
+
}
|
466 |
$output .= $value['address-2'];
|
467 |
}
|
468 |
|
469 |
+
if ( ! empty( $value['city'] ) ) {
|
470 |
+
if ( ! empty( $output ) ) {
|
471 |
$output .= '<br>';
|
472 |
+
}
|
473 |
$output .= $value['city'];
|
474 |
}
|
475 |
+
if ( ! empty( $value['state'] ) ) {
|
476 |
+
if ( ! empty( $output ) && empty( $value['city'] ) ) {
|
477 |
$output .= '<br>';
|
478 |
+
} elseif ( ! empty( $output ) && ! empty( $value['city'] ) ) {
|
479 |
$output .= ', ';
|
480 |
+
}
|
481 |
$output .= $value['state'];
|
482 |
}
|
483 |
+
if ( ! empty( $value['zip'] ) ) {
|
484 |
+
if ( ! empty( $output ) && ( empty( $value['city'] ) && empty( $value['state'] ) ) ) {
|
485 |
$output .= '<br>';
|
486 |
+
} elseif ( ! empty( $output ) && ( ! empty( $value['city'] ) || ! empty( $value['state'] ) ) ) {
|
487 |
$output .= ' ';
|
488 |
+
}
|
489 |
$output .= $value['zip'];
|
490 |
}
|
491 |
+
if ( ! empty( $value['country'] ) ) {
|
492 |
+
if ( ! empty( $output ) ) {
|
493 |
$output .= '<br>';
|
494 |
+
}
|
495 |
$output .= $value['country'];
|
496 |
}
|
497 |
|
498 |
+
break;
|
499 |
|
500 |
+
case 'checkbox':
|
501 |
$output = esc_html( implode( ', ', $value ) );
|
502 |
+
break;
|
503 |
|
504 |
+
default:
|
505 |
+
$output = wp_specialchars_decode( wp_unslash( esc_html( $value ) ), ENT_QUOTES );
|
506 |
+
break;
|
507 |
}
|
508 |
|
509 |
return $output;
|
512 |
/**
|
513 |
* Validate the input
|
514 |
*
|
515 |
+
* @param [type] $data [$data description].
|
516 |
+
* @param [type] $name [$name description].
|
517 |
+
* @param [type] $type [$type description].
|
518 |
+
* @param [type] $required [$required description].
|
519 |
+
*
|
520 |
+
* @return [type] [return description]
|
521 |
*/
|
522 |
public function validate_input( $data, $name, $type, $required ) {
|
523 |
+
if ( 'yes' === $required && strlen( $data ) === 0 ) {
|
524 |
+
wp_die( esc_html( "<h1>$name</h1><br>" ) . esc_html__( 'This field is required and cannot be empty.', 'visual-form-builder' ), esc_html( $name ), array( 'back_link' => true ) );
|
|
|
525 |
}
|
526 |
|
527 |
if ( strlen( $data ) > 0 ) {
|
528 |
+
switch ( $type ) {
|
529 |
+
case 'email':
|
530 |
+
if ( ! is_email( $data ) ) {
|
531 |
+
wp_die( esc_html( "<h1>$name</h1><br>" ) . esc_html__( 'Not a valid email address', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
|
|
532 |
}
|
533 |
|
534 |
break;
|
535 |
|
536 |
+
case 'number':
|
537 |
+
case 'currency':
|
538 |
+
if ( ! is_numeric( $data ) ) {
|
539 |
+
wp_die( esc_html( "<h1>$name</h1><br>" ) . esc_html__( 'Not a valid number', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
540 |
}
|
541 |
|
542 |
break;
|
543 |
|
544 |
+
case 'phone':
|
545 |
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 ) ) {
|
546 |
return true;
|
547 |
+
} else {
|
548 |
+
wp_die( esc_html( "<h1>$name</h1><br>" ) . esc_html__( 'Not a valid phone number. Most US/Canada and International formats accepted.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
|
|
549 |
}
|
550 |
|
551 |
break;
|
552 |
|
553 |
+
case 'url':
|
554 |
+
if ( ! preg_match( '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $data ) ) {
|
555 |
+
wp_die( esc_html( "<h1>$name</h1><br>" ) . esc_html__( 'Not a valid URL.', 'visual-form-builder' ), '', array( 'back_link' => true ) );
|
556 |
}
|
557 |
|
558 |
break;
|
|
|
|
|
|
|
|
|
|
|
559 |
}
|
560 |
+
|
561 |
+
return true;
|
562 |
}
|
563 |
}
|
564 |
|
565 |
/**
|
566 |
* Sanitize the input
|
567 |
*
|
568 |
+
* @param [type] $data [$data description].
|
569 |
+
* @param [type] $type [$type description].
|
570 |
+
*
|
571 |
+
* @return [type] [return description]
|
572 |
*/
|
573 |
public function sanitize_input( $data, $type ) {
|
574 |
if ( strlen( $data ) > 0 ) {
|
575 |
+
switch ( $type ) {
|
576 |
+
case 'text':
|
577 |
return sanitize_text_field( $data );
|
578 |
+
break;
|
579 |
|
580 |
+
case 'textarea':
|
581 |
return wp_strip_all_tags( $data );
|
582 |
+
break;
|
583 |
|
584 |
+
case 'email':
|
585 |
return sanitize_email( $data );
|
586 |
+
break;
|
587 |
|
588 |
+
case 'html':
|
589 |
return wp_kses_data( force_balance_tags( $data ) );
|
590 |
+
break;
|
591 |
|
592 |
+
case 'min':
|
593 |
+
case 'max':
|
594 |
+
case 'digits':
|
595 |
return preg_replace( '/\D/i', '', $data );
|
596 |
+
break;
|
597 |
|
598 |
+
case 'address':
|
599 |
$allowed_html = array( 'br' => array() );
|
600 |
return wp_kses( $data, $allowed_html );
|
601 |
+
break;
|
|
|
|
|
|
|
|
|
602 |
}
|
603 |
+
|
604 |
+
return wp_kses_data( $data );
|
605 |
}
|
606 |
}
|
607 |
|
609 |
* Get form ID
|
610 |
*
|
611 |
* @access private
|
612 |
+
* @return int
|
613 |
*/
|
614 |
private function get_form_id() {
|
615 |
+
if ( ! isset( $_POST['form_id'] ) ) {
|
616 |
return false;
|
617 |
+
}
|
618 |
|
619 |
return (int) $_POST['form_id'];
|
620 |
}
|
626 |
* @return void
|
627 |
*/
|
628 |
public function submit_check() {
|
629 |
+
// If form ID hasn't been submitted by $_POST, exit.
|
630 |
+
if ( ! $this->get_form_id() ) {
|
631 |
return;
|
632 |
+
}
|
633 |
|
634 |
+
// If form ID hasn't been submitted by $_POST, exit.
|
635 |
+
if ( ! isset( $_POST['vfb-submit'] ) ) {
|
636 |
return;
|
637 |
+
}
|
638 |
|
639 |
return true;
|
640 |
}
|
public/class-form-display.php
CHANGED
@@ -1,42 +1,38 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Outputs public VFB form
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Form_Display {
|
7 |
/**
|
8 |
* The main instanace
|
9 |
*
|
10 |
-
* @var
|
11 |
-
* @access
|
12 |
* @static
|
13 |
*/
|
14 |
private static $instance = null;
|
15 |
|
16 |
/**
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
protected function __construct() {
|
23 |
-
}
|
24 |
|
25 |
/**
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
private function __wakeup() {
|
39 |
-
}
|
40 |
|
41 |
/**
|
42 |
* Create a single instance
|
@@ -44,12 +40,12 @@ class Visual_Form_Builder_Form_Display {
|
|
44 |
* Insures that only one instance of this class is running.
|
45 |
* Otherwise known as the Singleton class pattern
|
46 |
*
|
47 |
-
* @access
|
48 |
* @static
|
49 |
*/
|
50 |
public static function instance() {
|
51 |
if ( null === self::$instance ) {
|
52 |
-
self::$instance = new Visual_Form_Builder_Form_Display;
|
53 |
|
54 |
add_shortcode( 'vfb', array( self::$instance, 'display' ) );
|
55 |
add_action( 'wp_enqueue_scripts', array( self::$instance, 'css' ) );
|
@@ -96,22 +92,22 @@ class Visual_Form_Builder_Form_Display {
|
|
96 |
public static function security_checks() {
|
97 |
$security = new Visual_Form_Builder_Security();
|
98 |
|
99 |
-
// Secret check
|
100 |
if ( true !== $security->secret_check() ) {
|
101 |
-
|
102 |
}
|
103 |
|
104 |
-
// Referer check
|
105 |
if ( true !== $security->referer_check() ) {
|
106 |
-
|
107 |
}
|
108 |
|
109 |
-
// SPAM Bot check
|
110 |
if ( true !== $security->bot_check() ) {
|
111 |
wp_die( $security->bot_check() );
|
112 |
}
|
113 |
|
114 |
-
// Honeypot check
|
115 |
if ( true !== $security->honeypot_check() ) {
|
116 |
wp_die( $security->honeypot_check() );
|
117 |
}
|
@@ -129,11 +125,12 @@ class Visual_Form_Builder_Form_Display {
|
|
129 |
public static function process_email() {
|
130 |
$email = new Visual_Form_Builder_Email();
|
131 |
|
132 |
-
// If form hasn't been submitted, exit
|
133 |
-
if ( null == $email->submit_check() )
|
134 |
return;
|
|
|
135 |
|
136 |
-
// Run security checks
|
137 |
self::security_checks();
|
138 |
|
139 |
$email->email();
|
@@ -141,54 +138,57 @@ class Visual_Form_Builder_Form_Display {
|
|
141 |
|
142 |
/**
|
143 |
* Handle the confirmation redirects
|
144 |
-
*
|
145 |
* Must be hooked into 'init' so it works properly
|
146 |
*
|
147 |
-
* @
|
148 |
-
*
|
|
|
149 |
*/
|
150 |
public static function process_redirect( $form_id ) {
|
151 |
$confirmation = new Visual_Form_Builder_Confirmation( $form_id );
|
152 |
|
153 |
-
// If form hasn't been submitted, exit
|
154 |
-
if ( null == $confirmation->submit_check() )
|
155 |
return;
|
|
|
156 |
|
157 |
-
// WP Page
|
158 |
$confirmation->wp_page();
|
159 |
|
160 |
-
// Custom URL
|
161 |
$confirmation->redirect();
|
162 |
}
|
163 |
|
164 |
/**
|
165 |
* Handle the Text message confirmation action
|
166 |
-
*
|
167 |
* Called directly from the display() function below
|
168 |
*
|
169 |
-
* @
|
170 |
-
*
|
|
|
171 |
*/
|
172 |
public static function process_confirmation( $form_id ) {
|
173 |
$confirmation = new Visual_Form_Builder_Confirmation( $form_id );
|
174 |
|
175 |
-
// If form hasn't been submitted, exit
|
176 |
-
if ( null == $confirmation->submit_check() )
|
177 |
return;
|
|
|
178 |
|
179 |
-
// Save entry ID to class instance
|
180 |
-
//self::$entry_id = $entry_id
|
181 |
$message = $confirmation->text();
|
182 |
|
183 |
return $message;
|
184 |
}
|
185 |
|
186 |
/**
|
187 |
-
* Display
|
188 |
*
|
189 |
-
* @
|
190 |
-
* @param
|
191 |
-
*
|
|
|
192 |
*/
|
193 |
public static function display( $atts, $output = '' ) {
|
194 |
wp_enqueue_script( 'jquery-form-validation' );
|
@@ -206,10 +206,10 @@ class Visual_Form_Builder_Form_Display {
|
|
206 |
|
207 |
$form_id = absint( $atts['id'] );
|
208 |
|
209 |
-
// Text confirmation
|
210 |
$confirm_message = self::process_confirmation( $form_id );
|
211 |
|
212 |
-
// If text message is returned, output
|
213 |
if ( null !== $confirm_message ) {
|
214 |
return $confirm_message;
|
215 |
}
|
@@ -217,20 +217,20 @@ class Visual_Form_Builder_Form_Display {
|
|
217 |
$form = self::get_form( $form_id );
|
218 |
$fields = self::get_fields( $form_id );
|
219 |
|
220 |
-
// Setup default variables
|
221 |
$count = 1;
|
222 |
$open_fieldset = $open_section = false;
|
223 |
$submit = 'Submit';
|
224 |
$verification = '';
|
225 |
|
226 |
-
$label_alignment = ( $form->form_label_alignment
|
227 |
|
228 |
-
// Start form container
|
229 |
$output .= sprintf( '<div id="vfb-form-%d" class="visual-form-builder-container">', $form_id );
|
230 |
|
231 |
$output .= sprintf(
|
232 |
'<form id="%1$s-%2$d" class="visual-form-builder %3$s %4$s" method="post" enctype="multipart/form-data">
|
233 |
-
|
234 |
esc_attr( $form->form_key ),
|
235 |
$form_id,
|
236 |
"vfb-form-$form_id",
|
@@ -239,48 +239,49 @@ class Visual_Form_Builder_Form_Display {
|
|
239 |
);
|
240 |
|
241 |
foreach ( $fields as $field ) {
|
242 |
-
$field_id
|
243 |
-
$field_type
|
244 |
-
$field_name
|
245 |
-
$required_span
|
246 |
-
$required
|
247 |
-
$validation
|
248 |
-
$css
|
249 |
-
$id_attr
|
250 |
-
$size
|
251 |
-
$layout
|
252 |
-
$default
|
253 |
-
$description
|
254 |
-
|
255 |
-
// Close each section
|
256 |
-
if ( $open_section
|
257 |
-
// If this field's parent does NOT equal our section ID
|
258 |
-
|
259 |
-
|
|
|
260 |
$open_section = false;
|
261 |
}
|
262 |
}
|
263 |
|
264 |
-
// Force an initial fieldset and display an error message to strongly encourage user to add one
|
265 |
-
if (
|
266 |
$output .= sprintf(
|
267 |
'<fieldset class="vfb-fieldset"><div class="vfb-legend" style="background-color:#FFEBE8;border:1px solid #CC0000;"><h3>%1$s</h3><p style="color:black;">%2$s</p></div><ul class="section section-%3$d">',
|
268 |
-
|
269 |
-
|
270 |
$count
|
271 |
);
|
272 |
|
273 |
$count++;
|
274 |
}
|
275 |
|
276 |
-
if (
|
277 |
-
// Close each fieldset
|
278 |
-
if ( $open_fieldset
|
279 |
$output .= '</ul> </fieldset>';
|
280 |
}
|
281 |
|
282 |
-
// Only display Legend if field name is not blank
|
283 |
-
$legend = !empty( $field_name ) ? sprintf( '<div class="vfb-legend"><h3>%s</h3></div>', $field_name ) : ' ';
|
284 |
|
285 |
$output .= sprintf(
|
286 |
'<fieldset class="vfb-fieldset vfb-fieldset-%1$d %2$s %3$s" id="item-%4$s">%5$s<ul class="vfb-section vfb-section-%1$d">',
|
@@ -293,8 +294,7 @@ class Visual_Form_Builder_Form_Display {
|
|
293 |
|
294 |
$open_fieldset = true;
|
295 |
$count++;
|
296 |
-
}
|
297 |
-
elseif ( $field_type == 'section' ) {
|
298 |
$output .= sprintf(
|
299 |
'<div id="item-%1$s" class="vfb-section-div %2$s"><h4>%3$s</h4>',
|
300 |
$id_attr,
|
@@ -302,16 +302,15 @@ class Visual_Form_Builder_Form_Display {
|
|
302 |
$field_name
|
303 |
);
|
304 |
|
305 |
-
// Save section ID for future comparison
|
306 |
-
$sec_id
|
307 |
$open_section = true;
|
308 |
-
}
|
309 |
-
|
310 |
-
$columns_choice = ( !empty( $field->field_size ) && in_array( $field_type, array( 'radio', 'checkbox' ) ) ) ? esc_attr( " vfb-$field->field_size" ) : '';
|
311 |
|
312 |
-
if (
|
313 |
-
// Don't add for attribute for certain form items
|
314 |
-
$for = !in_array( $field_type, array( 'checkbox', 'radio', 'time', 'address', 'instructions' ) ) ? ' for="%4$s"' : '';
|
315 |
|
316 |
$output .= sprintf(
|
317 |
'<li class="vfb-item vfb-item-%1$s %2$s %3$s" id="item-%4$s"><label' . $for . ' class="vfb-desc">%5$s %6$s</label>',
|
@@ -323,10 +322,9 @@ class Visual_Form_Builder_Form_Display {
|
|
323 |
$required_span
|
324 |
);
|
325 |
}
|
326 |
-
}
|
327 |
-
elseif ( in_array( $field_type, array( 'verification', 'secret' ) ) ) {
|
328 |
|
329 |
-
if (
|
330 |
$verification .= sprintf(
|
331 |
'<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">',
|
332 |
$count,
|
@@ -337,22 +335,22 @@ class Visual_Form_Builder_Form_Display {
|
|
337 |
);
|
338 |
}
|
339 |
|
340 |
-
if (
|
341 |
-
// Default logged in values
|
342 |
$logged_in_display = $logged_in_value = '';
|
343 |
|
344 |
-
// If the user is logged in, fill the field in for them
|
345 |
if ( is_user_logged_in() ) {
|
346 |
-
// Hide the secret field if logged in
|
347 |
$logged_in_display = ' style="display:none;"';
|
348 |
-
$logged_in_value
|
349 |
|
350 |
-
// Get logged in user details
|
351 |
-
$user
|
352 |
$user_identity = ! empty( $user->ID ) ? $user->display_name : '';
|
353 |
|
354 |
-
// Display a message for logged in users
|
355 |
-
$logged_in_as = sprintf(
|
356 |
|
357 |
$verification .= sprintf(
|
358 |
'<li class="vfb-item" id="%1$s">%2$s</li>',
|
@@ -370,10 +368,10 @@ class Visual_Form_Builder_Form_Display {
|
|
370 |
$required_span
|
371 |
);
|
372 |
|
373 |
-
// Set variable for testing if required is Yes/No
|
374 |
-
$verification .=
|
375 |
|
376 |
-
// Set hidden secret to matching input
|
377 |
$verification .= sprintf( '<input type="hidden" name="_vfb-secret" value="vfb-%d" />', $field_id );
|
378 |
|
379 |
$validation = '{digits:true,maxlength:2,minlength:2}';
|
@@ -389,26 +387,23 @@ class Visual_Form_Builder_Form_Display {
|
|
389 |
$css
|
390 |
);
|
391 |
|
392 |
-
$verification .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $verification_item, $description ) : $verification_item;
|
393 |
}
|
394 |
}
|
395 |
|
396 |
switch ( $field_type ) {
|
397 |
-
case 'text'
|
398 |
-
case 'email'
|
399 |
-
case 'url'
|
400 |
-
case 'currency'
|
401 |
-
case 'number'
|
402 |
-
case 'phone'
|
403 |
-
|
404 |
-
// HTML5 types
|
405 |
if ( in_array( $field_type, array( 'email', 'url' ) ) ) {
|
406 |
$type = esc_attr( $field_type );
|
407 |
-
}
|
408 |
-
elseif ( 'phone' == $field_type ) {
|
409 |
$type = 'tel';
|
410 |
-
}
|
411 |
-
else {
|
412 |
$type = 'text';
|
413 |
}
|
414 |
|
@@ -424,11 +419,11 @@ class Visual_Form_Builder_Form_Display {
|
|
424 |
$type
|
425 |
);
|
426 |
|
427 |
-
$output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
|
428 |
|
429 |
break;
|
430 |
|
431 |
-
case 'textarea'
|
432 |
$form_item = sprintf(
|
433 |
'<textarea name="vfb-%1$d" id="%2$s" class="vfb-textarea %4$s %5$s %6$s">%3$s</textarea>',
|
434 |
$field_id,
|
@@ -441,20 +436,20 @@ class Visual_Form_Builder_Form_Display {
|
|
441 |
|
442 |
$output .= '<div>';
|
443 |
|
444 |
-
$output .=
|
445 |
|
446 |
$output .= '</div>';
|
447 |
|
448 |
break;
|
449 |
|
450 |
-
case 'select'
|
451 |
$field_options = maybe_unserialize( $field->field_options );
|
452 |
|
453 |
$options = '';
|
454 |
|
455 |
-
// Loop through each option and output
|
456 |
foreach ( $field_options as $option => $value ) {
|
457 |
-
$options .= sprintf( '<option value="%1$s"%2$s>%1$s</option>', esc_attr(trim(
|
458 |
}
|
459 |
|
460 |
$form_item = sprintf(
|
@@ -467,16 +462,16 @@ class Visual_Form_Builder_Form_Display {
|
|
467 |
$options
|
468 |
);
|
469 |
|
470 |
-
$output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span"><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
471 |
|
472 |
break;
|
473 |
|
474 |
-
case 'radio'
|
475 |
$field_options = maybe_unserialize( $field->field_options );
|
476 |
|
477 |
$options = '';
|
478 |
|
479 |
-
// Loop through each option and output
|
480 |
foreach ( $field_options as $option => $value ) {
|
481 |
$option++;
|
482 |
|
@@ -487,8 +482,8 @@ class Visual_Form_Builder_Form_Display {
|
|
487 |
$option,
|
488 |
$required,
|
489 |
$css,
|
490 |
-
esc_attr( trim(
|
491 |
-
wp_specialchars_decode(
|
492 |
checked( $default, $option, 0 )
|
493 |
);
|
494 |
}
|
@@ -497,18 +492,18 @@ class Visual_Form_Builder_Form_Display {
|
|
497 |
|
498 |
$output .= '<div>';
|
499 |
|
500 |
-
$output .= ( !empty( $description ) ) ? sprintf( '<span><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
501 |
|
502 |
$output .= '<div style="clear:both"></div></div>';
|
503 |
|
504 |
break;
|
505 |
|
506 |
-
case 'checkbox'
|
507 |
$field_options = maybe_unserialize( $field->field_options );
|
508 |
|
509 |
$options = '';
|
510 |
|
511 |
-
// Loop through each option and output
|
512 |
foreach ( $field_options as $option => $value ) {
|
513 |
$options .= sprintf(
|
514 |
'<span class="vfb-span"><input type="checkbox" name="vfb-%1$d[]" id="%2$s-%3$d" value="%6$s" class="vfb-checkbox %4$s %5$s"%8$s /><label for="%2$s-%3$d" class="vfb-choice">%7$s</label></span>',
|
@@ -517,8 +512,8 @@ class Visual_Form_Builder_Form_Display {
|
|
517 |
$option,
|
518 |
$required,
|
519 |
$css,
|
520 |
-
esc_attr( trim(
|
521 |
-
wp_specialchars_decode(
|
522 |
checked( $default, ++$option, 0 )
|
523 |
);
|
524 |
}
|
@@ -527,63 +522,63 @@ class Visual_Form_Builder_Form_Display {
|
|
527 |
|
528 |
$output .= '<div>';
|
529 |
|
530 |
-
$output .= ( !empty( $description ) ) ? sprintf( '<span><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
531 |
|
532 |
$output .= '<div style="clear:both"></div></div>';
|
533 |
|
534 |
break;
|
535 |
|
536 |
-
case 'address'
|
537 |
-
// Get global settings
|
538 |
-
$vfb_settings
|
539 |
|
540 |
-
// Settings - Place Address labels above fields
|
541 |
-
$settings_address_labels
|
542 |
|
543 |
$address = '';
|
544 |
|
545 |
$address_parts = array(
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
);
|
571 |
|
572 |
$address_parts = apply_filters( 'vfb_address_labels', $address_parts, $form_id );
|
573 |
$label_placement = apply_filters( 'vfb_address_labels_placement', $settings_address_labels, $form_id );
|
574 |
|
575 |
$placement_bottom = ( $label_placement ) ? '<label for="%2$s-%4$s">%5$s</label>' : '';
|
576 |
-
$placement_top = (
|
577 |
|
578 |
foreach ( $address_parts as $parts => $part ) {
|
579 |
|
580 |
-
// Make sure the second address line is not required
|
581 |
$addr_required = ( 'address-2' !== $parts ) ? $required : '';
|
582 |
|
583 |
if ( 'country' == $parts ) {
|
584 |
|
585 |
$options = '';
|
586 |
-
$countries = include
|
587 |
foreach ( $countries as $country ) {
|
588 |
$options .= sprintf( '<option value="%1$s"%2$s>%1$s</option>', $country, selected( $default, $country, 0 ) );
|
589 |
}
|
@@ -599,8 +594,7 @@ class Visual_Form_Builder_Form_Display {
|
|
599 |
$addr_required,
|
600 |
$css
|
601 |
);
|
602 |
-
}
|
603 |
-
else {
|
604 |
$address .= sprintf(
|
605 |
'<span class="vfb-%3$s">' . $placement_top . '<input type="text" name="vfb-%1$d[%4$s]" id="%2$s-%4$s" maxlength="150" class="vfb-text vfb-medium %7$s %8$s" />' . $placement_bottom . '</span>',
|
606 |
$field_id,
|
@@ -617,19 +611,19 @@ class Visual_Form_Builder_Form_Display {
|
|
617 |
|
618 |
$output .= '<div>';
|
619 |
|
620 |
-
$output .= !empty( $description ) ? "<span class='vfb-span'><label>$description</label></span>$address" : $address;
|
621 |
|
622 |
$output .= '</div>';
|
623 |
|
624 |
break;
|
625 |
|
626 |
-
case 'date'
|
627 |
-
// Load jQuery UI datepicker library
|
628 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
629 |
wp_enqueue_script( 'vfb-datepicker-i18n' );
|
630 |
|
631 |
-
$options
|
632 |
-
$
|
633 |
|
634 |
$form_item = sprintf(
|
635 |
'<input type="text" name="vfb-%1$d" id="%2$s" value="%3$s" class="vfb-text vfb-date-picker %4$s %5$s %6$s" data-dp-dateFormat="%7$s" />',
|
@@ -639,39 +633,39 @@ class Visual_Form_Builder_Form_Display {
|
|
639 |
$size,
|
640 |
$required,
|
641 |
$css,
|
642 |
-
$
|
643 |
);
|
644 |
|
645 |
-
$output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
|
646 |
|
647 |
break;
|
648 |
|
649 |
-
case 'time'
|
650 |
$hour = $minute = $ampm = '';
|
651 |
|
652 |
-
// Get the time format (12 or 24)
|
653 |
$time_format = str_replace( 'time-', '', $validation );
|
654 |
|
655 |
-
$time_format
|
656 |
-
$total_mins
|
657 |
-
$min_interval
|
658 |
|
659 |
-
// Set whether we start with 0 or 1 and how many total hours
|
660 |
-
$hour_start =
|
661 |
-
$hour_total =
|
662 |
|
663 |
-
// Hour
|
664 |
for ( $i = $hour_start; $i <= $hour_total; $i++ ) {
|
665 |
$hour .= sprintf( '<option value="%1$02d">%1$02d</option>', $i );
|
666 |
}
|
667 |
|
668 |
-
// Minute
|
669 |
for ( $i = 0; $i <= $total_mins; $i += $min_interval ) {
|
670 |
$minute .= sprintf( '<option value="%1$02d">%1$02d</option>', $i );
|
671 |
}
|
672 |
|
673 |
-
// AM/PM
|
674 |
-
if (
|
675 |
$ampm = sprintf(
|
676 |
'<span class="vfb-time"><select name="vfb-%1$d[ampm]" id="%2$s-ampm" class="vfb-select %5$s %6$s"><option value="AM">AM</option><option value="PM">PM</option></select><label for="%2$s-ampm">AM/PM</label></span>',
|
677 |
$field_id,
|
@@ -680,7 +674,7 @@ class Visual_Form_Builder_Form_Display {
|
|
680 |
$minute,
|
681 |
$required,
|
682 |
$css
|
683 |
-
|
684 |
}
|
685 |
|
686 |
$form_item = sprintf(
|
@@ -696,13 +690,13 @@ class Visual_Form_Builder_Form_Display {
|
|
696 |
$ampm
|
697 |
);
|
698 |
|
699 |
-
$output .= ( !empty( $description ) ) ? sprintf( '<span class="vfb-span"><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
700 |
|
701 |
$output .= '<div class="clear"></div>';
|
702 |
|
703 |
break;
|
704 |
|
705 |
-
case 'html'
|
706 |
$rows = 8;
|
707 |
$size = str_replace( ' vfb-', '', $size );
|
708 |
|
@@ -729,10 +723,11 @@ class Visual_Form_Builder_Form_Display {
|
|
729 |
|
730 |
$output .= '<div>';
|
731 |
|
732 |
-
if ( !empty( $description ) )
|
733 |
$output .= sprintf( '<span class="vfb-span"><label>%1$s</label></span>', $description );
|
|
|
734 |
|
735 |
-
// Use output buffering to capture wp_editor
|
736 |
ob_start();
|
737 |
|
738 |
wp_editor( $default, 'vfb-' . $field_id, $options );
|
@@ -743,10 +738,9 @@ class Visual_Form_Builder_Form_Display {
|
|
743 |
|
744 |
break;
|
745 |
|
746 |
-
case 'file-upload'
|
747 |
$options = maybe_unserialize( $field->field_options );
|
748 |
-
$accept
|
749 |
-
|
750 |
|
751 |
$form_item = sprintf(
|
752 |
'<input type="file" name="vfb-%1$d" id="%2$s" value="%3$s" class="vfb-text %4$s %5$s %6$s %7$s %8$s" />',
|
@@ -760,21 +754,20 @@ class Visual_Form_Builder_Form_Display {
|
|
760 |
$accept
|
761 |
);
|
762 |
|
763 |
-
$output .=
|
764 |
|
765 |
break;
|
766 |
|
767 |
-
case 'instructions'
|
768 |
-
|
769 |
-
$output .= wp_specialchars_decode( esc_html( stripslashes( $description ) ), ENT_QUOTES );
|
770 |
|
771 |
break;
|
772 |
|
773 |
-
case 'submit'
|
774 |
$submit = sprintf(
|
775 |
'<li class="vfb-item vfb-item-submit" id="item-%2$s">
|
776 |
-
|
777 |
-
|
778 |
$field_id,
|
779 |
$id_attr,
|
780 |
wp_specialchars_decode( esc_html( $field_name ), ENT_QUOTES ),
|
@@ -787,14 +780,14 @@ class Visual_Form_Builder_Form_Display {
|
|
787 |
echo '';
|
788 |
}
|
789 |
|
790 |
-
// Closing </li
|
791 |
-
$output .=
|
792 |
}
|
793 |
|
794 |
-
// Close user-added fields
|
795 |
$output .= '</ul> </fieldset>';
|
796 |
|
797 |
-
// Make sure the verification displays even if they have not updated their form
|
798 |
if ( empty( $verification ) ) {
|
799 |
$verification = sprintf(
|
800 |
'<fieldset class="vfb-fieldset vfb-verification" style="display:block">
|
@@ -804,31 +797,31 @@ class Visual_Form_Builder_Form_Display {
|
|
804 |
<label for="vfb-secret" class="vfb-desc">%3$s<span>*</span></label>
|
805 |
<div><input type="text" name="vfb-secret" id="vfb-secret" class="vfb-text vfb-medium" style="display:block" /></div>
|
806 |
</li>',
|
807 |
-
|
808 |
$count,
|
809 |
-
|
810 |
);
|
811 |
}
|
812 |
|
813 |
-
// Output our security test
|
814 |
$output .= sprintf(
|
815 |
$verification .
|
816 |
'<li style="display:none;"><label>%1$s:</label><div><input name="vfb-spam" /></div></li>
|
817 |
%2$s</ul>
|
818 |
</fieldset>',
|
819 |
-
|
820 |
$submit
|
821 |
);
|
822 |
|
823 |
$output .= wp_referer_field( false );
|
824 |
|
825 |
-
// Close the form out
|
826 |
$output .= '</form>';
|
827 |
|
828 |
-
// Close form container
|
829 |
$output .= '</div> <!-- .visual-form-builder-container -->';
|
830 |
|
831 |
-
// Force tags to balance
|
832 |
force_balance_tags( $output );
|
833 |
|
834 |
return $output;
|
@@ -836,34 +829,38 @@ class Visual_Form_Builder_Form_Display {
|
|
836 |
|
837 |
/**
|
838 |
* [get_form description]
|
839 |
-
*
|
|
|
840 |
* @return [type] [description]
|
841 |
*/
|
842 |
public static function get_form( $form_id ) {
|
843 |
global $wpdb;
|
844 |
|
845 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
846 |
-
$form = $wpdb->get_row( $wpdb->prepare(
|
847 |
|
848 |
-
if (
|
849 |
return;
|
|
|
850 |
|
851 |
return $form;
|
852 |
}
|
853 |
|
854 |
/**
|
855 |
* [get_fields description]
|
856 |
-
*
|
|
|
857 |
* @return [type] [description]
|
858 |
*/
|
859 |
public static function get_fields( $form_id ) {
|
860 |
global $wpdb;
|
861 |
|
862 |
$order_fields = sanitize_sql_orderby( 'field_sequence ASC' );
|
863 |
-
$fields = $wpdb->get_results( $wpdb->prepare(
|
864 |
|
865 |
-
if (
|
866 |
return;
|
|
|
867 |
|
868 |
return $fields;
|
869 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Outputs public VFB form
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Form_Display {
|
6 |
/**
|
7 |
* The main instanace
|
8 |
*
|
9 |
+
* @var mixed
|
10 |
+
* @access private
|
11 |
* @static
|
12 |
*/
|
13 |
private static $instance = null;
|
14 |
|
15 |
/**
|
16 |
+
* Protected constructor to prevent creating a new instance
|
17 |
+
* via the 'new' operator from outside of this class.
|
18 |
+
*
|
19 |
+
* @return void
|
20 |
+
*/
|
21 |
+
protected function __construct() {}
|
|
|
22 |
|
23 |
/**
|
24 |
+
* Private clone method to prevent cloning of the instance.
|
25 |
+
*
|
26 |
+
* @return void
|
27 |
+
*/
|
28 |
+
private function __clone() {}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Private unserialize method to prevent unserializing of the instance.
|
32 |
+
*
|
33 |
+
* @return void
|
34 |
+
*/
|
35 |
+
private function __wakeup() {}
|
|
|
|
|
36 |
|
37 |
/**
|
38 |
* Create a single instance
|
40 |
* Insures that only one instance of this class is running.
|
41 |
* Otherwise known as the Singleton class pattern
|
42 |
*
|
43 |
+
* @access public
|
44 |
* @static
|
45 |
*/
|
46 |
public static function instance() {
|
47 |
if ( null === self::$instance ) {
|
48 |
+
self::$instance = new Visual_Form_Builder_Form_Display();
|
49 |
|
50 |
add_shortcode( 'vfb', array( self::$instance, 'display' ) );
|
51 |
add_action( 'wp_enqueue_scripts', array( self::$instance, 'css' ) );
|
92 |
public static function security_checks() {
|
93 |
$security = new Visual_Form_Builder_Security();
|
94 |
|
95 |
+
// Secret check.
|
96 |
if ( true !== $security->secret_check() ) {
|
97 |
+
wp_die( $security->secret_check() );
|
98 |
}
|
99 |
|
100 |
+
// Referer check.
|
101 |
if ( true !== $security->referer_check() ) {
|
102 |
+
wp_die( $security->referer_check() );
|
103 |
}
|
104 |
|
105 |
+
// SPAM Bot check.
|
106 |
if ( true !== $security->bot_check() ) {
|
107 |
wp_die( $security->bot_check() );
|
108 |
}
|
109 |
|
110 |
+
// Honeypot check.
|
111 |
if ( true !== $security->honeypot_check() ) {
|
112 |
wp_die( $security->honeypot_check() );
|
113 |
}
|
125 |
public static function process_email() {
|
126 |
$email = new Visual_Form_Builder_Email();
|
127 |
|
128 |
+
// If form hasn't been submitted, exit.
|
129 |
+
if ( null == $email->submit_check() ) {
|
130 |
return;
|
131 |
+
}
|
132 |
|
133 |
+
// Run security checks.
|
134 |
self::security_checks();
|
135 |
|
136 |
$email->email();
|
138 |
|
139 |
/**
|
140 |
* Handle the confirmation redirects
|
|
|
141 |
* Must be hooked into 'init' so it works properly
|
142 |
*
|
143 |
+
* @param [type] $form_id [$form_id description].
|
144 |
+
*
|
145 |
+
* @return [type] [return description]
|
146 |
*/
|
147 |
public static function process_redirect( $form_id ) {
|
148 |
$confirmation = new Visual_Form_Builder_Confirmation( $form_id );
|
149 |
|
150 |
+
// If form hasn't been submitted, exit.
|
151 |
+
if ( null == $confirmation->submit_check() ) {
|
152 |
return;
|
153 |
+
}
|
154 |
|
155 |
+
// WP Page.
|
156 |
$confirmation->wp_page();
|
157 |
|
158 |
+
// Custom URL.
|
159 |
$confirmation->redirect();
|
160 |
}
|
161 |
|
162 |
/**
|
163 |
* Handle the Text message confirmation action
|
|
|
164 |
* Called directly from the display() function below
|
165 |
*
|
166 |
+
* @param [type] $form_id [$form_id description].
|
167 |
+
*
|
168 |
+
* @return [type] [return description]
|
169 |
*/
|
170 |
public static function process_confirmation( $form_id ) {
|
171 |
$confirmation = new Visual_Form_Builder_Confirmation( $form_id );
|
172 |
|
173 |
+
// If form hasn't been submitted, exit.
|
174 |
+
if ( null == $confirmation->submit_check() ) {
|
175 |
return;
|
176 |
+
}
|
177 |
|
178 |
+
// Save entry ID to class instance.
|
179 |
+
// self::$entry_id = $entry_id;.
|
180 |
$message = $confirmation->text();
|
181 |
|
182 |
return $message;
|
183 |
}
|
184 |
|
185 |
/**
|
186 |
+
* Display Form
|
187 |
*
|
188 |
+
* @param [type] $atts [$atts description].
|
189 |
+
* @param [type] $output [$output description].
|
190 |
+
*
|
191 |
+
* @return [type] [return description]
|
192 |
*/
|
193 |
public static function display( $atts, $output = '' ) {
|
194 |
wp_enqueue_script( 'jquery-form-validation' );
|
206 |
|
207 |
$form_id = absint( $atts['id'] );
|
208 |
|
209 |
+
// Text confirmation.
|
210 |
$confirm_message = self::process_confirmation( $form_id );
|
211 |
|
212 |
+
// If text message is returned, output.
|
213 |
if ( null !== $confirm_message ) {
|
214 |
return $confirm_message;
|
215 |
}
|
217 |
$form = self::get_form( $form_id );
|
218 |
$fields = self::get_fields( $form_id );
|
219 |
|
220 |
+
// Setup default variables.
|
221 |
$count = 1;
|
222 |
$open_fieldset = $open_section = false;
|
223 |
$submit = 'Submit';
|
224 |
$verification = '';
|
225 |
|
226 |
+
$label_alignment = ! empty( $form->form_label_alignment ) ? esc_attr( " $form->form_label_alignment" ) : '';
|
227 |
|
228 |
+
// Start form container.
|
229 |
$output .= sprintf( '<div id="vfb-form-%d" class="visual-form-builder-container">', $form_id );
|
230 |
|
231 |
$output .= sprintf(
|
232 |
'<form id="%1$s-%2$d" class="visual-form-builder %3$s %4$s" method="post" enctype="multipart/form-data">
|
233 |
+
<input type="hidden" name="form_id" value="%5$d" />',
|
234 |
esc_attr( $form->form_key ),
|
235 |
$form_id,
|
236 |
"vfb-form-$form_id",
|
239 |
);
|
240 |
|
241 |
foreach ( $fields as $field ) {
|
242 |
+
$field_id = absint( $field->field_id );
|
243 |
+
$field_type = esc_html( $field->field_type );
|
244 |
+
$field_name = esc_html( wp_unslash( $field->field_name ) );
|
245 |
+
$required_span = ! empty( $field->field_required ) && 'yes' === $field->field_required ? ' <span class="vfb-required-asterisk">*</span>' : '';
|
246 |
+
$required = ! empty( $field->field_required ) && 'yes' === $field->field_required ? esc_attr( ' required' ) : '';
|
247 |
+
$validation = ! empty( $field->field_validation ) ? esc_attr( " $field->field_validation" ) : '';
|
248 |
+
$css = ! empty( $field->field_css ) ? esc_attr( " $field->field_css" ) : '';
|
249 |
+
$id_attr = "vfb-{$field_id}";
|
250 |
+
$size = ! empty( $field->field_size ) ? esc_attr( " vfb-$field->field_size" ) : '';
|
251 |
+
$layout = ! empty( $field->field_layout ) ? esc_attr( " vfb-$field->field_layout" ) : '';
|
252 |
+
$default = ! empty( $field->field_default ) ? wp_specialchars_decode( esc_html( wp_unslash( $field->field_default ) ), ENT_QUOTES ) : '';
|
253 |
+
$description = ! empty( $field->field_description ) ? wp_specialchars_decode( esc_html( wp_unslash( $field->field_description ) ), ENT_QUOTES ) : '';
|
254 |
+
|
255 |
+
// Close each section.
|
256 |
+
if ( true === $open_section ) {
|
257 |
+
// If this field's parent does NOT equal our section ID.
|
258 |
+
$field_parent = absint( $field->field_parent );
|
259 |
+
if ( $sec_id && $sec_id !== $field_parent ) {
|
260 |
+
$output .= '</div><div class="vfb-clear"></div>';
|
261 |
$open_section = false;
|
262 |
}
|
263 |
}
|
264 |
|
265 |
+
// Force an initial fieldset and display an error message to strongly encourage user to add one.
|
266 |
+
if ( 1 === $count && 'fieldset' !== $field_type ) {
|
267 |
$output .= sprintf(
|
268 |
'<fieldset class="vfb-fieldset"><div class="vfb-legend" style="background-color:#FFEBE8;border:1px solid #CC0000;"><h3>%1$s</h3><p style="color:black;">%2$s</p></div><ul class="section section-%3$d">',
|
269 |
+
esc_html__( 'Oops! Missing Fieldset', 'visual-form-builder' ),
|
270 |
+
esc_html__( 'If you are seeing this message, it means you need to <strong>add a Fieldset to the beginning of your form</strong>. Your form may not function or display properly without one.', 'visual-form-builder' ),
|
271 |
$count
|
272 |
);
|
273 |
|
274 |
$count++;
|
275 |
}
|
276 |
|
277 |
+
if ( 'fieldset' === $field_type ) {
|
278 |
+
// Close each fieldset.
|
279 |
+
if ( true === $open_fieldset ) {
|
280 |
$output .= '</ul> </fieldset>';
|
281 |
}
|
282 |
|
283 |
+
// Only display Legend if field name is not blank.
|
284 |
+
$legend = ! empty( $field_name ) ? sprintf( '<div class="vfb-legend"><h3>%s</h3></div>', $field_name ) : ' ';
|
285 |
|
286 |
$output .= sprintf(
|
287 |
'<fieldset class="vfb-fieldset vfb-fieldset-%1$d %2$s %3$s" id="item-%4$s">%5$s<ul class="vfb-section vfb-section-%1$d">',
|
294 |
|
295 |
$open_fieldset = true;
|
296 |
$count++;
|
297 |
+
} elseif ( 'section' === $field_type ) {
|
|
|
298 |
$output .= sprintf(
|
299 |
'<div id="item-%1$s" class="vfb-section-div %2$s"><h4>%3$s</h4>',
|
300 |
$id_attr,
|
302 |
$field_name
|
303 |
);
|
304 |
|
305 |
+
// Save section ID for future comparison.
|
306 |
+
$sec_id = $field_id;
|
307 |
$open_section = true;
|
308 |
+
} elseif ( ! in_array( $field_type, array( 'verification', 'secret', 'submit' ) ) ) {
|
309 |
+
$columns_choice = ( ! empty( $field->field_size ) && in_array( $field_type, array( 'radio', 'checkbox' ) ) ) ? esc_attr( " vfb-$field->field_size" ) : '';
|
|
|
310 |
|
311 |
+
if ( 'hidden' !== $field_type ) {
|
312 |
+
// Don't add for attribute for certain form items.
|
313 |
+
$for = ! in_array( $field_type, array( 'checkbox', 'radio', 'time', 'address', 'instructions' ) ) ? ' for="%4$s"' : '';
|
314 |
|
315 |
$output .= sprintf(
|
316 |
'<li class="vfb-item vfb-item-%1$s %2$s %3$s" id="item-%4$s"><label' . $for . ' class="vfb-desc">%5$s %6$s</label>',
|
322 |
$required_span
|
323 |
);
|
324 |
}
|
325 |
+
} elseif ( in_array( $field_type, array( 'verification', 'secret' ) ) ) {
|
|
|
326 |
|
327 |
+
if ( 'verification' === $field_type ) {
|
328 |
$verification .= sprintf(
|
329 |
'<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">',
|
330 |
$count,
|
335 |
);
|
336 |
}
|
337 |
|
338 |
+
if ( 'secret' === $field_type ) {
|
339 |
+
// Default logged in values.
|
340 |
$logged_in_display = $logged_in_value = '';
|
341 |
|
342 |
+
// If the user is logged in, fill the field in for them.
|
343 |
if ( is_user_logged_in() ) {
|
344 |
+
// Hide the secret field if logged in.
|
345 |
$logged_in_display = ' style="display:none;"';
|
346 |
+
$logged_in_value = 14;
|
347 |
|
348 |
+
// Get logged in user details.
|
349 |
+
$user = wp_get_current_user();
|
350 |
$user_identity = ! empty( $user->ID ) ? $user->display_name : '';
|
351 |
|
352 |
+
// Display a message for logged in users.
|
353 |
+
$logged_in_as = sprintf( esc_html__( 'Logged in as <a href="%1$s">%2$s</a>. Verification not required.', 'visual-form-builder' ), admin_url( 'profile.php' ), $user_identity );
|
354 |
|
355 |
$verification .= sprintf(
|
356 |
'<li class="vfb-item" id="%1$s">%2$s</li>',
|
368 |
$required_span
|
369 |
);
|
370 |
|
371 |
+
// Set variable for testing if required is Yes/No.
|
372 |
+
$verification .= empty( $required ) ? '<input type="hidden" name="_vfb-required-secret" value="0" />' : '';
|
373 |
|
374 |
+
// Set hidden secret to matching input.
|
375 |
$verification .= sprintf( '<input type="hidden" name="_vfb-secret" value="vfb-%d" />', $field_id );
|
376 |
|
377 |
$validation = '{digits:true,maxlength:2,minlength:2}';
|
387 |
$css
|
388 |
);
|
389 |
|
390 |
+
$verification .= ( ! empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $verification_item, $description ) : $verification_item;
|
391 |
}
|
392 |
}
|
393 |
|
394 |
switch ( $field_type ) {
|
395 |
+
case 'text':
|
396 |
+
case 'email':
|
397 |
+
case 'url':
|
398 |
+
case 'currency':
|
399 |
+
case 'number':
|
400 |
+
case 'phone':
|
401 |
+
// HTML5 types.
|
|
|
402 |
if ( in_array( $field_type, array( 'email', 'url' ) ) ) {
|
403 |
$type = esc_attr( $field_type );
|
404 |
+
} elseif ( 'phone' == $field_type ) {
|
|
|
405 |
$type = 'tel';
|
406 |
+
} else {
|
|
|
407 |
$type = 'text';
|
408 |
}
|
409 |
|
419 |
$type
|
420 |
);
|
421 |
|
422 |
+
$output .= ( ! empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
|
423 |
|
424 |
break;
|
425 |
|
426 |
+
case 'textarea':
|
427 |
$form_item = sprintf(
|
428 |
'<textarea name="vfb-%1$d" id="%2$s" class="vfb-textarea %4$s %5$s %6$s">%3$s</textarea>',
|
429 |
$field_id,
|
436 |
|
437 |
$output .= '<div>';
|
438 |
|
439 |
+
$output .= ! empty( $description ) ? sprintf( '<span class="vfb-span"><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
440 |
|
441 |
$output .= '</div>';
|
442 |
|
443 |
break;
|
444 |
|
445 |
+
case 'select':
|
446 |
$field_options = maybe_unserialize( $field->field_options );
|
447 |
|
448 |
$options = '';
|
449 |
|
450 |
+
// Loop through each option and output.
|
451 |
foreach ( $field_options as $option => $value ) {
|
452 |
+
$options .= sprintf( '<option value="%1$s"%2$s>%1$s</option>', esc_attr( trim( wp_unslash( $value ) ) ), selected( $default, ++$option, 0 ) );
|
453 |
}
|
454 |
|
455 |
$form_item = sprintf(
|
462 |
$options
|
463 |
);
|
464 |
|
465 |
+
$output .= ( ! empty( $description ) ) ? sprintf( '<span class="vfb-span"><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
466 |
|
467 |
break;
|
468 |
|
469 |
+
case 'radio':
|
470 |
$field_options = maybe_unserialize( $field->field_options );
|
471 |
|
472 |
$options = '';
|
473 |
|
474 |
+
// Loop through each option and output.
|
475 |
foreach ( $field_options as $option => $value ) {
|
476 |
$option++;
|
477 |
|
482 |
$option,
|
483 |
$required,
|
484 |
$css,
|
485 |
+
esc_attr( trim( wp_unslash( $value ) ) ),
|
486 |
+
wp_specialchars_decode( wp_unslash( $value ) ),
|
487 |
checked( $default, $option, 0 )
|
488 |
);
|
489 |
}
|
492 |
|
493 |
$output .= '<div>';
|
494 |
|
495 |
+
$output .= ( ! empty( $description ) ) ? sprintf( '<span><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
496 |
|
497 |
$output .= '<div style="clear:both"></div></div>';
|
498 |
|
499 |
break;
|
500 |
|
501 |
+
case 'checkbox':
|
502 |
$field_options = maybe_unserialize( $field->field_options );
|
503 |
|
504 |
$options = '';
|
505 |
|
506 |
+
// Loop through each option and output.
|
507 |
foreach ( $field_options as $option => $value ) {
|
508 |
$options .= sprintf(
|
509 |
'<span class="vfb-span"><input type="checkbox" name="vfb-%1$d[]" id="%2$s-%3$d" value="%6$s" class="vfb-checkbox %4$s %5$s"%8$s /><label for="%2$s-%3$d" class="vfb-choice">%7$s</label></span>',
|
512 |
$option,
|
513 |
$required,
|
514 |
$css,
|
515 |
+
esc_attr( trim( wp_unslash( $value ) ) ),
|
516 |
+
wp_specialchars_decode( wp_unslash( $value ) ),
|
517 |
checked( $default, ++$option, 0 )
|
518 |
);
|
519 |
}
|
522 |
|
523 |
$output .= '<div>';
|
524 |
|
525 |
+
$output .= ( ! empty( $description ) ) ? sprintf( '<span><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
526 |
|
527 |
$output .= '<div style="clear:both"></div></div>';
|
528 |
|
529 |
break;
|
530 |
|
531 |
+
case 'address':
|
532 |
+
// Get global settings.
|
533 |
+
$vfb_settings = get_option( 'vfb-settings' );
|
534 |
|
535 |
+
// Settings - Place Address labels above fields.
|
536 |
+
$settings_address_labels = isset( $vfb_settings['address-labels'] ) ? false : true;
|
537 |
|
538 |
$address = '';
|
539 |
|
540 |
$address_parts = array(
|
541 |
+
'address' => array(
|
542 |
+
'label' => esc_html__( 'Street Address', 'visual-form-builder' ),
|
543 |
+
'layout' => 'full',
|
544 |
+
),
|
545 |
+
'address-2' => array(
|
546 |
+
'label' => esc_html__( 'Apt, Suite, Bldg. (optional)', 'visual-form-builder' ),
|
547 |
+
'layout' => 'full',
|
548 |
+
),
|
549 |
+
'city' => array(
|
550 |
+
'label' => esc_html__( 'City', 'visual-form-builder' ),
|
551 |
+
'layout' => 'left',
|
552 |
+
),
|
553 |
+
'state' => array(
|
554 |
+
'label' => esc_html__( 'State / Province / Region', 'visual-form-builder' ),
|
555 |
+
'layout' => 'right',
|
556 |
+
),
|
557 |
+
'zip' => array(
|
558 |
+
'label' => esc_html__( 'Postal / Zip Code', 'visual-form-builder' ),
|
559 |
+
'layout' => 'left',
|
560 |
+
),
|
561 |
+
'country' => array(
|
562 |
+
'label' => esc_html__( 'Country', 'visual-form-builder' ),
|
563 |
+
'layout' => 'right',
|
564 |
+
),
|
565 |
);
|
566 |
|
567 |
$address_parts = apply_filters( 'vfb_address_labels', $address_parts, $form_id );
|
568 |
$label_placement = apply_filters( 'vfb_address_labels_placement', $settings_address_labels, $form_id );
|
569 |
|
570 |
$placement_bottom = ( $label_placement ) ? '<label for="%2$s-%4$s">%5$s</label>' : '';
|
571 |
+
$placement_top = ( ! $label_placement ) ? '<label for="%2$s-%4$s">%5$s</label>' : '';
|
572 |
|
573 |
foreach ( $address_parts as $parts => $part ) {
|
574 |
|
575 |
+
// Make sure the second address line is not required.
|
576 |
$addr_required = ( 'address-2' !== $parts ) ? $required : '';
|
577 |
|
578 |
if ( 'country' == $parts ) {
|
579 |
|
580 |
$options = '';
|
581 |
+
$countries = include VFB_WP_PLUGIN_DIR . '/inc/countries.php';
|
582 |
foreach ( $countries as $country ) {
|
583 |
$options .= sprintf( '<option value="%1$s"%2$s>%1$s</option>', $country, selected( $default, $country, 0 ) );
|
584 |
}
|
594 |
$addr_required,
|
595 |
$css
|
596 |
);
|
597 |
+
} else {
|
|
|
598 |
$address .= sprintf(
|
599 |
'<span class="vfb-%3$s">' . $placement_top . '<input type="text" name="vfb-%1$d[%4$s]" id="%2$s-%4$s" maxlength="150" class="vfb-text vfb-medium %7$s %8$s" />' . $placement_bottom . '</span>',
|
600 |
$field_id,
|
611 |
|
612 |
$output .= '<div>';
|
613 |
|
614 |
+
$output .= ! empty( $description ) ? "<span class='vfb-span'><label>$description</label></span>$address" : $address;
|
615 |
|
616 |
$output .= '</div>';
|
617 |
|
618 |
break;
|
619 |
|
620 |
+
case 'date':
|
621 |
+
// Load jQuery UI datepicker library.
|
622 |
wp_enqueue_script( 'jquery-ui-datepicker' );
|
623 |
wp_enqueue_script( 'vfb-datepicker-i18n' );
|
624 |
|
625 |
+
$options = maybe_unserialize( $field->field_options );
|
626 |
+
$date_format = $options ? $options['dateFormat'] : '';
|
627 |
|
628 |
$form_item = sprintf(
|
629 |
'<input type="text" name="vfb-%1$d" id="%2$s" value="%3$s" class="vfb-text vfb-date-picker %4$s %5$s %6$s" data-dp-dateFormat="%7$s" />',
|
633 |
$size,
|
634 |
$required,
|
635 |
$css,
|
636 |
+
$date_format
|
637 |
);
|
638 |
|
639 |
+
$output .= ( ! empty( $description ) ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
|
640 |
|
641 |
break;
|
642 |
|
643 |
+
case 'time':
|
644 |
$hour = $minute = $ampm = '';
|
645 |
|
646 |
+
// Get the time format (12 or 24).
|
647 |
$time_format = str_replace( 'time-', '', $validation );
|
648 |
|
649 |
+
$time_format = apply_filters( 'vfb_time_format', $time_format, $form_id );
|
650 |
+
$total_mins = apply_filters( 'vfb_time_min_total', 55, $form_id );
|
651 |
+
$min_interval = apply_filters( 'vfb_time_min_interval', 5, $form_id );
|
652 |
|
653 |
+
// Set whether we start with 0 or 1 and how many total hours.
|
654 |
+
$hour_start = '12' === $time_format ? 1 : 0;
|
655 |
+
$hour_total = '12' === $time_format ? 12 : 23;
|
656 |
|
657 |
+
// Hour.
|
658 |
for ( $i = $hour_start; $i <= $hour_total; $i++ ) {
|
659 |
$hour .= sprintf( '<option value="%1$02d">%1$02d</option>', $i );
|
660 |
}
|
661 |
|
662 |
+
// Minute.
|
663 |
for ( $i = 0; $i <= $total_mins; $i += $min_interval ) {
|
664 |
$minute .= sprintf( '<option value="%1$02d">%1$02d</option>', $i );
|
665 |
}
|
666 |
|
667 |
+
// AM/PM.
|
668 |
+
if ( '12' === $time_format ) {
|
669 |
$ampm = sprintf(
|
670 |
'<span class="vfb-time"><select name="vfb-%1$d[ampm]" id="%2$s-ampm" class="vfb-select %5$s %6$s"><option value="AM">AM</option><option value="PM">PM</option></select><label for="%2$s-ampm">AM/PM</label></span>',
|
671 |
$field_id,
|
674 |
$minute,
|
675 |
$required,
|
676 |
$css
|
677 |
+
);
|
678 |
}
|
679 |
|
680 |
$form_item = sprintf(
|
690 |
$ampm
|
691 |
);
|
692 |
|
693 |
+
$output .= ( ! empty( $description ) ) ? sprintf( '<span class="vfb-span"><label>%2$s</label></span>%1$s', $form_item, $description ) : $form_item;
|
694 |
|
695 |
$output .= '<div class="clear"></div>';
|
696 |
|
697 |
break;
|
698 |
|
699 |
+
case 'html':
|
700 |
$rows = 8;
|
701 |
$size = str_replace( ' vfb-', '', $size );
|
702 |
|
723 |
|
724 |
$output .= '<div>';
|
725 |
|
726 |
+
if ( ! empty( $description ) ) {
|
727 |
$output .= sprintf( '<span class="vfb-span"><label>%1$s</label></span>', $description );
|
728 |
+
}
|
729 |
|
730 |
+
// Use output buffering to capture wp_editor.
|
731 |
ob_start();
|
732 |
|
733 |
wp_editor( $default, 'vfb-' . $field_id, $options );
|
738 |
|
739 |
break;
|
740 |
|
741 |
+
case 'file-upload':
|
742 |
$options = maybe_unserialize( $field->field_options );
|
743 |
+
$accept = ! empty( $options[0] ) ? " {accept:'$options[0]'}" : '';
|
|
|
744 |
|
745 |
$form_item = sprintf(
|
746 |
'<input type="file" name="vfb-%1$d" id="%2$s" value="%3$s" class="vfb-text %4$s %5$s %6$s %7$s %8$s" />',
|
754 |
$accept
|
755 |
);
|
756 |
|
757 |
+
$output .= ! empty( $description ) ? sprintf( '<span class="vfb-span">%1$s<label>%2$s</label></span>', $form_item, $description ) : $form_item;
|
758 |
|
759 |
break;
|
760 |
|
761 |
+
case 'instructions':
|
762 |
+
$output .= wp_specialchars_decode( esc_html( wp_unslash( $description ) ), ENT_QUOTES );
|
|
|
763 |
|
764 |
break;
|
765 |
|
766 |
+
case 'submit':
|
767 |
$submit = sprintf(
|
768 |
'<li class="vfb-item vfb-item-submit" id="item-%2$s">
|
769 |
+
<input type="submit" name="vfb-submit" id="%2$s" value="%3$s" class="vfb-submit %4$s" />
|
770 |
+
</li>',
|
771 |
$field_id,
|
772 |
$id_attr,
|
773 |
wp_specialchars_decode( esc_html( $field_name ), ENT_QUOTES ),
|
780 |
echo '';
|
781 |
}
|
782 |
|
783 |
+
// Closing </li>.
|
784 |
+
$output .= ! in_array( $field_type, array( 'verification', 'secret', 'submit', 'fieldset', 'section' ) ) ? '</li>' : '';
|
785 |
}
|
786 |
|
787 |
+
// Close user-added fields.
|
788 |
$output .= '</ul> </fieldset>';
|
789 |
|
790 |
+
// Make sure the verification displays even if they have not updated their form.
|
791 |
if ( empty( $verification ) ) {
|
792 |
$verification = sprintf(
|
793 |
'<fieldset class="vfb-fieldset vfb-verification" style="display:block">
|
797 |
<label for="vfb-secret" class="vfb-desc">%3$s<span>*</span></label>
|
798 |
<div><input type="text" name="vfb-secret" id="vfb-secret" class="vfb-text vfb-medium" style="display:block" /></div>
|
799 |
</li>',
|
800 |
+
esc_html__( 'Verification', 'visual-form-builder' ),
|
801 |
$count,
|
802 |
+
esc_html__( 'Please enter any two digits with <strong>no</strong> spaces (Example: 12)', 'visual-form-builder' )
|
803 |
);
|
804 |
}
|
805 |
|
806 |
+
// Output our security test.
|
807 |
$output .= sprintf(
|
808 |
$verification .
|
809 |
'<li style="display:none;"><label>%1$s:</label><div><input name="vfb-spam" /></div></li>
|
810 |
%2$s</ul>
|
811 |
</fieldset>',
|
812 |
+
esc_html__( 'This box is for spam protection - <strong>please leave it blank</strong>', 'visual-form-builder' ),
|
813 |
$submit
|
814 |
);
|
815 |
|
816 |
$output .= wp_referer_field( false );
|
817 |
|
818 |
+
// Close the form out.
|
819 |
$output .= '</form>';
|
820 |
|
821 |
+
// Close form container.
|
822 |
$output .= '</div> <!-- .visual-form-builder-container -->';
|
823 |
|
824 |
+
// Force tags to balance.
|
825 |
force_balance_tags( $output );
|
826 |
|
827 |
return $output;
|
829 |
|
830 |
/**
|
831 |
* [get_form description]
|
832 |
+
*
|
833 |
+
* @param [type] $form_id [description].
|
834 |
* @return [type] [description]
|
835 |
*/
|
836 |
public static function get_form( $form_id ) {
|
837 |
global $wpdb;
|
838 |
|
839 |
$order = sanitize_sql_orderby( 'form_id DESC' );
|
840 |
+
$form = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FORMS_TABLE_NAME . " WHERE form_id = %d ORDER BY $order", $form_id ) );
|
841 |
|
842 |
+
if ( ! $form ) {
|
843 |
return;
|
844 |
+
}
|
845 |
|
846 |
return $form;
|
847 |
}
|
848 |
|
849 |
/**
|
850 |
* [get_fields description]
|
851 |
+
*
|
852 |
+
* @param [type] $form_id [description].
|
853 |
* @return [type] [description]
|
854 |
*/
|
855 |
public static function get_fields( $form_id ) {
|
856 |
global $wpdb;
|
857 |
|
858 |
$order_fields = sanitize_sql_orderby( 'field_sequence ASC' );
|
859 |
+
$fields = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . VFB_WP_FIELDS_TABLE_NAME . " WHERE form_id = %d ORDER BY $order_fields", $form_id ) );
|
860 |
|
861 |
+
if ( ! $fields ) {
|
862 |
return;
|
863 |
+
}
|
864 |
|
865 |
return $fields;
|
866 |
}
|
public/class-load-css-js.php
CHANGED
@@ -4,7 +4,6 @@
|
|
4 |
*
|
5 |
* This class should be called when the menu is added
|
6 |
* so the CSS and JS is added to ONLY our VFB pages.
|
7 |
-
*
|
8 |
*/
|
9 |
class Visual_Form_Builder_Scripts_Loader {
|
10 |
|
@@ -15,12 +14,12 @@ class Visual_Form_Builder_Scripts_Loader {
|
|
15 |
* @return void
|
16 |
*/
|
17 |
public function add_css() {
|
18 |
-
wp_register_style( 'vfb-jqueryui-css', apply_filters( 'vfb-date-picker-css', VFB_WP_PLUGIN_URL .
|
19 |
-
wp_register_style( 'visual-form-builder-css', apply_filters( 'visual-form-builder-css', VFB_WP_PLUGIN_URL .
|
20 |
|
21 |
$vfb_settings = get_option( 'vfb-settings' );
|
22 |
|
23 |
-
// Settings - Always load CSS
|
24 |
if ( isset( $vfb_settings['always-load-css'] ) ) {
|
25 |
wp_enqueue_style( 'visual-form-builder-css' );
|
26 |
wp_enqueue_style( 'vfb-jqueryui-css' );
|
@@ -28,26 +27,29 @@ class Visual_Form_Builder_Scripts_Loader {
|
|
28 |
return;
|
29 |
}
|
30 |
|
31 |
-
// Settings - Disable CSS
|
32 |
-
if ( isset( $vfb_settings['disable-css'] ) )
|
33 |
return;
|
|
|
34 |
|
35 |
-
// Get active widgets
|
36 |
$widget = is_active_widget( false, false, 'vfb_widget' );
|
37 |
|
38 |
-
// If no widget is found, test for shortcode
|
39 |
if ( empty( $widget ) ) {
|
40 |
-
// If WordPress 3.6, use internal function. Otherwise, my own
|
41 |
if ( function_exists( 'has_shortcode' ) ) {
|
42 |
global $post;
|
43 |
|
44 |
-
// If no post exists, exit
|
45 |
-
if (
|
46 |
return;
|
|
|
47 |
|
48 |
-
if ( !has_shortcode( $post->post_content, 'vfb' ) )
|
49 |
return;
|
50 |
-
|
|
|
51 |
return;
|
52 |
}
|
53 |
}
|
@@ -63,76 +65,74 @@ class Visual_Form_Builder_Scripts_Loader {
|
|
63 |
* @return void
|
64 |
*/
|
65 |
public function add_js() {
|
66 |
-
wp_register_script( 'jquery-form-validation', VFB_WP_PLUGIN_URL .
|
67 |
-
wp_register_script( 'visual-form-builder-validation', VFB_WP_PLUGIN_URL .
|
68 |
-
wp_register_script( 'visual-form-builder-metadata', VFB_WP_PLUGIN_URL .
|
69 |
|
70 |
$locale = get_locale();
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
// Load localized vaidation and datepicker text, if translation files exist
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
}
|
108 |
}
|
109 |
|
110 |
/**
|
111 |
* Check whether the content contains the specified shortcode
|
112 |
*
|
113 |
-
* @
|
114 |
-
*
|
115 |
-
* @return
|
116 |
*/
|
117 |
public function has_shortcode( $shortcode = '' ) {
|
118 |
-
|
119 |
$post_to_check = get_post( get_the_ID() );
|
120 |
|
121 |
-
// false because we have to search through the post content first
|
122 |
$found = false;
|
123 |
|
124 |
-
// if no short code was provided, return false
|
125 |
-
if (
|
126 |
return $found;
|
127 |
}
|
128 |
|
129 |
-
// check the post content for the short code
|
130 |
if ( stripos( $post_to_check->post_content, '[' . $shortcode ) !== false ) {
|
131 |
-
// we have found the short code
|
132 |
$found = true;
|
133 |
}
|
134 |
|
135 |
-
// return our final results
|
136 |
return $found;
|
137 |
}
|
138 |
}
|
4 |
*
|
5 |
* This class should be called when the menu is added
|
6 |
* so the CSS and JS is added to ONLY our VFB pages.
|
|
|
7 |
*/
|
8 |
class Visual_Form_Builder_Scripts_Loader {
|
9 |
|
14 |
* @return void
|
15 |
*/
|
16 |
public function add_css() {
|
17 |
+
wp_register_style( 'vfb-jqueryui-css', apply_filters( 'vfb-date-picker-css', VFB_WP_PLUGIN_URL . 'public/assets/css/smoothness/jquery-ui-1.10.3.min.css' ), array(), '2013.12.03' );
|
18 |
+
wp_register_style( 'visual-form-builder-css', apply_filters( 'visual-form-builder-css', VFB_WP_PLUGIN_URL . 'public/assets/css/visual-form-builder.min.css' ), array(), '2014.04.12' );
|
19 |
|
20 |
$vfb_settings = get_option( 'vfb-settings' );
|
21 |
|
22 |
+
// Settings - Always load CSS.
|
23 |
if ( isset( $vfb_settings['always-load-css'] ) ) {
|
24 |
wp_enqueue_style( 'visual-form-builder-css' );
|
25 |
wp_enqueue_style( 'vfb-jqueryui-css' );
|
27 |
return;
|
28 |
}
|
29 |
|
30 |
+
// Settings - Disable CSS.
|
31 |
+
if ( isset( $vfb_settings['disable-css'] ) ) {
|
32 |
return;
|
33 |
+
}
|
34 |
|
35 |
+
// Get active widgets.
|
36 |
$widget = is_active_widget( false, false, 'vfb_widget' );
|
37 |
|
38 |
+
// If no widget is found, test for shortcode.
|
39 |
if ( empty( $widget ) ) {
|
40 |
+
// If WordPress 3.6, use internal function. Otherwise, my own.
|
41 |
if ( function_exists( 'has_shortcode' ) ) {
|
42 |
global $post;
|
43 |
|
44 |
+
// If no post exists, exit.
|
45 |
+
if ( ! $post ) {
|
46 |
return;
|
47 |
+
}
|
48 |
|
49 |
+
if ( ! has_shortcode( $post->post_content, 'vfb' ) ) {
|
50 |
return;
|
51 |
+
}
|
52 |
+
} elseif ( ! $this->has_shortcode( 'vfb' ) ) {
|
53 |
return;
|
54 |
}
|
55 |
}
|
65 |
* @return void
|
66 |
*/
|
67 |
public function add_js() {
|
68 |
+
wp_register_script( 'jquery-form-validation', VFB_WP_PLUGIN_URL . 'public/assets/js/jquery.validate.min.js', array( 'jquery' ), '1.9.0', true );
|
69 |
+
wp_register_script( 'visual-form-builder-validation', VFB_WP_PLUGIN_URL . 'public/assets/js/vfb-validation.min.js', array( 'jquery', 'jquery-form-validation' ), '2014.04.12', true );
|
70 |
+
wp_register_script( 'visual-form-builder-metadata', VFB_WP_PLUGIN_URL . 'public/assets/js/jquery.metadata.js', array( 'jquery', 'jquery-form-validation' ), '2.0', true );
|
71 |
|
72 |
$locale = get_locale();
|
73 |
+
$translations = array(
|
74 |
+
'cs_CS', // Czech.
|
75 |
+
'de_DE', // German.
|
76 |
+
'el_GR', // Greek.
|
77 |
+
'en_US', // English (US).
|
78 |
+
'en_AU', // English (AU).
|
79 |
+
'en_GB', // English (GB).
|
80 |
+
'es_ES', // Spanish.
|
81 |
+
'fr_FR', // French.
|
82 |
+
'he_IL', // Hebrew.
|
83 |
+
'hu_HU', // Hungarian.
|
84 |
+
'id_ID', // Indonseian.
|
85 |
+
'it_IT', // Italian.
|
86 |
+
'ja_JP', // Japanese.
|
87 |
+
'ko_KR', // Korean.
|
88 |
+
'nl_NL', // Dutch.
|
89 |
+
'pl_PL', // Polish.
|
90 |
+
'pt_BR', // Portuguese (Brazilian).
|
91 |
+
'pt_PT', // Portuguese (European).
|
92 |
+
'ro_RO', // Romanian.
|
93 |
+
'ru_RU', // Russian.
|
94 |
+
'sv_SE', // Swedish.
|
95 |
+
'tr_TR', // Turkish.
|
96 |
+
'zh_CN', // Chinese.
|
97 |
+
'zh_TW', // Chinese (Taiwan).
|
98 |
+
);
|
99 |
+
|
100 |
+
// Load localized vaidation and datepicker text, if translation files exist.
|
101 |
+
if ( in_array( $locale, $translations ) ) {
|
102 |
+
wp_register_script( 'vfb-validation-i18n', VFB_WP_PLUGIN_URL . "public/assets/js/i18n/validate/messages-$locale.js", array( 'jquery-form-validation' ), '1.9.0', true );
|
103 |
+
wp_register_script( 'vfb-datepicker-i18n', VFB_WP_PLUGIN_URL . "public/assets/js/i18n/datepicker/datepicker-$locale.js", array( 'jquery-ui-datepicker' ), '1.0', true );
|
104 |
+
} else {
|
105 |
+
// Otherwise, load English translations.
|
106 |
+
wp_register_script( 'vfb-validation-i18n', VFB_WP_PLUGIN_URL . 'public/assets/js/i18n/validate/messages-en_US.js', array( 'jquery-form-validation' ), '1.9.0', true );
|
107 |
+
wp_register_script( 'vfb-datepicker-i18n', VFB_WP_PLUGIN_URL . 'public/assets/js/i18n/datepicker/datepicker-en_US.js', array( 'jquery-ui-datepicker' ), '1.0', true );
|
108 |
+
}
|
|
|
109 |
}
|
110 |
|
111 |
/**
|
112 |
* Check whether the content contains the specified shortcode
|
113 |
*
|
114 |
+
* @param [type] $shortcode [$shortcode description].
|
115 |
+
*
|
116 |
+
* @return shortcode
|
117 |
*/
|
118 |
public function has_shortcode( $shortcode = '' ) {
|
|
|
119 |
$post_to_check = get_post( get_the_ID() );
|
120 |
|
121 |
+
// false because we have to search through the post content first.
|
122 |
$found = false;
|
123 |
|
124 |
+
// if no short code was provided, return false.
|
125 |
+
if ( ! $shortcode ) {
|
126 |
return $found;
|
127 |
}
|
128 |
|
129 |
+
// check the post content for the short code.
|
130 |
if ( stripos( $post_to_check->post_content, '[' . $shortcode ) !== false ) {
|
131 |
+
// we have found the short code.
|
132 |
$found = true;
|
133 |
}
|
134 |
|
135 |
+
// return our final results.
|
136 |
return $found;
|
137 |
}
|
138 |
}
|
public/class-security.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Handles all security checks
|
4 |
-
*
|
5 |
*/
|
6 |
class Visual_Form_Builder_Security {
|
7 |
/**
|
@@ -10,39 +9,43 @@ class Visual_Form_Builder_Security {
|
|
10 |
* @access public
|
11 |
* @return void
|
12 |
*/
|
13 |
-
public function __construct() {
|
14 |
-
}
|
15 |
|
16 |
/**
|
17 |
-
*
|
18 |
*
|
19 |
* @access public
|
20 |
-
* @return
|
21 |
*/
|
22 |
public function honeypot_check() {
|
23 |
-
if ( !isset( $_POST['vfb-spam'] ) )
|
24 |
return true;
|
|
|
25 |
|
26 |
-
if ( isset( $_POST['vfb-spam'] ) && !empty( $_POST['vfb-spam'] ) )
|
27 |
return __( 'Security check: you filled out a form field that was created to stop spam bots and should be left blank. If you think this is an error, please email the site owner.', 'visual-form-builder' );
|
|
|
28 |
|
29 |
return true;
|
30 |
}
|
31 |
|
32 |
/**
|
33 |
-
*
|
34 |
*
|
35 |
* @access public
|
36 |
-
* @return
|
37 |
*/
|
38 |
public function secret_check() {
|
39 |
-
$required
|
40 |
-
$secret_field =
|
41 |
-
|
42 |
-
// If the verification is set to required, run validation check
|
43 |
-
if ( true
|
44 |
-
if (
|
45 |
-
|
|
|
|
|
|
|
46 |
}
|
47 |
}
|
48 |
|
@@ -51,25 +54,26 @@ class Visual_Form_Builder_Security {
|
|
51 |
|
52 |
/**
|
53 |
* [referer_check description]
|
|
|
54 |
* @return [type] [description]
|
55 |
*/
|
56 |
public function referer_check() {
|
57 |
-
$referrer
|
58 |
-
$wp_get_referer
|
59 |
-
$form_id
|
60 |
|
61 |
$skip_referrer_check = apply_filters( 'vfb_skip_referrer_check', false, $form_id );
|
62 |
|
63 |
-
// Test if referral URL has been set
|
64 |
-
if (
|
65 |
-
return
|
66 |
}
|
67 |
|
68 |
-
// Allow referrer check to be skipped
|
69 |
-
if (
|
70 |
-
// Test if the referral URL matches what sent from WordPress
|
71 |
if ( $wp_get_referer ) {
|
72 |
-
return
|
73 |
}
|
74 |
}
|
75 |
|
@@ -82,24 +86,50 @@ class Visual_Form_Builder_Security {
|
|
82 |
* Returns true if NOT a SPAM bot
|
83 |
*
|
84 |
* @access public
|
85 |
-
* @return
|
86 |
*/
|
87 |
public function bot_check() {
|
88 |
$bots = array(
|
89 |
-
'<',
|
90 |
-
'
|
91 |
-
'
|
92 |
-
'
|
93 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
);
|
95 |
|
96 |
-
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? wp_kses_data( $_SERVER['HTTP_USER_AGENT'] ) : '';
|
97 |
|
98 |
-
do_action( '
|
99 |
|
100 |
foreach ( $bots as $bot ) {
|
101 |
-
if ( stripos( $user_agent, $bot ) !== false )
|
102 |
-
return
|
|
|
103 |
}
|
104 |
|
105 |
return true;
|
1 |
<?php
|
2 |
/**
|
3 |
* Handles all security checks
|
|
|
4 |
*/
|
5 |
class Visual_Form_Builder_Security {
|
6 |
/**
|
9 |
* @access public
|
10 |
* @return void
|
11 |
*/
|
12 |
+
public function __construct() {}
|
|
|
13 |
|
14 |
/**
|
15 |
+
* Honeypot_check function.
|
16 |
*
|
17 |
* @access public
|
18 |
+
* @return true
|
19 |
*/
|
20 |
public function honeypot_check() {
|
21 |
+
if ( ! isset( $_POST['vfb-spam'] ) ) {
|
22 |
return true;
|
23 |
+
}
|
24 |
|
25 |
+
if ( isset( $_POST['vfb-spam'] ) && ! empty( $_POST['vfb-spam'] ) ) {
|
26 |
return __( 'Security check: you filled out a form field that was created to stop spam bots and should be left blank. If you think this is an error, please email the site owner.', 'visual-form-builder' );
|
27 |
+
}
|
28 |
|
29 |
return true;
|
30 |
}
|
31 |
|
32 |
/**
|
33 |
+
* Secret_check function.
|
34 |
*
|
35 |
* @access public
|
36 |
+
* @return true
|
37 |
*/
|
38 |
public function secret_check() {
|
39 |
+
$required = isset( $_POST['_vfb-required-secret'] ) && '0' === $_POST['_vfb-required-secret'] ? false : true;
|
40 |
+
$secret_field = isset( $_POST['_vfb-secret'] ) ? sanitize_text_field( wp_unslash( $_POST['_vfb-secret'] ) ) : '';
|
41 |
+
|
42 |
+
// If the verification is set to required, run validation check.
|
43 |
+
if ( true === $required && ! empty( $secret_field ) ) {
|
44 |
+
if ( isset( $_POST[ $secret_field ] ) ) {
|
45 |
+
$post_secret_field = sanitize_text_field( wp_unslash( $_POST[ $secret_field ] ) );
|
46 |
+
if ( ! is_numeric( $post_secret_field ) || strlen( $post_secret_field ) !== 2 ) {
|
47 |
+
return esc_html__( 'Security check: failed secret question. Please try again!', 'visual-form-builder' );
|
48 |
+
}
|
49 |
}
|
50 |
}
|
51 |
|
54 |
|
55 |
/**
|
56 |
* [referer_check description]
|
57 |
+
*
|
58 |
* @return [type] [description]
|
59 |
*/
|
60 |
public function referer_check() {
|
61 |
+
$referrer = isset( $_POST['_wp_http_referer'] ) ? sanitize_text_field( wp_unslash( $_POST['_wp_http_referer'] ) ) : false;
|
62 |
+
$wp_get_referer = wp_get_referer();
|
63 |
+
$form_id = isset( $_POST['form_id'] ) ? absint( $_POST['form_id'] ) : 0;
|
64 |
|
65 |
$skip_referrer_check = apply_filters( 'vfb_skip_referrer_check', false, $form_id );
|
66 |
|
67 |
+
// Test if referral URL has been set.
|
68 |
+
if ( ! $referrer ) {
|
69 |
+
return esc_html__( 'Security check: referal URL does not appear to be set.', 'visual-form-builder' );
|
70 |
}
|
71 |
|
72 |
+
// Allow referrer check to be skipped.
|
73 |
+
if ( ! $skip_referrer_check ) {
|
74 |
+
// Test if the referral URL matches what sent from WordPress.
|
75 |
if ( $wp_get_referer ) {
|
76 |
+
return esc_html__( 'Security check: referal does not match this site.', 'visual-form-builder' );
|
77 |
}
|
78 |
}
|
79 |
|
86 |
* Returns true if NOT a SPAM bot
|
87 |
*
|
88 |
* @access public
|
89 |
+
* @return true
|
90 |
*/
|
91 |
public function bot_check() {
|
92 |
$bots = array(
|
93 |
+
'<',
|
94 |
+
'>',
|
95 |
+
'<',
|
96 |
+
'%0A',
|
97 |
+
'%0D',
|
98 |
+
'%27',
|
99 |
+
'%3C',
|
100 |
+
'%3E',
|
101 |
+
'%00',
|
102 |
+
'href',
|
103 |
+
'binlar',
|
104 |
+
'casper',
|
105 |
+
'cmsworldmap',
|
106 |
+
'comodo',
|
107 |
+
'diavol',
|
108 |
+
'dotbot',
|
109 |
+
'feedfinder',
|
110 |
+
'flicky',
|
111 |
+
'ia_archiver',
|
112 |
+
'jakarta',
|
113 |
+
'kmccrew',
|
114 |
+
'nutch',
|
115 |
+
'planetwork',
|
116 |
+
'purebot',
|
117 |
+
'pycurl',
|
118 |
+
'skygrid',
|
119 |
+
'sucker',
|
120 |
+
'turnit',
|
121 |
+
'vikspider',
|
122 |
+
'zmeu',
|
123 |
);
|
124 |
|
125 |
+
$user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? wp_kses_data( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : '';
|
126 |
|
127 |
+
do_action( 'vfb_isbot', $user_agent, $bots );
|
128 |
|
129 |
foreach ( $bots as $bot ) {
|
130 |
+
if ( stripos( $user_agent, $bot ) !== false ) {
|
131 |
+
return esc_html__( 'Security check: looks like you are a SPAM bot. If you think this is an error, please email the site owner.', 'visual-form-builder' );
|
132 |
+
}
|
133 |
}
|
134 |
|
135 |
return true;
|
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: 4.7
|
6 |
Tested up to: 5.9.3
|
7 |
-
Stable tag: 3.0.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
|
@@ -203,10 +203,10 @@ Follow these instructions:
|
|
203 |
In your theme folder, create a JavaScript file. In this example, I'm using `myjs.js`. Add the following code to it and customize the language to what you need:
|
204 |
|
205 |
`jQuery(document).ready(function($) {
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
});`
|
211 |
|
212 |
Now, in your functions.php file, add the following piece of code:
|
@@ -214,10 +214,10 @@ Now, in your functions.php file, add the following piece of code:
|
|
214 |
`add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
|
215 |
function my_scripts_method() {
|
216 |
wp_register_script( 'my-vfb-validation',
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
|
222 |
wp_enqueue_script( 'my-vfb-validation' );
|
223 |
}`
|
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: 4.7
|
6 |
Tested up to: 5.9.3
|
7 |
+
Stable tag: 3.0.9
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Build beautiful, fully functional contact forms in only a few minutes without writing PHP, CSS, or HTML.
|
203 |
In your theme folder, create a JavaScript file. In this example, I'm using `myjs.js`. Add the following code to it and customize the language to what you need:
|
204 |
|
205 |
`jQuery(document).ready(function($) {
|
206 |
+
$.extend($.validator.messages, {
|
207 |
+
required: "Eingabe nötig",
|
208 |
+
email: "Bitte eine gültige E-Mail-Adresse eingeben"
|
209 |
+
});
|
210 |
});`
|
211 |
|
212 |
Now, in your functions.php file, add the following piece of code:
|
214 |
`add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
|
215 |
function my_scripts_method() {
|
216 |
wp_register_script( 'my-vfb-validation',
|
217 |
+
get_template_directory_uri() . '/js/my-js.js',
|
218 |
+
array( 'jquery', 'jquery-form-validation' ),
|
219 |
+
'1.0',
|
220 |
+
false );
|
221 |
|
222 |
wp_enqueue_script( 'my-vfb-validation' );
|
223 |
}`
|
visual-form-builder.php
CHANGED
@@ -1,41 +1,46 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name:
|
4 |
-
Plugin URI:
|
5 |
-
Description:
|
6 |
-
Version:
|
7 |
-
Author:
|
8 |
-
Author URI:
|
9 |
-
Text Domain:
|
10 |
-
Domain Path:
|
11 |
*/
|
12 |
|
13 |
// If this file is called directly, abort.
|
14 |
-
if ( ! defined( 'WPINC' ) )
|
15 |
exit;
|
|
|
16 |
|
17 |
class Visual_Form_Builder {
|
18 |
|
19 |
/**
|
20 |
* The unique identifier of this plugin.
|
|
|
21 |
* @var [type]
|
22 |
*/
|
23 |
protected $plugin_name = 'visual-form-builder';
|
24 |
|
25 |
/**
|
26 |
* The current version of the plugin.
|
|
|
27 |
* @var [type]
|
28 |
*/
|
29 |
-
protected $version = '3.0.
|
30 |
|
31 |
/**
|
32 |
* The current DB version. Used if we need to update the DB later.
|
|
|
33 |
* @var [type]
|
34 |
*/
|
35 |
protected $db_version = '2.9';
|
36 |
|
37 |
/**
|
38 |
* The main instance of Visual_Form_Builder
|
|
|
39 |
* @var [type]
|
40 |
*/
|
41 |
private static $instance = null;
|
@@ -46,24 +51,21 @@ class Visual_Form_Builder {
|
|
46 |
*
|
47 |
* @return void
|
48 |
*/
|
49 |
-
protected function __construct() {
|
50 |
-
}
|
51 |
|
52 |
/**
|
53 |
* Private clone method to prevent cloning of the instance.
|
54 |
*
|
55 |
* @return void
|
56 |
*/
|
57 |
-
private function __clone() {
|
58 |
-
}
|
59 |
|
60 |
/**
|
61 |
* Private unserialize method to prevent unserializing of the instance.
|
62 |
*
|
63 |
* @return void
|
64 |
*/
|
65 |
-
private function __wakeup() {
|
66 |
-
}
|
67 |
|
68 |
/**
|
69 |
* Create a single Visual_Form_Builder instance
|
@@ -71,27 +73,24 @@ class Visual_Form_Builder {
|
|
71 |
* Insures that only one instance of Visual_Form_Builder is running.
|
72 |
* Otherwise known as the Singleton class pattern
|
73 |
*
|
74 |
-
* @since
|
75 |
-
* @access
|
76 |
* @static
|
77 |
*/
|
78 |
public static function instance() {
|
79 |
if ( null === self::$instance ) {
|
80 |
-
self::$instance = new Visual_Form_Builder;
|
81 |
self::$instance->setup_constants();
|
82 |
self::$instance->includes();
|
83 |
self::$instance->autoload_classes();
|
84 |
|
85 |
-
//
|
86 |
-
//self::$instance->entries_cpt = new VFB_Pro_Entries_CPT();
|
87 |
-
|
88 |
-
// Install DB
|
89 |
register_activation_hook( __FILE__, array( self::$instance, 'install' ) );
|
90 |
|
91 |
-
// Update DB
|
92 |
add_action( 'plugins_loaded', array( self::$instance, 'upgrade_db_check' ) );
|
93 |
|
94 |
-
// Load i18n
|
95 |
add_action( 'plugins_loaded', array( self::$instance, 'lang' ) );
|
96 |
|
97 |
$screen_options = new Visual_Form_Builder_Admin_Screen_Options();
|
@@ -103,80 +102,87 @@ class Visual_Form_Builder {
|
|
103 |
|
104 |
/**
|
105 |
* Setup constants
|
106 |
-
* @return [type] [description]
|
107 |
*/
|
108 |
private function setup_constants() {
|
109 |
global $wpdb;
|
110 |
|
111 |
-
// Database version
|
112 |
-
if ( !defined( 'VFB_WP_DB_VERSION' ) )
|
113 |
define( 'VFB_WP_DB_VERSION', $this->db_version );
|
|
|
114 |
|
115 |
-
// Plugin version
|
116 |
-
if ( !defined( 'VFB_WP_PLUGIN_VERSION' ) )
|
117 |
define( 'VFB_WP_PLUGIN_VERSION', $this->version );
|
|
|
118 |
|
119 |
-
// Plugin Folder Path
|
120 |
-
if ( !defined( 'VFB_WP_PLUGIN_DIR' ) )
|
121 |
define( 'VFB_WP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
|
|
122 |
|
123 |
-
// Plugin Folder URL
|
124 |
-
if ( !defined( 'VFB_WP_PLUGIN_URL' ) )
|
125 |
define( 'VFB_WP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
|
|
126 |
|
127 |
-
// Plugin Root File
|
128 |
-
if ( !defined( 'VFB_WP_PLUGIN_FILE' ) )
|
129 |
define( 'VFB_WP_PLUGIN_FILE', __FILE__ );
|
|
|
130 |
|
131 |
-
// Form table name
|
132 |
-
if ( !defined( 'VFB_WP_FORMS_TABLE_NAME' ) )
|
133 |
define( 'VFB_WP_FORMS_TABLE_NAME', $wpdb->prefix . 'visual_form_builder_forms' );
|
|
|
134 |
|
135 |
-
// Field table name
|
136 |
-
if ( !defined( 'VFB_WP_FIELDS_TABLE_NAME' ) )
|
137 |
define( 'VFB_WP_FIELDS_TABLE_NAME', $wpdb->prefix . 'visual_form_builder_fields' );
|
|
|
138 |
|
139 |
-
// Form meta table name
|
140 |
-
if ( !defined( 'VFB_WP_ENTRIES_TABLE_NAME' ) )
|
141 |
define( 'VFB_WP_ENTRIES_TABLE_NAME', $wpdb->prefix . 'visual_form_builder_entries' );
|
|
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
* Include files
|
146 |
-
* @return [type] [description]
|
147 |
*/
|
148 |
private function includes() {
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
175 |
}
|
176 |
|
177 |
/**
|
178 |
* Install DB
|
179 |
-
* @return [type] [description]
|
180 |
*/
|
181 |
public function install() {
|
182 |
$install = new Visual_Form_Builder_Install();
|
@@ -185,7 +191,6 @@ class Visual_Form_Builder {
|
|
185 |
|
186 |
/**
|
187 |
* Check database version and run SQL install, if needed
|
188 |
-
* @return [type] [description]
|
189 |
*/
|
190 |
public function upgrade_db_check() {
|
191 |
$current_db_version = VFB_WP_DB_VERSION;
|
@@ -198,10 +203,9 @@ class Visual_Form_Builder {
|
|
198 |
|
199 |
/**
|
200 |
* Load localization file
|
201 |
-
* @return [type] [description]
|
202 |
*/
|
203 |
public function lang() {
|
204 |
-
$i18n = new
|
205 |
$i18n->set_domain( $this->plugin_name );
|
206 |
|
207 |
$i18n->load_lang();
|
@@ -209,7 +213,6 @@ class Visual_Form_Builder {
|
|
209 |
|
210 |
/**
|
211 |
* Autoload some VFB classes that aren't loaded via other files.
|
212 |
-
* @return [type] [description]
|
213 |
*/
|
214 |
public function autoload_classes() {
|
215 |
$admin_menu = new Visual_Form_Builder_Admin_Menu();
|
@@ -226,6 +229,7 @@ class Visual_Form_Builder {
|
|
226 |
|
227 |
/**
|
228 |
* The main function responsible for returning Visual Form Builder forms and functionality.
|
|
|
229 |
* @return [type] [description]
|
230 |
*/
|
231 |
function visual_form_builder_plugin_instance() {
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Visual Form Builder
|
4 |
+
Plugin URI: https://wordpress.org/plugins/visual-form-builder/
|
5 |
+
Description: Dynamically build forms using a simple interface. Forms include jQuery validation, a basic logic-based verification system, and entry tracking.
|
6 |
+
Version: 3.0.9
|
7 |
+
Author: Matthew Muro
|
8 |
+
Author URI: http://vfbpro.com
|
9 |
+
Text Domain: visual-form-builder
|
10 |
+
Domain Path: /languages/
|
11 |
*/
|
12 |
|
13 |
// If this file is called directly, abort.
|
14 |
+
if ( ! defined( 'WPINC' ) ) {
|
15 |
exit;
|
16 |
+
}
|
17 |
|
18 |
class Visual_Form_Builder {
|
19 |
|
20 |
/**
|
21 |
* The unique identifier of this plugin.
|
22 |
+
*
|
23 |
* @var [type]
|
24 |
*/
|
25 |
protected $plugin_name = 'visual-form-builder';
|
26 |
|
27 |
/**
|
28 |
* The current version of the plugin.
|
29 |
+
*
|
30 |
* @var [type]
|
31 |
*/
|
32 |
+
protected $version = '3.0.9';
|
33 |
|
34 |
/**
|
35 |
* The current DB version. Used if we need to update the DB later.
|
36 |
+
*
|
37 |
* @var [type]
|
38 |
*/
|
39 |
protected $db_version = '2.9';
|
40 |
|
41 |
/**
|
42 |
* The main instance of Visual_Form_Builder
|
43 |
+
*
|
44 |
* @var [type]
|
45 |
*/
|
46 |
private static $instance = null;
|
51 |
*
|
52 |
* @return void
|
53 |
*/
|
54 |
+
protected function __construct() {}
|
|
|
55 |
|
56 |
/**
|
57 |
* Private clone method to prevent cloning of the instance.
|
58 |
*
|
59 |
* @return void
|
60 |
*/
|
61 |
+
private function __clone() {}
|
|
|
62 |
|
63 |
/**
|
64 |
* Private unserialize method to prevent unserializing of the instance.
|
65 |
*
|
66 |
* @return void
|
67 |
*/
|
68 |
+
private function __wakeup() {}
|
|
|
69 |
|
70 |
/**
|
71 |
* Create a single Visual_Form_Builder instance
|
73 |
* Insures that only one instance of Visual_Form_Builder is running.
|
74 |
* Otherwise known as the Singleton class pattern
|
75 |
*
|
76 |
+
* @since 3.0
|
77 |
+
* @access public
|
78 |
* @static
|
79 |
*/
|
80 |
public static function instance() {
|
81 |
if ( null === self::$instance ) {
|
82 |
+
self::$instance = new Visual_Form_Builder();
|
83 |
self::$instance->setup_constants();
|
84 |
self::$instance->includes();
|
85 |
self::$instance->autoload_classes();
|
86 |
|
87 |
+
// Install DB.
|
|
|
|
|
|
|
88 |
register_activation_hook( __FILE__, array( self::$instance, 'install' ) );
|
89 |
|
90 |
+
// Update DB.
|
91 |
add_action( 'plugins_loaded', array( self::$instance, 'upgrade_db_check' ) );
|
92 |
|
93 |
+
// Load i18n.
|
94 |
add_action( 'plugins_loaded', array( self::$instance, 'lang' ) );
|
95 |
|
96 |
$screen_options = new Visual_Form_Builder_Admin_Screen_Options();
|
102 |
|
103 |
/**
|
104 |
* Setup constants
|
|
|
105 |
*/
|
106 |
private function setup_constants() {
|
107 |
global $wpdb;
|
108 |
|
109 |
+
// Database version.
|
110 |
+
if ( ! defined( 'VFB_WP_DB_VERSION' ) ) {
|
111 |
define( 'VFB_WP_DB_VERSION', $this->db_version );
|
112 |
+
}
|
113 |
|
114 |
+
// Plugin version.
|
115 |
+
if ( ! defined( 'VFB_WP_PLUGIN_VERSION' ) ) {
|
116 |
define( 'VFB_WP_PLUGIN_VERSION', $this->version );
|
117 |
+
}
|
118 |
|
119 |
+
// Plugin Folder Path.
|
120 |
+
if ( ! defined( 'VFB_WP_PLUGIN_DIR' ) ) {
|
121 |
define( 'VFB_WP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
122 |
+
}
|
123 |
|
124 |
+
// Plugin Folder URL.
|
125 |
+
if ( ! defined( 'VFB_WP_PLUGIN_URL' ) ) {
|
126 |
define( 'VFB_WP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
127 |
+
}
|
128 |
|
129 |
+
// Plugin Root File.
|
130 |
+
if ( ! defined( 'VFB_WP_PLUGIN_FILE' ) ) {
|
131 |
define( 'VFB_WP_PLUGIN_FILE', __FILE__ );
|
132 |
+
}
|
133 |
|
134 |
+
// Form table name.
|
135 |
+
if ( ! defined( 'VFB_WP_FORMS_TABLE_NAME' ) ) {
|
136 |
define( 'VFB_WP_FORMS_TABLE_NAME', $wpdb->prefix . 'visual_form_builder_forms' );
|
137 |
+
}
|
138 |
|
139 |
+
// Field table name.
|
140 |
+
if ( ! defined( 'VFB_WP_FIELDS_TABLE_NAME' ) ) {
|
141 |
define( 'VFB_WP_FIELDS_TABLE_NAME', $wpdb->prefix . 'visual_form_builder_fields' );
|
142 |
+
}
|
143 |
|
144 |
+
// Form meta table name.
|
145 |
+
if ( ! defined( 'VFB_WP_ENTRIES_TABLE_NAME' ) ) {
|
146 |
define( 'VFB_WP_ENTRIES_TABLE_NAME', $wpdb->prefix . 'visual_form_builder_entries' );
|
147 |
+
}
|
148 |
}
|
149 |
|
150 |
/**
|
151 |
* Include files
|
|
|
152 |
*/
|
153 |
private function includes() {
|
154 |
+
include_once VFB_WP_PLUGIN_DIR . 'inc/class-install.php';
|
155 |
+
include_once VFB_WP_PLUGIN_DIR . 'inc/class-uninstall.php';
|
156 |
+
include_once VFB_WP_PLUGIN_DIR . 'inc/class-i18n.php';
|
157 |
+
if ( ! class_exists( 'WP_List_Table' ) ) {
|
158 |
+
include_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
159 |
+
}
|
160 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-admin-menu.php';
|
161 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-admin-notices.php';
|
162 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-screen-options.php';
|
163 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-media-button.php';
|
164 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-dashboard-widgets.php';
|
165 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-widget.php';
|
166 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-load-css-js.php';
|
167 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-entries-detail.php';
|
168 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-entries-list.php';
|
169 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-forms-list.php';
|
170 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-forms-new.php';
|
171 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-forms-edit.php';
|
172 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-fields.php';
|
173 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-page-settings.php';
|
174 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-ajax.php';
|
175 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-save.php';
|
176 |
+
include_once VFB_WP_PLUGIN_DIR . 'admin/class-export.php';
|
177 |
+
include_once VFB_WP_PLUGIN_DIR . 'public/class-form-display.php';
|
178 |
+
include_once VFB_WP_PLUGIN_DIR . 'public/class-load-css-js.php';
|
179 |
+
include_once VFB_WP_PLUGIN_DIR . 'public/class-confirmation.php';
|
180 |
+
include_once VFB_WP_PLUGIN_DIR . 'public/class-email.php';
|
181 |
+
include_once VFB_WP_PLUGIN_DIR . 'public/class-security.php';
|
182 |
}
|
183 |
|
184 |
/**
|
185 |
* Install DB
|
|
|
186 |
*/
|
187 |
public function install() {
|
188 |
$install = new Visual_Form_Builder_Install();
|
191 |
|
192 |
/**
|
193 |
* Check database version and run SQL install, if needed
|
|
|
194 |
*/
|
195 |
public function upgrade_db_check() {
|
196 |
$current_db_version = VFB_WP_DB_VERSION;
|
203 |
|
204 |
/**
|
205 |
* Load localization file
|
|
|
206 |
*/
|
207 |
public function lang() {
|
208 |
+
$i18n = new Visual_Form_Builder_I18n();
|
209 |
$i18n->set_domain( $this->plugin_name );
|
210 |
|
211 |
$i18n->load_lang();
|
213 |
|
214 |
/**
|
215 |
* Autoload some VFB classes that aren't loaded via other files.
|
|
|
216 |
*/
|
217 |
public function autoload_classes() {
|
218 |
$admin_menu = new Visual_Form_Builder_Admin_Menu();
|
229 |
|
230 |
/**
|
231 |
* The main function responsible for returning Visual Form Builder forms and functionality.
|
232 |
+
*
|
233 |
* @return [type] [description]
|
234 |
*/
|
235 |
function visual_form_builder_plugin_instance() {
|