Version Description
Popover forms will be added in September 2010.
Download this release
Release Info
Developer | tlovett1 |
Plugin | Custom Contact Forms |
Version | 3.5.0 |
Comparing to | |
See all releases |
Code changes from version 3.1.2 to 3.5.0
- custom-contact-forms.css → css/custom-contact-forms-admin.css +93 -136
- css/custom-contact-forms-standards.css +14 -0
- css/custom-contact-forms.css +115 -0
- custom-contact-forms-db.php +138 -23
- custom-contact-forms-images.php +21 -21
- custom-contact-forms-mailer.php +1 -0
- custom-contact-forms-popover.php +0 -9
- custom-contact-forms.php +280 -72
- images/success-popover-example.gif +0 -0
- readme.txt +38 -7
custom-contact-forms.css → css/custom-contact-forms-admin.css
RENAMED
@@ -1,59 +1,8 @@
|
|
1 |
-
/* Custom Contact Forms CSS */
|
2 |
-
form.customcontactform, form.customcontactform-sidebar {
|
3 |
-
margin:8px;
|
4 |
-
width:95%;
|
5 |
-
max-width:600px;
|
6 |
-
font-size:1em;
|
7 |
-
padding:4px;
|
8 |
-
}
|
9 |
-
form.customcontactform-sidebar { width:100%; }
|
10 |
-
form.customcontactform h4, form.customcontactform-sidebar h4 {
|
11 |
-
font-size:1.3em;
|
12 |
-
font-weight:bold;
|
13 |
-
}
|
14 |
-
form.customcontactform div label, form.customcontactform-sidebar div label { display:block; width:100%; }
|
15 |
-
form.customcontactform div label.checkbox, form.customcontactform-sidebar div label.checkbox { display:inline; }
|
16 |
-
form.customcontactform div, form.customcontactform-sidebar div {
|
17 |
-
border-bottom: 1px dashed #666;
|
18 |
-
padding:.4em 0 .3em 0;
|
19 |
-
width:100%;
|
20 |
-
margin:0 0 4px 0;
|
21 |
-
}
|
22 |
-
form.customcontactform div div, form.customcontactform-sidebar div div { border-bottom:none; padding:0; }
|
23 |
-
form.customcontactform div input, form.customcontactform div select, form.customcontactform-sidebar div input, form.customcontactform-sidebar div select {
|
24 |
-
width:16em;
|
25 |
-
padding:2px;
|
26 |
-
margin:0;
|
27 |
-
font-size:1.3em;
|
28 |
-
font-family:Verdana, Arial, Helvetica, sans-serif;
|
29 |
-
-moz-border-radius:4px;
|
30 |
-
-khtml-border-radius:4px;
|
31 |
-
-webkit-border-radius:4px;
|
32 |
-
border-radius:4px;
|
33 |
-
}
|
34 |
-
form.customcontactform div input[type=checkbox], form.customcontactform-sidebar div input[type=checkbox] { width:30px; margin:0 6px 0 0; }
|
35 |
-
form.customcontactform input, form.customcontactform-sidebar input { margin: 7px 0 0 0; }
|
36 |
-
form.customcontactform div textarea, form.customcontactform-sidebar div textarea {
|
37 |
-
width:16em;
|
38 |
-
padding:4px;
|
39 |
-
margin:0;
|
40 |
-
font-size:1.3em;
|
41 |
-
font-family:Verdana, Arial, Helvetica, sans-serif;
|
42 |
-
-moz-border-radius:6px;
|
43 |
-
-khtml-border-radius:6px;
|
44 |
-
-webkit-border-radius:6px;
|
45 |
-
border-radius:6px;
|
46 |
-
height:5em;
|
47 |
-
}
|
48 |
-
form.customcontactform-sidebar div input[type=text],
|
49 |
-
form.customcontactform-sidebar div select,
|
50 |
-
form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:2px 0 4px 0; }
|
51 |
-
|
52 |
-
|
53 |
-
/* ------------------ custom contact forms admin panel ---------------- */
|
54 |
#customcontactforms-admin {
|
55 |
vertical-align:top;
|
56 |
margin:1em 0 30px 25px;
|
|
|
|
|
57 |
}
|
58 |
#customcontactforms-admin label { font-weight:bold; }
|
59 |
#customcontactforms-admin input, textarea, select {
|
@@ -72,12 +21,13 @@ form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:
|
|
72 |
}
|
73 |
#customcontactforms-admin #instructions {
|
74 |
float:left;
|
75 |
-
|
|
|
76 |
margin:20px 1em 1em 1em;
|
77 |
}
|
78 |
#customcontactforms-admin #contact-author {
|
79 |
float:left;
|
80 |
-
width:
|
81 |
margin:5px 1em 1em 6px;
|
82 |
}
|
83 |
|
@@ -104,6 +54,76 @@ form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:
|
|
104 |
width:500px;
|
105 |
margin:20px 1em 1em 5px;
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
#customcontactforms-admin #general-settings label { font-weight:bold; }
|
108 |
#customcontactforms-admin #style-example {
|
109 |
background:url(images/style-example.gif) no-repeat top left;
|
@@ -123,10 +143,11 @@ form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:
|
|
123 |
}
|
124 |
#customcontactforms-admin #create-styles {
|
125 |
clear:both;
|
126 |
-
height:42em;
|
127 |
width:1000px;
|
128 |
margin:20px 1em 1em 5px;
|
129 |
}
|
|
|
|
|
130 |
#customcontactforms-admin #plugin-news {
|
131 |
clear:both;
|
132 |
width:1000px;
|
@@ -143,8 +164,7 @@ form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:
|
|
143 |
#customcontactforms-admin #manage-styles input[type=text], #customcontactforms-admin #manage-styles select, #customcontactforms-admin #manage-styles textarea {
|
144 |
width:80px;
|
145 |
}
|
146 |
-
|
147 |
-
#customcontactforms-admin #create-styles .style_right { float:right; width:48%; clear:none }
|
148 |
#customcontactforms-admin #general-settings form div p.descrip {
|
149 |
font-style:italic;
|
150 |
padding-left:20px;
|
@@ -176,6 +196,21 @@ form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:
|
|
176 |
#customcontactforms-admin #manage-fields {
|
177 |
width:1000px;
|
178 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
#customcontactforms-admin #manage-forms {
|
180 |
width:1000px;
|
181 |
margin-right:10px;
|
@@ -183,9 +218,6 @@ form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:
|
|
183 |
#customcontactforms-admin #manage-fixed-fields {
|
184 |
width:1000px;
|
185 |
}
|
186 |
-
#customcontactforms-admin .evenrow {
|
187 |
-
background-color:#f5f5f5;
|
188 |
-
}
|
189 |
#customcontactforms-admin .nobordertop {
|
190 |
border-top:none;
|
191 |
}
|
@@ -221,79 +253,4 @@ form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:
|
|
221 |
}
|
222 |
#customcontactforms-admin #plugin-nav li.last {
|
223 |
border-right:none;
|
224 |
-
}
|
225 |
-
.width25 { width:25px; } .width50 { width:50px; } .width75 { width:75px; } .width100 { width:100px; }
|
226 |
-
.width125 { width:125px; } .width150 { width:150px; } .width175 { width:175px; } .width200 { width:200px; }
|
227 |
-
.width225 { width:225px; } .width250 { width:250px; } .width275 { width:275px; } .width300 { width:300px; }
|
228 |
-
|
229 |
-
.red { color:#F00; }
|
230 |
-
.bold { font-weight:bold; }
|
231 |
-
.italic { font-style:italic; }
|
232 |
-
.hide { display:none; }
|
233 |
-
.clear { clear:both; }
|
234 |
-
.textcenter { text-align:center; }
|
235 |
-
.floatleft { float:left; }
|
236 |
-
.floatright { float:right; }
|
237 |
-
.form-extra-options-table { margin:0 auto 0 auto; }
|
238 |
-
|
239 |
-
/* ----- popover box ---------- */
|
240 |
-
|
241 |
-
.ccf-popover {
|
242 |
-
position: absolute;
|
243 |
-
top:25%;
|
244 |
-
left:25%;
|
245 |
-
width:500px;
|
246 |
-
padding:10px;
|
247 |
-
background-color:#fff;
|
248 |
-
border:1px solid #666;
|
249 |
-
display:none;
|
250 |
-
}
|
251 |
-
|
252 |
-
.ccf-popover .ccf-popover-close { position:absolute; top:1px; right:5px; }
|
253 |
-
.tooltip {
|
254 |
-
background-color:#000;
|
255 |
-
border:1px solid #fff;
|
256 |
-
padding:10px 15px;
|
257 |
-
width:200px;
|
258 |
-
display:none;
|
259 |
-
color:#fff;
|
260 |
-
text-align:left;
|
261 |
-
font-size:12px;
|
262 |
-
|
263 |
-
/* outline radius for mozilla/firefox only */
|
264 |
-
-moz-box-shadow:0 0 10px #000;
|
265 |
-
-webkit-box-shadow:0 0 10px #000;
|
266 |
-
}
|
267 |
-
/* --- form success popover -------------------- */
|
268 |
-
#ccf-form-success {
|
269 |
-
display:none;
|
270 |
-
border: 9px solid #efefef;
|
271 |
-
border-spacing:0;
|
272 |
-
width:480px;
|
273 |
-
height:200px
|
274 |
-
padding:0px;
|
275 |
-
margin:0;
|
276 |
-
-moz-border-radius:35px;
|
277 |
-
-khtml-border-radius:35px;
|
278 |
-
-webkit-border-radius:35px;
|
279 |
-
border-radius:305px;
|
280 |
-
position:fixed;
|
281 |
-
left:30%;
|
282 |
-
background-color:white;
|
283 |
-
top:30%;
|
284 |
-
}
|
285 |
-
|
286 |
-
#ccf-form-success h5 {
|
287 |
-
background-color:#efefef; margin:0 0 15px 0px;
|
288 |
-
text-align:left;
|
289 |
-
padding:9px 9px 9px 20px;
|
290 |
-
font-size:1.5em;
|
291 |
-
font-weight:bold;
|
292 |
-
}
|
293 |
-
#ccf-form-success p { padding:8px; font-size:1.1em; text-align:center; }
|
294 |
-
#ccf-form-success a.close {
|
295 |
-
position:absolute;
|
296 |
-
right:12px;
|
297 |
-
font-size:1em;
|
298 |
-
top:7px;
|
299 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#customcontactforms-admin {
|
2 |
vertical-align:top;
|
3 |
margin:1em 0 30px 25px;
|
4 |
+
overflow:visible;
|
5 |
+
min-width:1020px;
|
6 |
}
|
7 |
#customcontactforms-admin label { font-weight:bold; }
|
8 |
#customcontactforms-admin input, textarea, select {
|
21 |
}
|
22 |
#customcontactforms-admin #instructions {
|
23 |
float:left;
|
24 |
+
clear:none;
|
25 |
+
width:400px;
|
26 |
margin:20px 1em 1em 1em;
|
27 |
}
|
28 |
#customcontactforms-admin #contact-author {
|
29 |
float:left;
|
30 |
+
width:380px;
|
31 |
margin:5px 1em 1em 6px;
|
32 |
}
|
33 |
|
54 |
width:500px;
|
55 |
margin:20px 1em 1em 5px;
|
56 |
}
|
57 |
+
|
58 |
+
#customcontactforms-admin #field-options {
|
59 |
+
clear:both;
|
60 |
+
width:1000px;
|
61 |
+
margin:20px 1em 1em 5px;
|
62 |
+
}
|
63 |
+
|
64 |
+
#customcontactforms-admin #field-options #edit-field-options {
|
65 |
+
float:left;
|
66 |
+
width:500px;
|
67 |
+
font-size:1em;
|
68 |
+
margin: 0 0 5px 0;
|
69 |
+
clear:left;
|
70 |
+
}
|
71 |
+
#customcontactforms-admin #field-options #edit-field-comments {
|
72 |
+
width:500px;
|
73 |
+
font-size:1em;
|
74 |
+
margin: 8px 5px 5px 480px;
|
75 |
+
clear:left;
|
76 |
+
}
|
77 |
+
#customcontactforms-admin #field-options ul#edit-field-options li {
|
78 |
+
margin-bottom:3px;
|
79 |
+
}
|
80 |
+
#customcontactforms-admin #field-options .option-header {
|
81 |
+
-moz-border-radius:6px;
|
82 |
+
-khtml-border-radius:6px;
|
83 |
+
-webkit-border-radius:6px;
|
84 |
+
border-radius:6px;
|
85 |
+
background-color:#efefef;
|
86 |
+
display:block;
|
87 |
+
border:1px solid #efefef;
|
88 |
+
float:left;
|
89 |
+
border-spacing:0;
|
90 |
+
height:30px;
|
91 |
+
width:480px;
|
92 |
+
font-weight:bold;
|
93 |
+
clear:both;
|
94 |
+
margin:4px 0 8px 0;
|
95 |
+
}
|
96 |
+
#customcontactforms-admin #field-options .slug,
|
97 |
+
#customcontactforms-admin #field-options .label,
|
98 |
+
#customcontactforms-admin #field-options .option-value,
|
99 |
+
#customcontactforms-admin #field-options .action {
|
100 |
+
width:100px;
|
101 |
+
display:block;
|
102 |
+
float:left;
|
103 |
+
text-align:center;
|
104 |
+
padding:6px 0 0 0;
|
105 |
+
}
|
106 |
+
#customcontactforms-admin #field-options .action { width:155px; }
|
107 |
+
#customcontactforms-admin #field-options .option-value { width:125px; }
|
108 |
+
#customcontactforms-admin #field-options .create-field-options-header {
|
109 |
+
-moz-border-radius:6px;
|
110 |
+
-khtml-border-radius:6px;
|
111 |
+
-webkit-border-radius:6px;
|
112 |
+
border-radius:6px;
|
113 |
+
background-color:#efefef;
|
114 |
+
border:1px solid #efefef;
|
115 |
+
border-spacing:0;
|
116 |
+
height:24px;
|
117 |
+
padding:6px 0 0 10px ;
|
118 |
+
margin:4px 0 8px 0;
|
119 |
+
font-weight:bold;
|
120 |
+
margin-left:510px;
|
121 |
+
}
|
122 |
+
#customcontactforms-admin #field-options #create-field-options {
|
123 |
+
margin-left:520px;
|
124 |
+
}
|
125 |
+
#customcontactforms-admin #field-options .evenrow-field-options div { background-color:#f9f9f9; }
|
126 |
+
#customcontactforms-admin #field-options .evenrow-field-options { background-color:#f9f9f9; }
|
127 |
#customcontactforms-admin #general-settings label { font-weight:bold; }
|
128 |
#customcontactforms-admin #style-example {
|
129 |
background:url(images/style-example.gif) no-repeat top left;
|
143 |
}
|
144 |
#customcontactforms-admin #create-styles {
|
145 |
clear:both;
|
|
|
146 |
width:1000px;
|
147 |
margin:20px 1em 1em 5px;
|
148 |
}
|
149 |
+
#customcontactforms-admin #create-styles .style_left { float:left; width:48% }
|
150 |
+
#customcontactforms-admin #create-styles .style_right { width:48%; margin-left:51%; clear:none }
|
151 |
#customcontactforms-admin #plugin-news {
|
152 |
clear:both;
|
153 |
width:1000px;
|
164 |
#customcontactforms-admin #manage-styles input[type=text], #customcontactforms-admin #manage-styles select, #customcontactforms-admin #manage-styles textarea {
|
165 |
width:80px;
|
166 |
}
|
167 |
+
|
|
|
168 |
#customcontactforms-admin #general-settings form div p.descrip {
|
169 |
font-style:italic;
|
170 |
padding-left:20px;
|
196 |
#customcontactforms-admin #manage-fields {
|
197 |
width:1000px;
|
198 |
}
|
199 |
+
#customcontactforms-admin #manage-fields .field-instructions {
|
200 |
+
float:left;
|
201 |
+
}
|
202 |
+
#customcontactforms-admin #manage-fields .attach-field-options {
|
203 |
+
float:left;
|
204 |
+
padding: 0 0 0 9px;
|
205 |
+
width:320px;
|
206 |
+
clear:none;
|
207 |
+
}
|
208 |
+
#customcontactforms-admin #manage-fields .dettach-field-options {
|
209 |
+
float:left;
|
210 |
+
padding: 0 0 0 30px;
|
211 |
+
width:300px;
|
212 |
+
clear:none;
|
213 |
+
}
|
214 |
#customcontactforms-admin #manage-forms {
|
215 |
width:1000px;
|
216 |
margin-right:10px;
|
218 |
#customcontactforms-admin #manage-fixed-fields {
|
219 |
width:1000px;
|
220 |
}
|
|
|
|
|
|
|
221 |
#customcontactforms-admin .nobordertop {
|
222 |
border-top:none;
|
223 |
}
|
253 |
}
|
254 |
#customcontactforms-admin #plugin-nav li.last {
|
255 |
border-right:none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
}
|
css/custom-contact-forms-standards.css
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.width25 { width:25px; } .width50 { width:50px; } .width75 { width:75px; } .width100 { width:100px; }
|
2 |
+
.width125 { width:125px; } .width150 { width:150px; } .width175 { width:175px; } .width200 { width:200px; }
|
3 |
+
.width225 { width:225px; } .width250 { width:250px; } .width275 { width:275px; } .width300 { width:300px; }
|
4 |
+
.ccf-center { text-align:center; }
|
5 |
+
.red { color:#F00; }
|
6 |
+
.bold { font-weight:bold; }
|
7 |
+
.italic { font-style:italic; }
|
8 |
+
.hide { display:none; }
|
9 |
+
.clear { clear:both; }
|
10 |
+
.textcenter { text-align:center; }
|
11 |
+
.floatleft { float:left; }
|
12 |
+
.floatright { float:right; }
|
13 |
+
.form-extra-options-table { margin:0 auto 0 auto; }
|
14 |
+
.evenrow { background-color:#f5f5f5; }
|
css/custom-contact-forms.css
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Custom Contact Forms CSS */
|
2 |
+
form.customcontactform, form.customcontactform-sidebar {
|
3 |
+
margin:8px;
|
4 |
+
width:95%;
|
5 |
+
max-width:600px;
|
6 |
+
font-size:11px;
|
7 |
+
padding:4px;
|
8 |
+
}
|
9 |
+
form.customcontactform-sidebar { width:100%; }
|
10 |
+
form.customcontactform h4, form.customcontactform-sidebar h4 {
|
11 |
+
font-size:1.3em;
|
12 |
+
font-weight:bold;
|
13 |
+
}
|
14 |
+
form.customcontactform div label, form.customcontactform-sidebar div label { display:block; width:100%; }
|
15 |
+
form.customcontactform div label.checkbox, form.customcontactform-sidebar div label.checkbox { display:inline; }
|
16 |
+
form.customcontactform div label.select, form.customcontactform-sidebar div label.select { display:inline; margin-right:8px; }
|
17 |
+
form.customcontactform div, form.customcontactform-sidebar div {
|
18 |
+
border-bottom: 1px dashed #e1e1e1;
|
19 |
+
padding:.4em 0 .3em 0;
|
20 |
+
width:100%;
|
21 |
+
margin:0 0 6px 0;
|
22 |
+
}
|
23 |
+
form.customcontactform div div, form.customcontactform-sidebar div div { border-bottom:none; margin-bottom:0; padding:0; }
|
24 |
+
form.customcontactform div input, form.customcontactform div select, form.customcontactform-sidebar div input, form.customcontactform-sidebar div select {
|
25 |
+
width:16em;
|
26 |
+
padding:2px;
|
27 |
+
margin:0;
|
28 |
+
font-size:1.3em;
|
29 |
+
font-family:Verdana, Arial, Helvetica, sans-serif;
|
30 |
+
-moz-border-radius:4px;
|
31 |
+
-khtml-border-radius:4px;
|
32 |
+
-webkit-border-radius:4px;
|
33 |
+
border-radius:4px;
|
34 |
+
}
|
35 |
+
form.customcontactform div input[type=checkbox], form.customcontactform-sidebar div input[type=checkbox] { width:30px; margin:5px 6px 0 0; }
|
36 |
+
form.customcontactform div input[type=radio], form.customcontactform-sidebar div input[type=radio] { width:20px; margin:5px 6px 0 0; }
|
37 |
+
form.customcontactform input, form.customcontactform-sidebar input { margin: 7px 0 0 0; }
|
38 |
+
form.customcontactform div textarea, form.customcontactform-sidebar div textarea {
|
39 |
+
width:16em;
|
40 |
+
padding:4px;
|
41 |
+
margin:0;
|
42 |
+
font-size:1.3em;
|
43 |
+
font-family:Verdana, Arial, Helvetica, sans-serif;
|
44 |
+
-moz-border-radius:6px;
|
45 |
+
-khtml-border-radius:6px;
|
46 |
+
-webkit-border-radius:6px;
|
47 |
+
border-radius:6px;
|
48 |
+
height:5em;
|
49 |
+
}
|
50 |
+
form.customcontactform div select { font-size:1.3em; width:auto; margin-right:9px; }
|
51 |
+
form.customcontactform-sidebar div input[type=text],
|
52 |
+
form.customcontactform-sidebar div select,
|
53 |
+
form.customcontactform-sidebar div textarea { width:95%; max-width:16em; margin:2px 0 4px 0; }
|
54 |
+
form.customcontactform-sidebar div select { width:auto; }
|
55 |
+
/* ----- popover box ---------- */
|
56 |
+
|
57 |
+
.ccf-popover {
|
58 |
+
position: absolute;
|
59 |
+
top:25%;
|
60 |
+
left:25%;
|
61 |
+
width:500px;
|
62 |
+
padding:10px;
|
63 |
+
background-color:#fff;
|
64 |
+
border:1px solid #666;
|
65 |
+
display:none;
|
66 |
+
}
|
67 |
+
|
68 |
+
.ccf-popover .ccf-popover-close { position:absolute; top:1px; right:5px; }
|
69 |
+
.tooltip {
|
70 |
+
background-color:#000;
|
71 |
+
border:1px solid #fff;
|
72 |
+
padding:10px 15px;
|
73 |
+
width:200px;
|
74 |
+
display:none;
|
75 |
+
color:#fff;
|
76 |
+
text-align:left;
|
77 |
+
font-size:12px;
|
78 |
+
|
79 |
+
/* outline radius for mozilla/firefox only */
|
80 |
+
-moz-box-shadow:0 0 10px #000;
|
81 |
+
-webkit-box-shadow:0 0 10px #000;
|
82 |
+
}
|
83 |
+
/* --- form success popover -------------------- */
|
84 |
+
#ccf-form-success {
|
85 |
+
display:none;
|
86 |
+
border: 9px solid #efefef;
|
87 |
+
border-spacing:0;
|
88 |
+
width:480px;
|
89 |
+
height:200px;
|
90 |
+
padding:0px;
|
91 |
+
margin:0;
|
92 |
+
-moz-border-radius:30px;
|
93 |
+
-khtml-border-radius:30px;
|
94 |
+
-webkit-border-radius:30px;
|
95 |
+
border-radius:250px;
|
96 |
+
position:fixed;
|
97 |
+
left:30%;
|
98 |
+
background-color:white;
|
99 |
+
top:30%;
|
100 |
+
}
|
101 |
+
|
102 |
+
#ccf-form-success h5 {
|
103 |
+
background-color:#efefef; margin:0 0 15px 0px;
|
104 |
+
text-align:left;
|
105 |
+
padding:9px 9px 9px 20px;
|
106 |
+
font-size:1.5em;
|
107 |
+
font-weight:bold;
|
108 |
+
}
|
109 |
+
#ccf-form-success p { padding:8px; font-size:1.1em; text-align:center; }
|
110 |
+
#ccf-form-success a.close {
|
111 |
+
position:absolute;
|
112 |
+
right:12px;
|
113 |
+
font-size:1em;
|
114 |
+
top:7px;
|
115 |
+
}
|
custom-contact-forms-db.php
CHANGED
@@ -9,14 +9,14 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
9 |
var $forms_table;
|
10 |
var $fields_table;
|
11 |
var $styles_table;
|
|
|
12 |
function CustomContactFormsDB() {
|
13 |
global $wpdb;
|
14 |
-
$
|
15 |
-
$this->
|
16 |
-
$this->
|
17 |
-
$this->
|
18 |
-
$this->
|
19 |
-
$this->insertFixedFields();
|
20 |
}
|
21 |
|
22 |
function encodeOption($option) {
|
@@ -44,6 +44,15 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
44 |
PRIMARY KEY ( `id` )
|
45 |
) ENGINE = MYISAM AUTO_INCREMENT=1 ";
|
46 |
$wpdb->query($sql1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
} if(!$this->fieldsTableExists()) {
|
48 |
$sql2 = "CREATE TABLE `".$this->fields_table."` (
|
49 |
`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
|
@@ -112,16 +121,24 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
112 |
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_success_title` VARCHAR( 150 ) NOT NULL DEFAULT 'Form Success!'");
|
113 |
if (!$this->columnExists('form_padding', $this->styles_table))
|
114 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `form_padding` VARCHAR( 20 ) NOT NULL DEFAULT '4px'");
|
115 |
-
if (!$this->columnExists('title_margin', $this->styles_table))
|
116 |
-
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `title_margin` VARCHAR( 20 ) NOT NULL DEFAULT '2px'");
|
117 |
if (!$this->columnExists('form_margin', $this->styles_table))
|
118 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `form_margin` VARCHAR( 20 ) NOT NULL DEFAULT '4px'");
|
|
|
|
|
119 |
if (!$this->columnExists('label_margin', $this->styles_table))
|
120 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `label_margin` VARCHAR( 20 ) NOT NULL DEFAULT '3px'");
|
121 |
if (!$this->columnExists('textarea_backgroundcolor', $this->styles_table))
|
122 |
-
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `textarea_backgroundcolor` VARCHAR( 20 ) NOT NULL DEFAULT '#
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
if (!$this->columnExists('field_instructions', $this->fields_table))
|
124 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_instructions` TEXT NOT NULL");
|
|
|
|
|
125 |
if (!$this->columnExists('field_required', $this->fields_table))
|
126 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_required` INT( 1 ) NOT NULL DEFAULT '0'");
|
127 |
|
@@ -150,8 +167,6 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
150 |
global $wpdb;
|
151 |
if (empty($form) or empty($form[form_slug]) or $this->formSlugExists($this->formatSlug($form[form_slug]))) return false;
|
152 |
$form[form_slug] = $this->formatSlug($form[form_slug]);
|
153 |
-
//foreach ($form as $key => $value)
|
154 |
-
// $form[$key] = $this->encodeOption($value);
|
155 |
$form = array_map(array(&$this, 'encodeOption'), $form);
|
156 |
$wpdb->insert($this->forms_table, $form);
|
157 |
return true;
|
@@ -169,6 +184,15 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
169 |
return true;
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
function insertStyle($style) {
|
173 |
global $wpdb;
|
174 |
if (empty($style) or empty($style[style_slug]) or $this->styleSlugExists($this->formatSlug($style[style_slug]))) return false;
|
@@ -177,11 +201,11 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
177 |
if ($key != 'style_slug')
|
178 |
$style[$key] = $this->formatStyle($this->encodeOption($value));
|
179 |
}
|
180 |
-
print_r($style);
|
181 |
$wpdb->insert($this->styles_table, $style);
|
182 |
return true;
|
183 |
}
|
184 |
|
|
|
185 |
function fieldsTableExists() {
|
186 |
global $wpdb;
|
187 |
return ($wpdb->get_var("show tables like '". $this->fields_table . "'") == $this->fields_table);
|
@@ -197,6 +221,11 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
197 |
return ($wpdb->get_var("show tables like '". $this->styles_table . "'") == $this->styles_table);
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
200 |
function updateForm($form, $fid) {
|
201 |
global $wpdb;
|
202 |
if (!empty($form[form_slug])) {
|
@@ -222,6 +251,19 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
222 |
return true;
|
223 |
}
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
function updateStyle($style, $sid) {
|
226 |
global $wpdb;
|
227 |
if (empty($style[style_slug])) return false;
|
@@ -243,16 +285,25 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
243 |
|
244 |
function deleteField($fid) {
|
245 |
global $wpdb;
|
|
|
246 |
$wpdb->query("DELETE FROM " . $this->fields_table . " WHERE id='$fid'");
|
247 |
-
return
|
248 |
}
|
249 |
|
250 |
function deleteStyle($sid) {
|
251 |
global $wpdb;
|
|
|
252 |
$wpdb->query("DELETE FROM " . $this->styles_table . " WHERE id='$sid'");
|
253 |
return true;
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
function selectAllForms() {
|
257 |
global $wpdb;
|
258 |
return $wpdb->get_results("SELECT * FROM " . $this->forms_table . " ORDER BY form_slug ASC");
|
@@ -263,6 +314,11 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
263 |
return $wpdb->get_results("SELECT * FROM " . $this->fields_table . " ORDER BY field_slug ASC");
|
264 |
}
|
265 |
|
|
|
|
|
|
|
|
|
|
|
266 |
function selectAllStyles() {
|
267 |
global $wpdb;
|
268 |
return $wpdb->get_results("SELECT * FROM " . $this->styles_table . " ORDER BY style_slug ASC");
|
@@ -274,25 +330,41 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
274 |
return $wpdb->get_row("SELECT * FROM " . $this->forms_table . " WHERE id='$fid' $extra");
|
275 |
}
|
276 |
|
277 |
-
function selectStyle($sid, $style_slug) {
|
278 |
global $wpdb;
|
279 |
$extra = (!empty($style_slug)) ? " or style_slug = '$style_slug'" : '';
|
280 |
return $wpdb->get_row("SELECT * FROM " . $this->styles_table . " WHERE id='$sid' $extra");
|
281 |
}
|
282 |
|
283 |
-
function selectField($fid, $field_slug) {
|
284 |
global $wpdb;
|
285 |
$extra = (!empty($field_slug)) ? " or field_slug = '$field_slug'" : '';
|
286 |
return $wpdb->get_row("SELECT * FROM " . $this->fields_table . " WHERE id='$fid'" . $extra);
|
287 |
}
|
288 |
|
289 |
-
function
|
290 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
291 |
$form = $this->selectForm($form_id, '');
|
292 |
$fields = $this->getAttachedFieldsArray($form_id);
|
293 |
if (!in_array($field_id, $fields)) {
|
294 |
-
$
|
295 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
return true;
|
297 |
}
|
298 |
return false;
|
@@ -305,18 +377,56 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
305 |
return $out;
|
306 |
}
|
307 |
|
308 |
-
function
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
$fields = $this->getAttachedFieldsArray($form_id);
|
311 |
if (!empty($fields) && in_array($field_id, $fields)) {
|
312 |
-
$form = $this->selectForm($form_id
|
313 |
-
$
|
314 |
-
$
|
315 |
return true;
|
316 |
}
|
317 |
return false;
|
318 |
}
|
319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
320 |
function formatSlug($slug) {
|
321 |
$slug = preg_replace('/[^a-zA-Z0-9\s]/', '', $slug);
|
322 |
return str_replace(' ', '_', $slug);
|
@@ -336,6 +446,11 @@ if (!class_exists('CustomContactFormsDB')) {
|
|
336 |
$test = $this->selectForm('', $slug);
|
337 |
return (!empty($test));
|
338 |
}
|
|
|
|
|
|
|
|
|
|
|
339 |
}
|
340 |
}
|
341 |
?>
|
9 |
var $forms_table;
|
10 |
var $fields_table;
|
11 |
var $styles_table;
|
12 |
+
var $field_options_table;
|
13 |
function CustomContactFormsDB() {
|
14 |
global $wpdb;
|
15 |
+
$table_prefix = $wpdb->prefix;
|
16 |
+
$this->forms_table = $table_prefix . 'customcontactforms_forms';
|
17 |
+
$this->fields_table = $table_prefix . 'customcontactforms_fields';
|
18 |
+
$this->styles_table = $table_prefix . 'customcontactforms_styles';
|
19 |
+
$this->field_options_table = $table_prefix . 'customcontactforms_field_options';
|
|
|
20 |
}
|
21 |
|
22 |
function encodeOption($option) {
|
44 |
PRIMARY KEY ( `id` )
|
45 |
) ENGINE = MYISAM AUTO_INCREMENT=1 ";
|
46 |
$wpdb->query($sql1);
|
47 |
+
} if(!$this->fieldOptionsTableExists()) {
|
48 |
+
$sql5 = " CREATE TABLE `".$this->field_options_table."` (
|
49 |
+
`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
|
50 |
+
`option_slug` VARCHAR( 100 ) NOT NULL ,
|
51 |
+
`option_label` VARCHAR( 200 ) NOT NULL ,
|
52 |
+
`option_value` VARCHAR( 100 ) NOT NULL ,
|
53 |
+
PRIMARY KEY ( `id` )
|
54 |
+
) ENGINE = MYISAM AUTO_INCREMENT=1 ";
|
55 |
+
$wpdb->query($sql5);
|
56 |
} if(!$this->fieldsTableExists()) {
|
57 |
$sql2 = "CREATE TABLE `".$this->fields_table."` (
|
58 |
`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
|
121 |
$wpdb->query("ALTER TABLE `" . $this->forms_table . "` ADD `form_success_title` VARCHAR( 150 ) NOT NULL DEFAULT 'Form Success!'");
|
122 |
if (!$this->columnExists('form_padding', $this->styles_table))
|
123 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `form_padding` VARCHAR( 20 ) NOT NULL DEFAULT '4px'");
|
|
|
|
|
124 |
if (!$this->columnExists('form_margin', $this->styles_table))
|
125 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `form_margin` VARCHAR( 20 ) NOT NULL DEFAULT '4px'");
|
126 |
+
if (!$this->columnExists('title_margin', $this->styles_table))
|
127 |
+
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `title_margin` VARCHAR( 20 ) NOT NULL DEFAULT '2px'");
|
128 |
if (!$this->columnExists('label_margin', $this->styles_table))
|
129 |
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `label_margin` VARCHAR( 20 ) NOT NULL DEFAULT '3px'");
|
130 |
if (!$this->columnExists('textarea_backgroundcolor', $this->styles_table))
|
131 |
+
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `textarea_backgroundcolor` VARCHAR( 20 ) NOT NULL DEFAULT '#efefef'");
|
132 |
+
if (!$this->columnExists('success_popover_bordercolor', $this->styles_table))
|
133 |
+
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `success_popover_bordercolor` VARCHAR( 20 ) NOT NULL DEFAULT '#efefef'");
|
134 |
+
|
135 |
+
if (!$this->columnExists('dropdown_width', $this->styles_table))
|
136 |
+
$wpdb->query("ALTER TABLE `" . $this->styles_table . "` ADD `dropdown_width` VARCHAR( 20 ) NOT NULL DEFAULT 'auto'");
|
137 |
+
|
138 |
if (!$this->columnExists('field_instructions', $this->fields_table))
|
139 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_instructions` TEXT NOT NULL");
|
140 |
+
if (!$this->columnExists('field_options', $this->fields_table))
|
141 |
+
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_options` VARCHAR( 300 ) NOT NULL");
|
142 |
if (!$this->columnExists('field_required', $this->fields_table))
|
143 |
$wpdb->query("ALTER TABLE `" . $this->fields_table . "` ADD `field_required` INT( 1 ) NOT NULL DEFAULT '0'");
|
144 |
|
167 |
global $wpdb;
|
168 |
if (empty($form) or empty($form[form_slug]) or $this->formSlugExists($this->formatSlug($form[form_slug]))) return false;
|
169 |
$form[form_slug] = $this->formatSlug($form[form_slug]);
|
|
|
|
|
170 |
$form = array_map(array(&$this, 'encodeOption'), $form);
|
171 |
$wpdb->insert($this->forms_table, $form);
|
172 |
return true;
|
184 |
return true;
|
185 |
}
|
186 |
|
187 |
+
function insertFieldOption($option) {
|
188 |
+
global $wpdb;
|
189 |
+
if (empty($option) or empty($option[option_slug]) or $this->fieldOptionsSlugExists($this->formatSlug($option[option_slug]))) return false;
|
190 |
+
$option[option_slug] = $this->formatSlug($option[option_slug]);
|
191 |
+
$option = array_map(array(&$this, 'encodeOption'), $option);
|
192 |
+
$wpdb->insert($this->field_options_table, $option);
|
193 |
+
return true;
|
194 |
+
}
|
195 |
+
|
196 |
function insertStyle($style) {
|
197 |
global $wpdb;
|
198 |
if (empty($style) or empty($style[style_slug]) or $this->styleSlugExists($this->formatSlug($style[style_slug]))) return false;
|
201 |
if ($key != 'style_slug')
|
202 |
$style[$key] = $this->formatStyle($this->encodeOption($value));
|
203 |
}
|
|
|
204 |
$wpdb->insert($this->styles_table, $style);
|
205 |
return true;
|
206 |
}
|
207 |
|
208 |
+
|
209 |
function fieldsTableExists() {
|
210 |
global $wpdb;
|
211 |
return ($wpdb->get_var("show tables like '". $this->fields_table . "'") == $this->fields_table);
|
221 |
return ($wpdb->get_var("show tables like '". $this->styles_table . "'") == $this->styles_table);
|
222 |
}
|
223 |
|
224 |
+
function fieldOptionsTableExists() {
|
225 |
+
global $wpdb;
|
226 |
+
return ($wpdb->get_var("show tables like '". $this->field_options_table . "'") == $this->field_options_table);
|
227 |
+
}
|
228 |
+
|
229 |
function updateForm($form, $fid) {
|
230 |
global $wpdb;
|
231 |
if (!empty($form[form_slug])) {
|
251 |
return true;
|
252 |
}
|
253 |
|
254 |
+
function updateFieldOption($option, $oid) {
|
255 |
+
global $wpdb;
|
256 |
+
if (!empty($option[option_slug])) {
|
257 |
+
$test = $this->selectFieldOption('', $this->formatSlug($option[option_slug]));
|
258 |
+
if (!empty($test) and $test->id != $oid)
|
259 |
+
return false;
|
260 |
+
$option[option_slug] = $this->formatSlug($option[option_slug]);
|
261 |
+
}
|
262 |
+
$option = array_map(array(&$this, 'encodeOption'), $option);
|
263 |
+
$wpdb->update($this->field_options_table, $option, array('id' => $oid));
|
264 |
+
return true;
|
265 |
+
}
|
266 |
+
|
267 |
function updateStyle($style, $sid) {
|
268 |
global $wpdb;
|
269 |
if (empty($style[style_slug])) return false;
|
285 |
|
286 |
function deleteField($fid) {
|
287 |
global $wpdb;
|
288 |
+
$this->dettachFieldAll($fid);
|
289 |
$wpdb->query("DELETE FROM " . $this->fields_table . " WHERE id='$fid'");
|
290 |
+
return false;
|
291 |
}
|
292 |
|
293 |
function deleteStyle($sid) {
|
294 |
global $wpdb;
|
295 |
+
$this->dettachStyleAll($sid);
|
296 |
$wpdb->query("DELETE FROM " . $this->styles_table . " WHERE id='$sid'");
|
297 |
return true;
|
298 |
}
|
299 |
|
300 |
+
function deleteFieldOption($oid) {
|
301 |
+
global $wpdb;
|
302 |
+
$this->dettachFieldOptionAll($oid);
|
303 |
+
$wpdb->query("DELETE FROM " . $this->field_options_table . " WHERE id='$oid'");
|
304 |
+
return true;
|
305 |
+
}
|
306 |
+
|
307 |
function selectAllForms() {
|
308 |
global $wpdb;
|
309 |
return $wpdb->get_results("SELECT * FROM " . $this->forms_table . " ORDER BY form_slug ASC");
|
314 |
return $wpdb->get_results("SELECT * FROM " . $this->fields_table . " ORDER BY field_slug ASC");
|
315 |
}
|
316 |
|
317 |
+
function selectAllFieldOptions() {
|
318 |
+
global $wpdb;
|
319 |
+
return $wpdb->get_results("SELECT * FROM " . $this->field_options_table . " ORDER BY option_slug ASC");
|
320 |
+
}
|
321 |
+
|
322 |
function selectAllStyles() {
|
323 |
global $wpdb;
|
324 |
return $wpdb->get_results("SELECT * FROM " . $this->styles_table . " ORDER BY style_slug ASC");
|
330 |
return $wpdb->get_row("SELECT * FROM " . $this->forms_table . " WHERE id='$fid' $extra");
|
331 |
}
|
332 |
|
333 |
+
function selectStyle($sid, $style_slug = '') {
|
334 |
global $wpdb;
|
335 |
$extra = (!empty($style_slug)) ? " or style_slug = '$style_slug'" : '';
|
336 |
return $wpdb->get_row("SELECT * FROM " . $this->styles_table . " WHERE id='$sid' $extra");
|
337 |
}
|
338 |
|
339 |
+
function selectField($fid, $field_slug = '') {
|
340 |
global $wpdb;
|
341 |
$extra = (!empty($field_slug)) ? " or field_slug = '$field_slug'" : '';
|
342 |
return $wpdb->get_row("SELECT * FROM " . $this->fields_table . " WHERE id='$fid'" . $extra);
|
343 |
}
|
344 |
|
345 |
+
function selectFieldOption($oid, $option_slug = '') {
|
346 |
global $wpdb;
|
347 |
+
$extra = (!empty($option_slug)) ? " or option_slug = '$option_slug'" : '';
|
348 |
+
return $wpdb->get_row("SELECT * FROM " . $this->field_options_table . " WHERE id='$oid'" . $extra);
|
349 |
+
}
|
350 |
+
|
351 |
+
function addFieldToForm($field_id, $form_id) {
|
352 |
$form = $this->selectForm($form_id, '');
|
353 |
$fields = $this->getAttachedFieldsArray($form_id);
|
354 |
if (!in_array($field_id, $fields)) {
|
355 |
+
$new_fields = $form->form_fields . $field_id . ',';
|
356 |
+
$this->updateForm(array('form_fields' => $new_fields), $form_id);
|
357 |
+
return true;
|
358 |
+
}
|
359 |
+
return false;
|
360 |
+
}
|
361 |
+
|
362 |
+
function addFieldOptionToField($option_id, $field_id) {
|
363 |
+
$field = $this->selectField($field_id);
|
364 |
+
$options = $this->getAttachedFieldOptionsArray($field_id);
|
365 |
+
if (!in_array($option_id, $options)) {
|
366 |
+
$new_options = $field->field_options . $option_id . ',';
|
367 |
+
$this->updateField(array('field_options' => $new_options), $field_id);
|
368 |
return true;
|
369 |
}
|
370 |
return false;
|
377 |
return $out;
|
378 |
}
|
379 |
|
380 |
+
function getAttachedFieldOptionsArray($field_id) {
|
381 |
+
$field = $this->selectField($field_id);
|
382 |
+
$out = explode(',', $field->field_options);
|
383 |
+
if (!empty($out)) array_pop($out);
|
384 |
+
return $out;
|
385 |
+
}
|
386 |
+
|
387 |
+
function dettachField($field_id, $form_id) {
|
388 |
$fields = $this->getAttachedFieldsArray($form_id);
|
389 |
if (!empty($fields) && in_array($field_id, $fields)) {
|
390 |
+
$form = $this->selectForm($form_id);
|
391 |
+
$new_fields = str_replace($field_id . ',', '', $form->form_fields);
|
392 |
+
$this->updateForm(array('form_fields' => $new_fields), $form_id);
|
393 |
return true;
|
394 |
}
|
395 |
return false;
|
396 |
}
|
397 |
|
398 |
+
function dettachFieldAll($field_id) {
|
399 |
+
$forms = $this->selectAllForms();
|
400 |
+
foreach ($forms as $form)
|
401 |
+
$this->dettachField($field_id, $form->id);
|
402 |
+
}
|
403 |
+
|
404 |
+
function dettachFieldOptionAll($option_id) {
|
405 |
+
$fields = $this->selectAllFields();
|
406 |
+
foreach ($fields as $field)
|
407 |
+
$this->dettachFieldOption($option_id, $field->id);
|
408 |
+
}
|
409 |
+
|
410 |
+
function dettachFieldOption($option_id, $field_id) {
|
411 |
+
$options = $this->getAttachedFieldOptionsArray($field_id);
|
412 |
+
if (!empty($options) && in_array($option_id, $options)) {
|
413 |
+
$field = $this->selectField($field_id);
|
414 |
+
$new_options = str_replace($option_id . ',', '', $field->field_options);
|
415 |
+
$this->updateField(array('field_options' => $new_options), $field_id);
|
416 |
+
return true;
|
417 |
+
}
|
418 |
+
return false;
|
419 |
+
}
|
420 |
+
|
421 |
+
function dettachStyleAll($style_id) {
|
422 |
+
$forms = $this->selectAllForms();
|
423 |
+
foreach ($forms as $form) {
|
424 |
+
if ($form->form_style == $style_id) {
|
425 |
+
$this->updateForm(array('form_style' => 0), $form->id);
|
426 |
+
}
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
function formatSlug($slug) {
|
431 |
$slug = preg_replace('/[^a-zA-Z0-9\s]/', '', $slug);
|
432 |
return str_replace(' ', '_', $slug);
|
446 |
$test = $this->selectForm('', $slug);
|
447 |
return (!empty($test));
|
448 |
}
|
449 |
+
|
450 |
+
function fieldOptionsSlugExists($slug) {
|
451 |
+
$test = $this->selectFieldOption('', $slug);
|
452 |
+
return (!empty($test));
|
453 |
+
}
|
454 |
}
|
455 |
}
|
456 |
?>
|
custom-contact-forms-images.php
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Custom Contact Forms Plugin
|
4 |
-
By Taylor Lovett - http://www.taylorlovett.com
|
5 |
-
Plugin URL: http://www.taylorlovett.com/wordpress-plugins
|
6 |
-
*/
|
7 |
-
if (!class_exists('CustomContactFormsImages')) {
|
8 |
-
class CustomContactFormsImages {
|
9 |
-
function createImageWithText($str){
|
10 |
-
$image = imagecreate(96,24);
|
11 |
-
$src = imagecreatefrompng('images/gd' . rand(1, 4) . '.png');
|
12 |
-
$textcolor = imagecolorallocate($src, 10, 0, 0);
|
13 |
-
imagestring($src, 14, 5, 1, $str, $textcolor);
|
14 |
-
imagecopyresampled($image, $src, 0, 0, 0, 0, 96, 24, 63, 18);
|
15 |
-
imagepng($image);
|
16 |
-
imagedestroy($image);
|
17 |
-
imagedestroy($src);
|
18 |
-
return $str;
|
19 |
-
}
|
20 |
-
}
|
21 |
-
}
|
22 |
?>
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Custom Contact Forms Plugin
|
4 |
+
By Taylor Lovett - http://www.taylorlovett.com
|
5 |
+
Plugin URL: http://www.taylorlovett.com/wordpress-plugins
|
6 |
+
*/
|
7 |
+
if (!class_exists('CustomContactFormsImages')) {
|
8 |
+
class CustomContactFormsImages {
|
9 |
+
function createImageWithText($str){
|
10 |
+
$image = imagecreate(96,24);
|
11 |
+
$src = imagecreatefrompng('images/gd' . rand(1, 4) . '.png');
|
12 |
+
$textcolor = imagecolorallocate($src, 10, 0, 0);
|
13 |
+
imagestring($src, 14, 5, 1, $str, $textcolor);
|
14 |
+
imagecopyresampled($image, $src, 0, 0, 0, 0, 96, 24, 63, 18);
|
15 |
+
imagepng($image);
|
16 |
+
imagedestroy($image);
|
17 |
+
imagedestroy($src);
|
18 |
+
return $str;
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
?>
|
custom-contact-forms-mailer.php
CHANGED
@@ -26,6 +26,7 @@ if (!class_exists('CustomContactFormsMailer')) {
|
|
26 |
$this->addHeader('Reply-To: '.$this->from."\r\n");
|
27 |
$this->addHeader('Return-Path: '.$this->from."\r\n");
|
28 |
$this->addHeader('X-mailer: ZFmail 1.0'."\r\n");
|
|
|
29 |
if ($this->wp_mail_function == 1)
|
30 |
wp_mail($this->to, $this->subject, $this->body, $this->headers);
|
31 |
else
|
26 |
$this->addHeader('Reply-To: '.$this->from."\r\n");
|
27 |
$this->addHeader('Return-Path: '.$this->from."\r\n");
|
28 |
$this->addHeader('X-mailer: ZFmail 1.0'."\r\n");
|
29 |
+
$this->body .= "\n\n\n----------\nSent by Custom Contact Forms\nA WordPress Plugin created by Taylor Lovett\nReport a Bug/Get Support: http://www.taylorlovett.com\n";
|
30 |
if ($this->wp_mail_function == 1)
|
31 |
wp_mail($this->to, $this->subject, $this->body, $this->headers);
|
32 |
else
|
custom-contact-forms-popover.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once('custom-contact-forms.php');
|
3 |
-
$customcontact = new CustomContactForms();
|
4 |
-
?>
|
5 |
-
<html>
|
6 |
-
<body>
|
7 |
-
test
|
8 |
-
</body>
|
9 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
custom-contact-forms.php
CHANGED
@@ -3,10 +3,11 @@
|
|
3 |
Plugin Name: Custom Contact Forms
|
4 |
Plugin URI: http://taylorlovett.com/wordpress-plugins
|
5 |
Description: Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form. <a href="options-general.php?page=custom-contact-forms">Settings</a>
|
6 |
-
Version: 3.
|
7 |
Author: Taylor Lovett
|
8 |
Author URI: http://www.taylorlovett.com
|
9 |
*/
|
|
|
10 |
/*
|
11 |
Copyright (C) 2010-2011 Taylor Lovett, taylorlovett.com (admin@taylorlovett.com)
|
12 |
This program is free software; you can redistribute it and/or modify
|
@@ -31,8 +32,8 @@ if (!class_exists('CustomContactForms')) {
|
|
31 |
var $form_errors;
|
32 |
var $error_return;
|
33 |
var $gets;
|
|
|
34 |
var $current_thank_you_message;
|
35 |
-
var $current_thank_you_message_title;
|
36 |
var $fixed_fields = array('customcontactforms_submit' => '',
|
37 |
'fid' => '',
|
38 |
'fixedEmail' => 'Use this field if you want the plugin to throw an error on fake emails.',
|
@@ -46,6 +47,12 @@ if (!class_exists('CustomContactForms')) {
|
|
46 |
$this->form_errors = array();
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
function getAdminOptions() {
|
50 |
$admin_email = get_option('admin_email');
|
51 |
$customcontactAdminOptions = array('show_widget_home' => 1, 'show_widget_pages' => 1, 'show_widget_singles' => 1, 'show_widget_categories' => 1, 'show_widget_archives' => 1, 'default_to_email' => $admin_email, 'default_from_email' => $admin_email, 'default_form_subject' => 'Someone Filled Out Your Contact Form!',
|
@@ -67,13 +74,23 @@ if (!class_exists('CustomContactForms')) {
|
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
function
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
function insertAdminScripts() {
|
76 |
-
wp_enqueue_script('jquery');
|
77 |
wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'/*, 'jquery-ui-draggable', 'jquery-ui-resizable', 'jquery-ui-dialog'*/), '1.0');
|
78 |
}
|
79 |
|
@@ -145,8 +162,12 @@ if (!class_exists('CustomContactForms')) {
|
|
145 |
parent::updateForm($_POST[form], $_POST[fid]);
|
146 |
} elseif ($_POST[form_add_field]) {
|
147 |
parent::addFieldToForm($_POST[field_id], $_POST[fid]);
|
148 |
-
} elseif ($_POST[
|
149 |
-
parent::
|
|
|
|
|
|
|
|
|
150 |
} elseif ($_POST[style_create]) {
|
151 |
parent::insertStyle($_POST[style]);
|
152 |
} elseif ($_POST[style_edit]) {
|
@@ -156,6 +177,12 @@ if (!class_exists('CustomContactForms')) {
|
|
156 |
} elseif ($_POST[contact_author]) {
|
157 |
$this_url = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : $_SERVER['SERVER_NAME'];
|
158 |
$this->contactAuthor($_POST[name], $_POST[email], $this_url, $_POST[message], $_POST[type]);
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
$styles = parent::selectAllStyles();
|
161 |
$style_options = '<option value="0">None</option>';
|
@@ -175,6 +202,7 @@ if (!class_exists('CustomContactForms')) {
|
|
175 |
<li><a href="#manage-forms">Manage Forms</a></li>
|
176 |
<li><a href="#create-styles">Create Styles</a></li>
|
177 |
<li><a href="#manage-styles">Manage Styles</a></li>
|
|
|
178 |
<li><a href="#contact-author">Suggest a Feature</a></li>
|
179 |
<li><a href="#contact-author">Bug Report</a></li>
|
180 |
<li><a href="#custom-html">Custom HTML Forms (New!)</a></li>
|
@@ -187,7 +215,7 @@ if (!class_exists('CustomContactForms')) {
|
|
187 |
<ul>
|
188 |
<li>
|
189 |
<label for="field_slug">* Slug (Name):</label>
|
190 |
-
<input name="field[field_slug]" type="text" maxlength="50" />
|
191 |
(A slug is simply a way to identify your form. It can only contain underscores, letters, and numbers and must be unique.)</li>
|
192 |
<li>
|
193 |
<label for="field_label">Field Label:</label>
|
@@ -201,19 +229,23 @@ if (!class_exists('CustomContactForms')) {
|
|
201 |
<option>Textarea</option>
|
202 |
<option>Hidden</option>
|
203 |
<option>Checkbox</option>
|
|
|
|
|
204 |
</select>
|
205 |
</li>
|
206 |
<li>
|
207 |
<label for="field_value">Initial Value:</label>
|
208 |
<input name="field[field_value]" type="text" maxlength="50" /><br />
|
209 |
-
(This is the initial value of the field. If you set the type as checkbox, it is recommend you set this to what the checkbox is implying. For example if I were creating the checkbox
|
|
|
|
|
210 |
</li>
|
211 |
<li>
|
212 |
<label for="field_maxlength">Max Length:</label>
|
213 |
<input class="width50" size="10" name="field[field_maxlength]" type="text" maxlength="4" />
|
214 |
<br />(0 for no limit; only applies to Text fields)</li>
|
215 |
<li>
|
216 |
-
<label for="field_required"
|
217 |
<select name="field[field_required]"><option value="0">No</option><option value="1">Yes</option></select><br />
|
218 |
(If a field is required and a user leaves it blank, the plugin will display an error message explainging the problem.)</li>
|
219 |
<li>
|
@@ -234,7 +266,7 @@ if (!class_exists('CustomContactForms')) {
|
|
234 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
235 |
<ul>
|
236 |
<li>
|
237 |
-
<label for="form[form_name]"
|
238 |
<input type="text" maxlength="100" name="form[form_slug]" /><br />
|
239 |
(Must be unique and contain only underscores and alphanumeric characters.)</li>
|
240 |
<li>
|
@@ -242,7 +274,7 @@ if (!class_exists('CustomContactForms')) {
|
|
242 |
<input type="text" maxlength="200" name="form[form_title]" />
|
243 |
(The form header text)</li>
|
244 |
<li>
|
245 |
-
<label for="form[form_method]"
|
246 |
<select name="form[form_method]">
|
247 |
<option>Post</option>
|
248 |
<option>Get</option>
|
@@ -250,8 +282,8 @@ if (!class_exists('CustomContactForms')) {
|
|
250 |
(If unsure, leave as is.)</li>
|
251 |
<li>
|
252 |
<label for="form[form_action]">Form Action:</label>
|
253 |
-
<input type="text" name="form[form_action]" value="" />
|
254 |
-
(If unsure, leave blank.)</li>
|
255 |
<li>
|
256 |
<label for="form[form_action]">Form Style:</label>
|
257 |
<select name="form[form_style]"><?php echo $style_options; ?></select>
|
@@ -305,12 +337,13 @@ if (!class_exists('CustomContactForms')) {
|
|
305 |
$fields = parent::selectAllFields();
|
306 |
for ($i = 0, $z = 0; $i < count($fields); $i++, $z++) {
|
307 |
if ($fields[$i]->user_field == 0) { $z--; continue; }
|
308 |
-
|
|
|
309 |
$field_types = str_replace('<option>'.$fields[$i]->field_type.'</option>', '<option selected="selected">'.$fields[$i]->field_type.'</option>', $field_types);
|
310 |
|
311 |
?>
|
312 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
313 |
-
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"';
|
314 |
|
315 |
<td><input type="text" name="field[field_slug]" class="width100" maxlength="50" value="<?php echo $fields[$i]->field_slug; ?>" /></td>
|
316 |
<td><input type="text" name="field[field_label]" maxlength="100" value="<?php echo $fields[$i]->field_label; ?>" /></td>
|
@@ -319,15 +352,58 @@ if (!class_exists('CustomContactForms')) {
|
|
319 |
</select></td>
|
320 |
<td><input type="text" name="field[field_value]" maxlength="50" class="width75" value="<?php echo $fields[$i]->field_value; ?>" /></td>
|
321 |
<td><select name="field[field_required]"><option value="1">Yes</option><option value="0" <?php if ($fields[$i]->field_required != 1) echo 'selected="selected"'; ?>>No</option></select></td>
|
322 |
-
<td
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
<td><input type="hidden" name="fid" value="<?php echo $fields[$i]->id; ?>" />
|
324 |
<span class="fields-options-expand"></span>
|
325 |
<input type="submit" name="field_edit" value="Edit" />
|
326 |
-
<input type="submit" name="field_delete" value="Delete" /></td>
|
327 |
|
328 |
</tr>
|
329 |
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"'; ?>>
|
330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
</tr>
|
332 |
</form>
|
333 |
<?php
|
@@ -418,7 +494,65 @@ if (!class_exists('CustomContactForms')) {
|
|
418 |
<th scope="col" class="manage-column field-action">Action</th>
|
419 |
</tr>
|
420 |
</tfoot>
|
421 |
-
</table><a name="manage-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
<h3 class="manage-h3">Manage Forms</h3>
|
423 |
<table class="widefat post" id="manage-forms" cellspacing="0">
|
424 |
<thead>
|
@@ -451,7 +585,7 @@ if (!class_exists('CustomContactForms')) {
|
|
451 |
<td><input type="hidden" name="fid" value="<?php echo $forms[$i]->id; ?>" />
|
452 |
<span class="form-options-expand"></span>
|
453 |
<input type="submit" name="form_edit" value="Edit" />
|
454 |
-
<input type="submit" name="form_delete" value="Delete" />
|
455 |
</td>
|
456 |
</tr>
|
457 |
<tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
|
@@ -476,17 +610,17 @@ if (!class_exists('CustomContactForms')) {
|
|
476 |
</tr>
|
477 |
<tr>
|
478 |
<td colspan="3">
|
479 |
-
<label for="
|
480 |
<?php
|
481 |
$attached_fields = parent::getAttachedFieldsArray($forms[$i]->id);
|
482 |
if (empty($attached_fields)) echo 'None ';
|
483 |
else {
|
484 |
-
echo '<select name="
|
485 |
foreach($attached_fields as $attached_field) {
|
486 |
$this_field = parent::selectField($attached_field, '');
|
487 |
echo $this_field->field_slug . ' <option value="'.$this_field->id.'">'.$this_field->field_slug.'</option>';
|
488 |
}
|
489 |
-
echo '</select> <input type="submit" value="
|
490 |
}
|
491 |
?><br />
|
492 |
<span class="red bold">*</span> Attach fields in the order you want them displayed.
|
@@ -541,10 +675,11 @@ if (!class_exists('CustomContactForms')) {
|
|
541 |
<li class="descrip">Form emails will be sent <span>to</span> this address, if no destination email is specified by the form.</li>
|
542 |
|
543 |
<li>
|
544 |
-
<label for="enable_jquery">
|
545 |
<select name="enable_jquery"><option value="1">Yes</option><option <?php if ($admin_options[enable_jquery] != 1) echo 'selected="selected"'; ?> value="0">No</option></select>
|
546 |
</li>
|
547 |
<li class="descrip">Some plugins don't setup JQuery correctly, so when any other plugin uses JQuery (whether correctly or not), JQuery works for neither plugin. This plugin uses JQuery correctly. If another plugin isn't using JQuery correctly but is more important to you than this one: disable this option. 99% of this plugin's functionality will work without JQuery, just no field instruction tooltips.</li>
|
|
|
548 |
<li>
|
549 |
<label for="default_from_email">Default From Email:</label>
|
550 |
<input name="default_from_email" value="<?php echo $admin_options[default_from_email]; ?>" type="text" maxlength="100" />
|
@@ -647,119 +782,127 @@ if (!class_exists('CustomContactForms')) {
|
|
647 |
<ul class="style_left">
|
648 |
<li>
|
649 |
<label for="style_slug">Style Slug:</label>
|
650 |
-
<input type="text" maxlength="30" name="style[style_slug]" />
|
651 |
(Must be unique)</li>
|
652 |
<li>
|
653 |
<label for="title_fontsize">Title Font Size:</label>
|
654 |
-
<input type="text" maxlength="20" value="1.2em" name="style[title_fontsize]" />
|
655 |
(ex: 10pt, 10px, 1em)</li>
|
656 |
<li>
|
657 |
<label for="title_fontcolor">Title Font Color:</label>
|
658 |
-
<input type="text" maxlength="20" value="#333333" value="#" name="style[title_fontcolor]" />
|
659 |
(ex: #FF0000 or red)</li>
|
660 |
<li>
|
661 |
<label for="label_width">Label Width:</label>
|
662 |
-
<input type="text" maxlength="20" value="110px" name="style[label_width]" />
|
663 |
(ex: 100px or 20%)</li>
|
664 |
<li>
|
665 |
<label for="label_fontsize">Label Font Size:</label>
|
666 |
-
<input type="text" maxlength="20" value="1em" name="style[label_fontsize]" />
|
667 |
(ex: 10px, 10pt, 1em)</li>
|
668 |
<li>
|
669 |
<label for="label_fontcolor">Label Font Color:</label>
|
670 |
-
<input type="text" maxlength="20" value="#333333" name="style[label_fontcolor]" />
|
671 |
(ex: #FF0000 or red)</li>
|
672 |
<li>
|
673 |
<label for="input_width">Text Field Width:</label>
|
674 |
-
<input type="text" maxlength="20" value="200px" name="style[input_width]" />
|
675 |
(ex: 100px or 100%)</li>
|
676 |
<li>
|
677 |
<label for="textarea_width">Textarea Field Width:</label>
|
678 |
-
<input type="text" maxlength="20" value="200px" name="style[textarea_width]" />
|
679 |
(ex: 100px or 100%)</li>
|
680 |
<li>
|
681 |
<label for="textarea_height">Textarea Field Height:</label>
|
682 |
-
<input type="text" maxlength="20" value="100px" name="style[textarea_height]" />
|
683 |
(ex: 100px or 100%)</li>
|
684 |
<li>
|
685 |
<label for="field_fontsize">Field Font Size:</label>
|
686 |
-
<input type="text" maxlength="20" value="1em" name="style[field_fontsize]" />
|
687 |
(ex: 10px, 10pt, 1em</li>
|
688 |
<li>
|
689 |
<label for="field_fontcolor">Field Font Color:</label>
|
690 |
-
<input type="text" maxlength="20" value="#333333" name="style[field_fontcolor]" />
|
691 |
(ex: 100px or 100%)</li>
|
692 |
<li>
|
693 |
<label for="field_borderstyle">Field Border Style:</label>
|
694 |
-
<select name="style[field_borderstyle]"><?php echo str_replace('<option>solid</option>', '<option selected="selected">solid</option>', $border_style_options); ?></select>
|
695 |
</li>
|
696 |
<li>
|
697 |
<label for="form_margin">Form Margin:</label>
|
698 |
-
<input type="text" maxlength="20" value="5px" name="style[form_margin]" />
|
699 |
(ex: 5px or 1em)</li>
|
700 |
<li>
|
701 |
<label for="label_margin">Label Margin:</label>
|
702 |
-
<input type="text" maxlength="20" value="4px" name="style[label_margin]" />
|
703 |
(ex: 5px or 1em)</li>
|
704 |
<li>
|
705 |
<label for="textarea_backgroundcolor">Textarea Background Color:</label>
|
706 |
-
<input type="text" maxlength="20" value="#
|
707 |
(ex: #FF0000 or red)</li>
|
|
|
708 |
</ul>
|
709 |
<ul class="style_right">
|
710 |
<li>
|
711 |
<label for="input_width">Field Border Color:</label>
|
712 |
-
<input type="text" maxlength="20" value="#333333" name="style[field_bordercolor]" />
|
713 |
(ex: 100px or 100%)</li>
|
714 |
<li>
|
715 |
<label for="form_borderstyle">Form Border Style:</label>
|
716 |
-
<select name="style[form_borderstyle]"><?php echo str_replace('<option>solid</option>', '<option selected="selected">solid</option>', $border_style_options); ?></select>
|
717 |
</li>
|
718 |
<li>
|
719 |
<label for="form_bordercolor">Form Border Color:</label>
|
720 |
-
<input type="text" maxlength="20" value="#333333" name="style[form_bordercolor]" />
|
721 |
(ex: #00000 or red)</li>
|
722 |
<li>
|
723 |
<label for="form_borderwidth">Form Border Width:</label>
|
724 |
-
<input type="text" maxlength="20" value="1px" name="style[form_borderwidth]" />
|
725 |
(ex: 1px)</li>
|
726 |
<li>
|
727 |
<label for="form_borderwidth">Form Width:</label>
|
728 |
-
<input type="text" maxlength="20" value="500px" name="style[form_width]" />
|
729 |
(ex: 100px or 50%)</li>
|
730 |
<li>
|
731 |
<label for="form_borderwidth">Form Font Family:</label>
|
732 |
-
<input type="text" maxlength="150" value="Verdana, tahoma, arial" name="style[form_fontfamily]" />
|
733 |
(ex: Verdana, Tahoma, Arial)</li>
|
734 |
<li>
|
735 |
<label for="submit_width">Button Width:</label>
|
736 |
-
<input type="text" maxlength="20" value="80px" name="style[submit_width]" />
|
737 |
(ex: 100px or 30%)</li>
|
738 |
<li>
|
739 |
<label for="submit_height">Button Height:</label>
|
740 |
-
<input type="text" maxlength="20" value="35px" name="style[submit_height]" />
|
741 |
(ex: 100px or 30%)</li>
|
742 |
<li>
|
743 |
<label for="submit_fontsize">Button Font Size:</label>
|
744 |
-
<input type="text" maxlength="20" value="1.1em" name="style[submit_fontsize]" />
|
745 |
(ex: 10px, 10pt, 1em</li>
|
746 |
<li>
|
747 |
<label for="submit_fontcolor">Button Font Color:</label>
|
748 |
-
<input type="text" maxlength="20" value="#333333" name="style[submit_fontcolor]" />
|
749 |
(ex: #FF0000 or red)</li>
|
750 |
<li>
|
751 |
<label for="field_backgroundcolor">Field Background Color:</label>
|
752 |
-
<input type="text" maxlength="20" value="#efefef" name="style[field_backgroundcolor]" />
|
753 |
(ex: #FF0000 or red)</li>
|
754 |
<li>
|
755 |
<label for="form_padding">Form Padding:</label>
|
756 |
-
<input type="text" maxlength="20" value="5px" name="style[form_padding]" />
|
757 |
(ex: 5px or 1em)</li>
|
758 |
<li>
|
759 |
<label for="title_margin">Title Margin:</label>
|
760 |
-
<input type="text" maxlength="20" value="2px" name="style[title_margin]" />
|
761 |
(ex: 5px or 1em)</li>
|
762 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
<li>
|
764 |
<input type="submit" value="Create Style" name="style_create" />
|
765 |
</li>
|
@@ -790,8 +933,9 @@ if (!class_exists('CustomContactForms')) {
|
|
790 |
<td><label>Slug:</label> <input type="text" maxlength="30" value="<?php echo $style->style_slug; ?>" name="style[style_slug]" /><br />
|
791 |
<label>Font Family:</label><input type="text" maxlength="20" value="<?php echo $style->form_fontfamily; ?>" name="style[form_fontfamily]" /><br />
|
792 |
<label>Textarea Background<br />Color:</label><input type="text" maxlength="20" value="<?php echo $style->textarea_backgroundcolor; ?>" name="style[textarea_backgroundcolor]" /><br />
|
|
|
793 |
<input type="submit" class="submit-styles" name="style_edit" value="Update Style" /><br />
|
794 |
-
<input type="submit" class="submit-styles" name="style_delete" value="Delete Style" />
|
795 |
</td>
|
796 |
|
797 |
<td>
|
@@ -799,6 +943,7 @@ if (!class_exists('CustomContactForms')) {
|
|
799 |
<label>Text Field Width:</label><input type="text" maxlength="20" value="<?php echo $style->input_width; ?>" name="style[input_width]" /><br />
|
800 |
<label>Textarea Width:</label><input type="text" maxlength="20" value="<?php echo $style->textarea_width; ?>" name="style[textarea_width]" /><br />
|
801 |
<label>Textarea Height:</label><input type="text" maxlength="20" value="<?php echo $style->textarea_height; ?>" name="style[textarea_height]" /><br />
|
|
|
802 |
<label>Label Margin:</label><input type="text" maxlength="20" value="<?php echo $style->label_margin; ?>" name="style[label_margin]" />
|
803 |
</td>
|
804 |
<td>
|
@@ -889,10 +1034,12 @@ if (!class_exists('CustomContactForms')) {
|
|
889 |
<input type="hidden" name="thank_you_page" value="http://www.google.com" />
|
890 |
<input type="hidden" name="destination_email" value="<?php echo $admin_options[default_to_email]; ?>" />
|
891 |
<input type="hidden" name="required_fields" value="field_name1, field_name2" />
|
|
|
892 |
<!-- Build your form in here. It is recommended you only use this feature if you are experienced with HTML.
|
893 |
The success_message field will add a popover containing the message when the form is completed successfully, the thank_you_page field will force
|
894 |
the user to be redirected to that specific page on successful form completion. The required_fields hidden field is optional; to use it seperate
|
895 |
the field names you want required by commas. Remember to use underscores instead of spaces in field names! -->
|
|
|
896 |
</form></textarea>
|
897 |
</div>
|
898 |
</div>
|
@@ -937,7 +1084,16 @@ the field names you want required by commas. Remember to use underscores instead
|
|
937 |
$fields = parent::selectAllFields();
|
938 |
$out = '';
|
939 |
foreach ($fields as $field) {
|
940 |
-
$out .= '<option value="'.$field->id.'">'.$field->field_slug.'</option>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
941 |
}
|
942 |
return $out;
|
943 |
}
|
@@ -1046,6 +1202,29 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1046 |
$out .= '<div>'."\n".'<input '.$instructions.' type="checkbox" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'" '.$input_id.''.$code_type.'> '."\n".'<label class="checkbox" for="'.parent::decodeOption($field->field_slug, 1, 1).'">' . $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'</div>' . "\n";
|
1047 |
} elseif ($field->field_type == 'Textarea') {
|
1048 |
$out .= '<div>'."\n".'<label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'<textarea '.$instructions.' '.$input_id.' rows="5" cols="40" name="'.parent::decodeOption($field->field_slug, 1, 1).'">'.$field_value.'</textarea>'."\n".'</div>' . "\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1049 |
}
|
1050 |
}
|
1051 |
$submit_text = (!empty($form->submit_button_text)) ? parent::decodeOption($form->submit_button_text, 1, 0) : 'Submit';
|
@@ -1055,11 +1234,14 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1055 |
if ($form->form_style != 0) {
|
1056 |
$form_styles .= '<style type="text/css">' . "\n";
|
1057 |
$form_styles .= '#' . $form_id . " { width: ".$style->form_width."; padding:".$style->form_padding."; margin:".$style->form_margin."; border:".$style->form_borderwidth." ".$style->form_borderstyle." ".$style->form_bordercolor."; font-family:".$style->form_fontfamily."; }\n";
|
1058 |
-
|
1059 |
$form_styles .= '#' . $form_id . " h4 { padding:0; margin:".$style->title_margin." ".$style->title_margin." ".$style->title_margin." 0; color:".$style->title_fontcolor."; font-size:".$style->title_fontsize."; } \n";
|
1060 |
$form_styles .= '#' . $form_id . " label { padding:0; margin:".$style->label_margin." ".$style->label_margin." ".$style->label_margin." 0; display:block; color:".$style->label_fontcolor."; width:".$style->label_width."; font-size:".$style->label_fontsize."; } \n";
|
1061 |
-
$form_styles .= '#' . $form_id . "
|
1062 |
-
$form_styles .= '#' . $form_id . "
|
|
|
|
|
|
|
1063 |
$form_styles .= '#' . $form_id . " .submit { color:".$style->submit_fontcolor."; width:".$style->submit_width."; height:".$style->submit_height."; font-size:".$style->submit_fontsize."; } \n";
|
1064 |
$form_styles .= '#' . $form_id . " textarea { color:".$style->field_fontcolor."; width:".$style->textarea_width."; margin:0; background-color:".$style->textarea_backgroundcolor."; height:".$style->textarea_height."; font-size:".$style->field_fontsize."; border:1px ".$style->field_borderstyle." ".$style->field_bordercolor."; } \n";
|
1065 |
$form_styles .= '</style>' . "\n";
|
@@ -1097,12 +1279,32 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1097 |
}
|
1098 |
|
1099 |
function insertFormSuccessCode() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1100 |
?>
|
1101 |
<div id="ccf-form-success">
|
1102 |
-
<h5><?php echo $
|
1103 |
-
<p><?php echo $
|
1104 |
<a href="javascript:void(0)" class="close">[close]</a>
|
1105 |
</div>
|
|
|
1106 |
<?php
|
1107 |
}
|
1108 |
|
@@ -1138,6 +1340,7 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1138 |
if ($_POST[thank_you_page])
|
1139 |
header("Location: " . $_POST[thank_you_page]);
|
1140 |
$this->current_thank_you_message = (!empty($_POST[success_message])) ? $_POST[success_message] : $admin_options[form_success_message];
|
|
|
1141 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1142 |
}
|
1143 |
} elseif ($_POST[customcontactforms_submit]) {
|
@@ -1159,8 +1362,10 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1159 |
} elseif ($field->field_slug == 'fixedEmail' && $field->field_required == 1 && !empty($_POST[fixedEmail])) {
|
1160 |
if (!$this->validEmail($_POST[fixedEmail])) $this->setFormError('bad_email', 'The email address you provided was invalid.');
|
1161 |
} else {
|
1162 |
-
if ($field->field_required == 1 && empty($_POST[$field->field_slug]))
|
1163 |
-
$
|
|
|
|
|
1164 |
} if ($field->field_type == 'Checkbox')
|
1165 |
$checks[] = $field->field_slug;
|
1166 |
}
|
@@ -1168,9 +1373,10 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1168 |
foreach ($_POST as $key => $value) {
|
1169 |
$_SESSION[fields][$key] = $value;
|
1170 |
$field = parent::selectField('', $key);
|
1171 |
-
if (!array_key_exists($key, $this->fixed_fields) or $key == 'fixedEmail')
|
1172 |
-
$
|
1173 |
-
|
|
|
1174 |
$checks_key = array_search($key, $checks);
|
1175 |
unset($checks[$checks_key]);
|
1176 |
}
|
@@ -1189,8 +1395,7 @@ the field names you want required by commas. Remember to use underscores instead
|
|
1189 |
if (!empty($form->form_thank_you_page)) {
|
1190 |
header("Location: " . $form->form_thank_you_page);
|
1191 |
}
|
1192 |
-
$this->
|
1193 |
-
$this->current_thank_you_message_title = (!empty($form->form_success_title)) ? $form->form_success_title : $admin_options[form_success_message_title];
|
1194 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1195 |
}
|
1196 |
unset($_POST);
|
@@ -1209,25 +1414,28 @@ if (!function_exists('CustomContactForms_ap')) {
|
|
1209 |
}
|
1210 |
}
|
1211 |
}
|
|
|
1212 |
if (!function_exists('serveCustomContactForm')) {
|
1213 |
function serveCustomContactForm($fid) {
|
1214 |
global $customcontact;
|
1215 |
echo $customcontact->getFormCode($fid);
|
1216 |
}
|
1217 |
}
|
|
|
1218 |
if (!function_exists('CCFWidgetInit')) {
|
1219 |
function CCFWidgetInit() {
|
1220 |
register_widget('CustomContactFormsWidget');
|
1221 |
}
|
1222 |
}
|
|
|
1223 |
if (isset($customcontact)) {
|
1224 |
add_action('init', array(&$customcontact, 'init'), 1);
|
|
|
1225 |
add_action('wp_print_scripts', array(&$customcontact, 'insertFrontEndScripts'), 1);
|
1226 |
add_action('admin_print_scripts', array(&$customcontact, 'insertAdminScripts'), 1);
|
1227 |
-
add_action('wp_print_styles', array(&$customcontact, '
|
1228 |
-
add_action('admin_print_styles', array(&$customcontact, '
|
1229 |
add_filter('the_content', array(&$customcontact, 'contentFilter'));
|
1230 |
-
/*add_action('wp_footer', array(&$customcontact, 'insertPopoverCode'));*/
|
1231 |
add_action('widgets_init', 'CCFWidgetInit');
|
1232 |
add_action('admin_menu', 'CustomContactForms_ap');
|
1233 |
}
|
3 |
Plugin Name: Custom Contact Forms
|
4 |
Plugin URI: http://taylorlovett.com/wordpress-plugins
|
5 |
Description: Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form. <a href="options-general.php?page=custom-contact-forms">Settings</a>
|
6 |
+
Version: 3.5.0
|
7 |
Author: Taylor Lovett
|
8 |
Author URI: http://www.taylorlovett.com
|
9 |
*/
|
10 |
+
|
11 |
/*
|
12 |
Copyright (C) 2010-2011 Taylor Lovett, taylorlovett.com (admin@taylorlovett.com)
|
13 |
This program is free software; you can redistribute it and/or modify
|
32 |
var $form_errors;
|
33 |
var $error_return;
|
34 |
var $gets;
|
35 |
+
var $current_form;
|
36 |
var $current_thank_you_message;
|
|
|
37 |
var $fixed_fields = array('customcontactforms_submit' => '',
|
38 |
'fid' => '',
|
39 |
'fixedEmail' => 'Use this field if you want the plugin to throw an error on fake emails.',
|
47 |
$this->form_errors = array();
|
48 |
}
|
49 |
|
50 |
+
function activatePlugin() {
|
51 |
+
parent::createTables();
|
52 |
+
parent::updateTables();
|
53 |
+
parent::insertFixedFields();
|
54 |
+
}
|
55 |
+
|
56 |
function getAdminOptions() {
|
57 |
$admin_email = get_option('admin_email');
|
58 |
$customcontactAdminOptions = array('show_widget_home' => 1, 'show_widget_pages' => 1, 'show_widget_singles' => 1, 'show_widget_categories' => 1, 'show_widget_archives' => 1, 'default_to_email' => $admin_email, 'default_from_email' => $admin_email, 'default_form_subject' => 'Someone Filled Out Your Contact Form!',
|
74 |
}
|
75 |
}
|
76 |
|
77 |
+
function insertFrontEndStyles() {
|
78 |
+
if (!is_admin()) {
|
79 |
+
wp_register_style('CCFStandardsCSS', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/css/custom-contact-forms-standards.css');
|
80 |
+
wp_register_style('CCFFormsCSS', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/css/custom-contact-forms.css');
|
81 |
+
wp_enqueue_style('CCFStandardsCSS');
|
82 |
+
wp_enqueue_style('CCFFormsCSS');
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
function insertBackEndStyles() {
|
87 |
+
wp_register_style('CCFStandardsCSS', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/css/custom-contact-forms-standards.css');
|
88 |
+
wp_register_style('CCFAdminCSS', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/css/custom-contact-forms-admin.css');
|
89 |
+
wp_enqueue_style('CCFStandardsCSS');
|
90 |
+
wp_enqueue_style('CCFAdminCSS');
|
91 |
}
|
92 |
|
93 |
function insertAdminScripts() {
|
|
|
94 |
wp_enqueue_script('ccf-main', get_option('siteurl') . '/wp-content/plugins/custom-contact-forms/js/custom-contact-forms-admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'/*, 'jquery-ui-draggable', 'jquery-ui-resizable', 'jquery-ui-dialog'*/), '1.0');
|
95 |
}
|
96 |
|
162 |
parent::updateForm($_POST[form], $_POST[fid]);
|
163 |
} elseif ($_POST[form_add_field]) {
|
164 |
parent::addFieldToForm($_POST[field_id], $_POST[fid]);
|
165 |
+
} elseif ($_POST[attach_field_option]) {
|
166 |
+
parent::addFieldOptionToField($_POST[attach_option_id], $_POST[fid]);
|
167 |
+
} elseif ($_POST[dettach_field]) {
|
168 |
+
parent::dettachField($_POST[dettach_field_id], $_POST[fid]);
|
169 |
+
} elseif ($_POST[dettach_field_option]) {
|
170 |
+
parent::dettachFieldOption($_POST[dettach_option_id], $_POST[fid]);
|
171 |
} elseif ($_POST[style_create]) {
|
172 |
parent::insertStyle($_POST[style]);
|
173 |
} elseif ($_POST[style_edit]) {
|
177 |
} elseif ($_POST[contact_author]) {
|
178 |
$this_url = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : $_SERVER['SERVER_NAME'];
|
179 |
$this->contactAuthor($_POST[name], $_POST[email], $this_url, $_POST[message], $_POST[type]);
|
180 |
+
} elseif ($_POST[delete_field_option]) {
|
181 |
+
parent::deleteFieldOption($_POST[oid]);
|
182 |
+
} elseif ($_POST[edit_field_option]) {
|
183 |
+
parent::updateFieldOption($_POST[option], $_POST[oid]);
|
184 |
+
} elseif ($_POST[create_field_option]) {
|
185 |
+
parent::insertFieldOption($_POST[option]);
|
186 |
}
|
187 |
$styles = parent::selectAllStyles();
|
188 |
$style_options = '<option value="0">None</option>';
|
202 |
<li><a href="#manage-forms">Manage Forms</a></li>
|
203 |
<li><a href="#create-styles">Create Styles</a></li>
|
204 |
<li><a href="#manage-styles">Manage Styles</a></li>
|
205 |
+
<li><a href="#manage-field-options">Manage Field Options</a></li>
|
206 |
<li><a href="#contact-author">Suggest a Feature</a></li>
|
207 |
<li><a href="#contact-author">Bug Report</a></li>
|
208 |
<li><a href="#custom-html">Custom HTML Forms (New!)</a></li>
|
215 |
<ul>
|
216 |
<li>
|
217 |
<label for="field_slug">* Slug (Name):</label>
|
218 |
+
<input name="field[field_slug]" type="text" maxlength="50" /><br />
|
219 |
(A slug is simply a way to identify your form. It can only contain underscores, letters, and numbers and must be unique.)</li>
|
220 |
<li>
|
221 |
<label for="field_label">Field Label:</label>
|
229 |
<option>Textarea</option>
|
230 |
<option>Hidden</option>
|
231 |
<option>Checkbox</option>
|
232 |
+
<option>Radio</option>
|
233 |
+
<option>Dropdown</option>
|
234 |
</select>
|
235 |
</li>
|
236 |
<li>
|
237 |
<label for="field_value">Initial Value:</label>
|
238 |
<input name="field[field_value]" type="text" maxlength="50" /><br />
|
239 |
+
(This is the initial value of the field. If you set the type as checkbox, it is recommend you set this to what the checkbox is implying. For example if I were creating the checkbox
|
240 |
+
"Are you human?", I would set the initial value to "Yes". If you set the field type as "Dropdown" or "Radio", you should enter the slug of the
|
241 |
+
<a href="#manage-field-options" title="Create a Field Option">field option</a> you would like initially selected.)
|
242 |
</li>
|
243 |
<li>
|
244 |
<label for="field_maxlength">Max Length:</label>
|
245 |
<input class="width50" size="10" name="field[field_maxlength]" type="text" maxlength="4" />
|
246 |
<br />(0 for no limit; only applies to Text fields)</li>
|
247 |
<li>
|
248 |
+
<label for="field_required">* Required Field:</label>
|
249 |
<select name="field[field_required]"><option value="0">No</option><option value="1">Yes</option></select><br />
|
250 |
(If a field is required and a user leaves it blank, the plugin will display an error message explainging the problem.)</li>
|
251 |
<li>
|
266 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
267 |
<ul>
|
268 |
<li>
|
269 |
+
<label for="form[form_name]">* Form Slug:</label>
|
270 |
<input type="text" maxlength="100" name="form[form_slug]" /><br />
|
271 |
(Must be unique and contain only underscores and alphanumeric characters.)</li>
|
272 |
<li>
|
274 |
<input type="text" maxlength="200" name="form[form_title]" />
|
275 |
(The form header text)</li>
|
276 |
<li>
|
277 |
+
<label for="form[form_method]">* Form Method:</label>
|
278 |
<select name="form[form_method]">
|
279 |
<option>Post</option>
|
280 |
<option>Get</option>
|
282 |
(If unsure, leave as is.)</li>
|
283 |
<li>
|
284 |
<label for="form[form_action]">Form Action:</label>
|
285 |
+
<input type="text" name="form[form_action]" value="" /><br />
|
286 |
+
(If unsure, leave blank. Enter a URL here, if and only if you want to process your forms somewhere else, for example with a service like Aweber or InfusionSoft.)</li>
|
287 |
<li>
|
288 |
<label for="form[form_action]">Form Style:</label>
|
289 |
<select name="form[form_style]"><?php echo $style_options; ?></select>
|
337 |
$fields = parent::selectAllFields();
|
338 |
for ($i = 0, $z = 0; $i < count($fields); $i++, $z++) {
|
339 |
if ($fields[$i]->user_field == 0) { $z--; continue; }
|
340 |
+
$attached_options = parent::getAttachedFieldOptionsArray($fields[$i]->id);
|
341 |
+
$field_types = '<option>Text</option><option>Textarea</option><option>Hidden</option><option>Checkbox</option><option>Radio</option><option>Dropdown</option>';
|
342 |
$field_types = str_replace('<option>'.$fields[$i]->field_type.'</option>', '<option selected="selected">'.$fields[$i]->field_type.'</option>', $field_types);
|
343 |
|
344 |
?>
|
345 |
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
346 |
+
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"'; ?> style="border-bottom">
|
347 |
|
348 |
<td><input type="text" name="field[field_slug]" class="width100" maxlength="50" value="<?php echo $fields[$i]->field_slug; ?>" /></td>
|
349 |
<td><input type="text" name="field[field_label]" maxlength="100" value="<?php echo $fields[$i]->field_label; ?>" /></td>
|
352 |
</select></td>
|
353 |
<td><input type="text" name="field[field_value]" maxlength="50" class="width75" value="<?php echo $fields[$i]->field_value; ?>" /></td>
|
354 |
<td><select name="field[field_required]"><option value="1">Yes</option><option value="0" <?php if ($fields[$i]->field_required != 1) echo 'selected="selected"'; ?>>No</option></select></td>
|
355 |
+
<td>
|
356 |
+
<?php if ($fields[$i]->field_type == 'Dropdown' || $fields[$i]->field_type == 'Radio') { ?>
|
357 |
+
<b>-</b>
|
358 |
+
<?php } else { ?>
|
359 |
+
<input type="text" class="width50" name="field[field_maxlength]" value="<?php echo $fields[$i]->field_maxlength; ?>" />
|
360 |
+
<?php } ?>
|
361 |
+
</td>
|
362 |
<td><input type="hidden" name="fid" value="<?php echo $fields[$i]->id; ?>" />
|
363 |
<span class="fields-options-expand"></span>
|
364 |
<input type="submit" name="field_edit" value="Edit" />
|
365 |
+
<input type="submit" name="field_delete" class="delete_button" value="Delete" /></td>
|
366 |
|
367 |
</tr>
|
368 |
<tr<?php if ($z % 2 == 1) echo ' class="evenrow"'; ?>>
|
369 |
+
<td class="fields-extra-options" colspan="7" style="border-top:0; border-bottom:1px solid black;">
|
370 |
+
<div class="field-instructions">
|
371 |
+
<label for="field_instructions">Field Instructions:</label>
|
372 |
+
<input type="text" class="width150" name="field[field_instructions]" value="<?php echo $fields[$i]->field_instructions; ?>" />
|
373 |
+
</div>
|
374 |
+
<?php
|
375 |
+
if ($fields[$i]->field_type == 'Radio' || $fields[$i]->field_type == 'Dropdown') { ?>
|
376 |
+
<div class="dettach-field-options">
|
377 |
+
<?php if (empty($attached_options)) { ?>
|
378 |
+
<b>No Attached Options</b>
|
379 |
+
<?php } else { ?>
|
380 |
+
<select name="dettach_option_id">
|
381 |
+
<?php
|
382 |
+
foreach ($attached_options as $option_id) {
|
383 |
+
$option = parent::selectFieldOption($option_id);
|
384 |
+
?>
|
385 |
+
<option value="<?php echo $option_id; ?>"><?php echo $option->option_slug; ?></option>
|
386 |
+
<?php
|
387 |
+
}
|
388 |
+
?>
|
389 |
+
</select>
|
390 |
+
<input type="submit" name="dettach_field_option" value="Dettach Field Option" />
|
391 |
+
<?php } ?>
|
392 |
+
<br /><span class="red bold">*</span> Dettach field options you <a href="#create-field-options">create</a>.
|
393 |
+
</div>
|
394 |
+
<?php $all_options = $this->getFieldOptionsForm(); ?>
|
395 |
+
<div class="attach-field-options">
|
396 |
+
<?php if (empty($all_options)) { ?>
|
397 |
+
<b>No Field Options to Attach</b>
|
398 |
+
<?php } else { ?>
|
399 |
+
<select name="attach_option_id">
|
400 |
+
<?php echo $all_options; ?>
|
401 |
+
</select> <input type="submit" name="attach_field_option" value="Attach Field Option" />
|
402 |
+
<?php } ?>
|
403 |
+
<br /><span class="red bold">*</span> Attach field options in the order you want them to display.
|
404 |
+
</div>
|
405 |
+
<?php } ?>
|
406 |
+
</td>
|
407 |
</tr>
|
408 |
</form>
|
409 |
<?php
|
494 |
<th scope="col" class="manage-column field-action">Action</th>
|
495 |
</tr>
|
496 |
</tfoot>
|
497 |
+
</table><a name="manage-field-options"></a>
|
498 |
+
<div id="field-options" class="postbox">
|
499 |
+
<h3 class="hndle"><span>Manage Field Options (for Dropdown and Radio Fields)</span></h3>
|
500 |
+
<div class="inside">
|
501 |
+
<div class="option-header">
|
502 |
+
<div class="slug">Slug</div>
|
503 |
+
<div class="label">Label</div>
|
504 |
+
<div class="option-value">Value</div>
|
505 |
+
<div class="action">Action</div>
|
506 |
+
</div>
|
507 |
+
<table id="edit-field-options">
|
508 |
+
<?php
|
509 |
+
$options = parent::selectAllFieldOptions();
|
510 |
+
$i = 0;
|
511 |
+
foreach ($options as $option) {
|
512 |
+
?>
|
513 |
+
<tr<?php if ($i % 2 == 1) echo ' class="evenrow-field-options"'; ?>>
|
514 |
+
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']?>">
|
515 |
+
<td class="slug"><input type="text" maxlength="20" name="option[option_slug]" value="<?php echo $option->option_slug; ?>" class="width50" /></td>
|
516 |
+
<td class="label"><input type="text" name="option[option_label]" value="<?php echo $option->option_label; ?>" class="width100" /></td>
|
517 |
+
<td class="option-value"><input type="text" name="option[option_value]" value="<?php echo $option->option_value; ?>" class="width100" /></td>
|
518 |
+
<td class="action">
|
519 |
+
<input type="submit" value="Edit" name="edit_field_option" />
|
520 |
+
<input type="submit"class="delete_button" value="Delete" name="delete_field_option" />
|
521 |
+
</td>
|
522 |
+
<input type="hidden" name="oid" value="<?php echo $option->id; ?>" />
|
523 |
+
</form>
|
524 |
+
</tr>
|
525 |
+
<?php
|
526 |
+
$i++;
|
527 |
+
} if (empty($options)) {
|
528 |
+
?>
|
529 |
+
<tr><td class="ccf-center">No field options have been created.</td></tr>
|
530 |
+
<?php
|
531 |
+
}
|
532 |
+
?>
|
533 |
+
</table>
|
534 |
+
<div class="option-header">
|
535 |
+
<div class="slug">Slug</div>
|
536 |
+
<div class="label">Label</div>
|
537 |
+
<div class="option-value">Value</div>
|
538 |
+
<div class="action">Action</div>
|
539 |
+
</div>
|
540 |
+
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']?>">
|
541 |
+
<div class="create-field-options-header">Create a Field Option</div>
|
542 |
+
<ul id="create-field-options">
|
543 |
+
<li><label for="option[option_slug]">Option Slug:</label> <input maxlength="20" type="text" name="option[option_slug]" /><br />
|
544 |
+
(Used to identify this option, solely for admin purposes; must be unique, and contain only letters, numbers, and underscores. Example: "slug_one")</li>
|
545 |
+
<li><label for="option[option_label]">Option Label:</label> <input type="text" name="option[option_label]" /><br />
|
546 |
+
(This is what is shown to the user in the dropdown or radio field. Example:)</li>
|
547 |
+
<li><label for="option[option_value]">Option Value:</label> <input type="text" name="option[option_value]" /><br />
|
548 |
+
(This is the actual value of the option which isn't shown to the user. This can be the same thing as the label. An example pairing of label => value is: "The color green" => "green" or "Yes" => "1".)</li>
|
549 |
+
<li><input type="submit" name="create_field_option" value="Create Field Option" /></li>
|
550 |
+
</ul>
|
551 |
+
<p id="edit-field-comments"><b>*</b> The option value is behind the scences; unseen by the user, but when a user fills out the form, the option value is what is actually sent in the email to you. For dropdown fields the option value is optional, for radio fields it is required.</p>
|
552 |
+
</form>
|
553 |
+
</div>
|
554 |
+
</div>
|
555 |
+
<a name="manage-forms"></a>
|
556 |
<h3 class="manage-h3">Manage Forms</h3>
|
557 |
<table class="widefat post" id="manage-forms" cellspacing="0">
|
558 |
<thead>
|
585 |
<td><input type="hidden" name="fid" value="<?php echo $forms[$i]->id; ?>" />
|
586 |
<span class="form-options-expand"></span>
|
587 |
<input type="submit" name="form_edit" value="Edit" />
|
588 |
+
<input type="submit" name="form_delete" class="delete_button" value="Delete" />
|
589 |
</td>
|
590 |
</tr>
|
591 |
<tr class="<?php if ($i % 2 == 0) echo 'evenrow'; ?>">
|
610 |
</tr>
|
611 |
<tr>
|
612 |
<td colspan="3">
|
613 |
+
<label for="dettach_field_id"><span>Attached Fields:</span></label>
|
614 |
<?php
|
615 |
$attached_fields = parent::getAttachedFieldsArray($forms[$i]->id);
|
616 |
if (empty($attached_fields)) echo 'None ';
|
617 |
else {
|
618 |
+
echo '<select name="dettach_field_id">';
|
619 |
foreach($attached_fields as $attached_field) {
|
620 |
$this_field = parent::selectField($attached_field, '');
|
621 |
echo $this_field->field_slug . ' <option value="'.$this_field->id.'">'.$this_field->field_slug.'</option>';
|
622 |
}
|
623 |
+
echo '</select> <input type="submit" value="Dettach Field" name="dettach_field" />';
|
624 |
}
|
625 |
?><br />
|
626 |
<span class="red bold">*</span> Attach fields in the order you want them displayed.
|
675 |
<li class="descrip">Form emails will be sent <span>to</span> this address, if no destination email is specified by the form.</li>
|
676 |
|
677 |
<li>
|
678 |
+
<label for="enable_jquery">Enable JQuery:</label>
|
679 |
<select name="enable_jquery"><option value="1">Yes</option><option <?php if ($admin_options[enable_jquery] != 1) echo 'selected="selected"'; ?> value="0">No</option></select>
|
680 |
</li>
|
681 |
<li class="descrip">Some plugins don't setup JQuery correctly, so when any other plugin uses JQuery (whether correctly or not), JQuery works for neither plugin. This plugin uses JQuery correctly. If another plugin isn't using JQuery correctly but is more important to you than this one: disable this option. 99% of this plugin's functionality will work without JQuery, just no field instruction tooltips.</li>
|
682 |
+
|
683 |
<li>
|
684 |
<label for="default_from_email">Default From Email:</label>
|
685 |
<input name="default_from_email" value="<?php echo $admin_options[default_from_email]; ?>" type="text" maxlength="100" />
|
782 |
<ul class="style_left">
|
783 |
<li>
|
784 |
<label for="style_slug">Style Slug:</label>
|
785 |
+
<input type="text" maxlength="30" class="width75" name="style[style_slug]" />
|
786 |
(Must be unique)</li>
|
787 |
<li>
|
788 |
<label for="title_fontsize">Title Font Size:</label>
|
789 |
+
<input type="text" maxlength="20" value="1.2em" class="width75" name="style[title_fontsize]" />
|
790 |
(ex: 10pt, 10px, 1em)</li>
|
791 |
<li>
|
792 |
<label for="title_fontcolor">Title Font Color:</label>
|
793 |
+
<input type="text" maxlength="20" value="#333333" value="#" class="width75" name="style[title_fontcolor]" />
|
794 |
(ex: #FF0000 or red)</li>
|
795 |
<li>
|
796 |
<label for="label_width">Label Width:</label>
|
797 |
+
<input type="text" maxlength="20" value="110px" class="width75" name="style[label_width]" />
|
798 |
(ex: 100px or 20%)</li>
|
799 |
<li>
|
800 |
<label for="label_fontsize">Label Font Size:</label>
|
801 |
+
<input type="text" maxlength="20" value="1em" class="width75" name="style[label_fontsize]" />
|
802 |
(ex: 10px, 10pt, 1em)</li>
|
803 |
<li>
|
804 |
<label for="label_fontcolor">Label Font Color:</label>
|
805 |
+
<input type="text" maxlength="20" value="#333333" class="width75" name="style[label_fontcolor]" />
|
806 |
(ex: #FF0000 or red)</li>
|
807 |
<li>
|
808 |
<label for="input_width">Text Field Width:</label>
|
809 |
+
<input type="text" maxlength="20" value="200px" class="width75" name="style[input_width]" />
|
810 |
(ex: 100px or 100%)</li>
|
811 |
<li>
|
812 |
<label for="textarea_width">Textarea Field Width:</label>
|
813 |
+
<input type="text" maxlength="20" value="200px" class="width75" name="style[textarea_width]" />
|
814 |
(ex: 100px or 100%)</li>
|
815 |
<li>
|
816 |
<label for="textarea_height">Textarea Field Height:</label>
|
817 |
+
<input type="text" maxlength="20" value="100px" class="width75" name="style[textarea_height]" />
|
818 |
(ex: 100px or 100%)</li>
|
819 |
<li>
|
820 |
<label for="field_fontsize">Field Font Size:</label>
|
821 |
+
<input type="text" maxlength="20" value="1em" class="width75" name="style[field_fontsize]" />
|
822 |
(ex: 10px, 10pt, 1em</li>
|
823 |
<li>
|
824 |
<label for="field_fontcolor">Field Font Color:</label>
|
825 |
+
<input type="text" maxlength="20" value="#333333" class="width75" name="style[field_fontcolor]" />
|
826 |
(ex: 100px or 100%)</li>
|
827 |
<li>
|
828 |
<label for="field_borderstyle">Field Border Style:</label>
|
829 |
+
<select class="width75" name="style[field_borderstyle]"><?php echo str_replace('<option>solid</option>', '<option selected="selected">solid</option>', $border_style_options); ?></select>
|
830 |
</li>
|
831 |
<li>
|
832 |
<label for="form_margin">Form Margin:</label>
|
833 |
+
<input type="text" maxlength="20" value="5px" class="width75" name="style[form_margin]" />
|
834 |
(ex: 5px or 1em)</li>
|
835 |
<li>
|
836 |
<label for="label_margin">Label Margin:</label>
|
837 |
+
<input type="text" maxlength="20" value="4px" class="width75" name="style[label_margin]" />
|
838 |
(ex: 5px or 1em)</li>
|
839 |
<li>
|
840 |
<label for="textarea_backgroundcolor">Textarea Background Color:</label>
|
841 |
+
<input type="text" maxlength="20" value="#ffffff" class="width75" name="style[textarea_backgroundcolor]" />
|
842 |
(ex: #FF0000 or red)</li>
|
843 |
+
|
844 |
</ul>
|
845 |
<ul class="style_right">
|
846 |
<li>
|
847 |
<label for="input_width">Field Border Color:</label>
|
848 |
+
<input type="text" maxlength="20" value="#333333" class="width75" name="style[field_bordercolor]" />
|
849 |
(ex: 100px or 100%)</li>
|
850 |
<li>
|
851 |
<label for="form_borderstyle">Form Border Style:</label>
|
852 |
+
<select class="width75" name="style[form_borderstyle]"><?php echo str_replace('<option>solid</option>', '<option selected="selected">solid</option>', $border_style_options); ?></select>
|
853 |
</li>
|
854 |
<li>
|
855 |
<label for="form_bordercolor">Form Border Color:</label>
|
856 |
+
<input type="text" maxlength="20" value="#333333" class="width75" name="style[form_bordercolor]" />
|
857 |
(ex: #00000 or red)</li>
|
858 |
<li>
|
859 |
<label for="form_borderwidth">Form Border Width:</label>
|
860 |
+
<input type="text" maxlength="20" value="1px" class="width75" name="style[form_borderwidth]" />
|
861 |
(ex: 1px)</li>
|
862 |
<li>
|
863 |
<label for="form_borderwidth">Form Width:</label>
|
864 |
+
<input type="text" maxlength="20" value="500px" class="width75" name="style[form_width]" />
|
865 |
(ex: 100px or 50%)</li>
|
866 |
<li>
|
867 |
<label for="form_borderwidth">Form Font Family:</label>
|
868 |
+
<input type="text" maxlength="150" value="Verdana, tahoma, arial" class="width75" name="style[form_fontfamily]" />
|
869 |
(ex: Verdana, Tahoma, Arial)</li>
|
870 |
<li>
|
871 |
<label for="submit_width">Button Width:</label>
|
872 |
+
<input type="text" maxlength="20" value="80px" class="width75" name="style[submit_width]" />
|
873 |
(ex: 100px or 30%)</li>
|
874 |
<li>
|
875 |
<label for="submit_height">Button Height:</label>
|
876 |
+
<input type="text" maxlength="20" value="35px" class="width75" name="style[submit_height]" />
|
877 |
(ex: 100px or 30%)</li>
|
878 |
<li>
|
879 |
<label for="submit_fontsize">Button Font Size:</label>
|
880 |
+
<input type="text" maxlength="20" value="1.1em" class="width75" name="style[submit_fontsize]" />
|
881 |
(ex: 10px, 10pt, 1em</li>
|
882 |
<li>
|
883 |
<label for="submit_fontcolor">Button Font Color:</label>
|
884 |
+
<input type="text" maxlength="20" value="#333333" class="width75" name="style[submit_fontcolor]" />
|
885 |
(ex: #FF0000 or red)</li>
|
886 |
<li>
|
887 |
<label for="field_backgroundcolor">Field Background Color:</label>
|
888 |
+
<input type="text" maxlength="20" value="#efefef" class="width75" name="style[field_backgroundcolor]" />
|
889 |
(ex: #FF0000 or red)</li>
|
890 |
<li>
|
891 |
<label for="form_padding">Form Padding:</label>
|
892 |
+
<input type="text" maxlength="20" value="5px" class="width75" name="style[form_padding]" />
|
893 |
(ex: 5px or 1em)</li>
|
894 |
<li>
|
895 |
<label for="title_margin">Title Margin:</label>
|
896 |
+
<input type="text" maxlength="20" value="2px" class="width75" name="style[title_margin]" />
|
897 |
(ex: 5px or 1em)</li>
|
898 |
+
<li>
|
899 |
+
<label for="title_margin">Dropdown Width:</label>
|
900 |
+
<input type="text" maxlength="20" value="auto" class="width75" name="style[dropdown_width]" />
|
901 |
+
(ex: 30px, 20%, or auto)</li>
|
902 |
+
<li>
|
903 |
+
<label for="success_popover_bordercolor">Success Popover Border Color:</label>
|
904 |
+
<input type="text" maxlength="20" value="#efefef" class="width75" name="style[success_popover_bordercolor]" />
|
905 |
+
(ex: #FF0000)</li>
|
906 |
<li>
|
907 |
<input type="submit" value="Create Style" name="style_create" />
|
908 |
</li>
|
933 |
<td><label>Slug:</label> <input type="text" maxlength="30" value="<?php echo $style->style_slug; ?>" name="style[style_slug]" /><br />
|
934 |
<label>Font Family:</label><input type="text" maxlength="20" value="<?php echo $style->form_fontfamily; ?>" name="style[form_fontfamily]" /><br />
|
935 |
<label>Textarea Background<br />Color:</label><input type="text" maxlength="20" value="<?php echo $style->textarea_backgroundcolor; ?>" name="style[textarea_backgroundcolor]" /><br />
|
936 |
+
<label>Success Popover<br />Border Color:</label><input type="text" maxlength="20" value="<?php echo $style->success_popover_bordercolor; ?>" name="style[success_popover_bordercolor]" /><br />
|
937 |
<input type="submit" class="submit-styles" name="style_edit" value="Update Style" /><br />
|
938 |
+
<input type="submit" class="submit-styles" class="delete_button" name="style_delete" value="Delete Style" />
|
939 |
</td>
|
940 |
|
941 |
<td>
|
943 |
<label>Text Field Width:</label><input type="text" maxlength="20" value="<?php echo $style->input_width; ?>" name="style[input_width]" /><br />
|
944 |
<label>Textarea Width:</label><input type="text" maxlength="20" value="<?php echo $style->textarea_width; ?>" name="style[textarea_width]" /><br />
|
945 |
<label>Textarea Height:</label><input type="text" maxlength="20" value="<?php echo $style->textarea_height; ?>" name="style[textarea_height]" /><br />
|
946 |
+
<label>Dropdown Width:</label><input type="text" maxlength="20" value="<?php echo $style->dropdown_width; ?>" name="style[dropdown_width]" />
|
947 |
<label>Label Margin:</label><input type="text" maxlength="20" value="<?php echo $style->label_margin; ?>" name="style[label_margin]" />
|
948 |
</td>
|
949 |
<td>
|
1034 |
<input type="hidden" name="thank_you_page" value="http://www.google.com" />
|
1035 |
<input type="hidden" name="destination_email" value="<?php echo $admin_options[default_to_email]; ?>" />
|
1036 |
<input type="hidden" name="required_fields" value="field_name1, field_name2" />
|
1037 |
+
|
1038 |
<!-- Build your form in here. It is recommended you only use this feature if you are experienced with HTML.
|
1039 |
The success_message field will add a popover containing the message when the form is completed successfully, the thank_you_page field will force
|
1040 |
the user to be redirected to that specific page on successful form completion. The required_fields hidden field is optional; to use it seperate
|
1041 |
the field names you want required by commas. Remember to use underscores instead of spaces in field names! -->
|
1042 |
+
|
1043 |
</form></textarea>
|
1044 |
</div>
|
1045 |
</div>
|
1084 |
$fields = parent::selectAllFields();
|
1085 |
$out = '';
|
1086 |
foreach ($fields as $field) {
|
1087 |
+
$out .= '<option value="'.$field->id.'">'.$field->field_slug.'</option>' . "\n";
|
1088 |
+
}
|
1089 |
+
return $out;
|
1090 |
+
}
|
1091 |
+
|
1092 |
+
function getFieldOptionsForm() {
|
1093 |
+
$options = parent::selectAllFieldOptions();
|
1094 |
+
$out = '';
|
1095 |
+
foreach ($options as $option) {
|
1096 |
+
$out .= '<option value="'.$option->id.'">'.$option->option_slug.'</option>' . "\n";
|
1097 |
}
|
1098 |
return $out;
|
1099 |
}
|
1202 |
$out .= '<div>'."\n".'<input '.$instructions.' type="checkbox" name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($field->field_value, 1, 1).'" '.$input_id.''.$code_type.'> '."\n".'<label class="checkbox" for="'.parent::decodeOption($field->field_slug, 1, 1).'">' . $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'</div>' . "\n";
|
1203 |
} elseif ($field->field_type == 'Textarea') {
|
1204 |
$out .= '<div>'."\n".'<label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'<textarea '.$instructions.' '.$input_id.' rows="5" cols="40" name="'.parent::decodeOption($field->field_slug, 1, 1).'">'.$field_value.'</textarea>'."\n".'</div>' . "\n";
|
1205 |
+
} elseif ($field->field_type == 'Dropdown') {
|
1206 |
+
$field_options = '';
|
1207 |
+
$options = parent::getAttachedFieldOptionsArray($field->id);
|
1208 |
+
foreach ($options as $option_id) {
|
1209 |
+
$option = parent::selectFieldOption($option_id);
|
1210 |
+
$option_sel = ($field->field_value == $option->option_slug) ? ' selected="selected"' : '';
|
1211 |
+
$option_value = (!empty($option->option_value)) ? ' value="' . $option->option_value . '"' : '';
|
1212 |
+
$field_options .= '<option'.$option_sel.''.$option_value.'>' . $option->option_label . '</option>' . "\n";
|
1213 |
+
}
|
1214 |
+
if (!empty($options)) {
|
1215 |
+
if (!$is_sidebar) $out .= '<div>'."\n".'<select '.$instructions.' '.$input_id.' name="'.parent::decodeOption($field->field_slug, 1, 1).'">'."\n".$field_options.'</select>'."\n".'<label class="checkbox" for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'</div>' . "\n";
|
1216 |
+
else $out .= '<div>'."\n".'<label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label>'."\n".'<select '.$instructions.' '.$input_id.' name="'.parent::decodeOption($field->field_slug, 1, 1).'">'."\n".$field_options.'</select>'."\n".'</div>' . "\n";
|
1217 |
+
}
|
1218 |
+
} elseif ($field->field_type == 'Radio') {
|
1219 |
+
$field_options = '';
|
1220 |
+
$options = parent::getAttachedFieldOptionsArray($field->id);
|
1221 |
+
foreach ($options as $option_id) {
|
1222 |
+
$option = parent::selectFieldOption($option_id);
|
1223 |
+
$option_sel = ($field->field_value == $option->option_slug) ? ' checked="checked"' : '';
|
1224 |
+
$field_options .= '<input'.$option_sel.' type="radio" '.$instructions.' name="'.parent::decodeOption($field->field_slug, 1, 1).'" value="'.parent::decodeOption($option->option_value, 1, 1).'"'.$code_type.'> <label class="select" for="'.parent::decodeOption($field->field_slug, 1, 1).'">' . parent::decodeOption($option->option_label, 1, 1) . '</label>' . "\n";
|
1225 |
+
}
|
1226 |
+
$field_label = (!empty($field->field_label)) ? '<label for="'.parent::decodeOption($field->field_slug, 1, 1).'">'. $req .parent::decodeOption($field->field_label, 1, 1).'</label>' : '';
|
1227 |
+
if (!empty($options)) $out .= '<div>'."\n".$field_label."\n".$field_options."\n".'</div>' . "\n";
|
1228 |
}
|
1229 |
}
|
1230 |
$submit_text = (!empty($form->submit_button_text)) ? parent::decodeOption($form->submit_button_text, 1, 0) : 'Submit';
|
1234 |
if ($form->form_style != 0) {
|
1235 |
$form_styles .= '<style type="text/css">' . "\n";
|
1236 |
$form_styles .= '#' . $form_id . " { width: ".$style->form_width."; padding:".$style->form_padding."; margin:".$style->form_margin."; border:".$style->form_borderwidth." ".$style->form_borderstyle." ".$style->form_bordercolor."; font-family:".$style->form_fontfamily."; }\n";
|
1237 |
+
$form_styles .= '#' . $form_id . " div { margin-bottom:6px }\n";
|
1238 |
$form_styles .= '#' . $form_id . " h4 { padding:0; margin:".$style->title_margin." ".$style->title_margin." ".$style->title_margin." 0; color:".$style->title_fontcolor."; font-size:".$style->title_fontsize."; } \n";
|
1239 |
$form_styles .= '#' . $form_id . " label { padding:0; margin:".$style->label_margin." ".$style->label_margin." ".$style->label_margin." 0; display:block; color:".$style->label_fontcolor."; width:".$style->label_width."; font-size:".$style->label_fontsize."; } \n";
|
1240 |
+
$form_styles .= '#' . $form_id . " input[type=checkbox] { margin:0; }";
|
1241 |
+
$form_styles .= '#' . $form_id . " label.checkbox, #" . $form_id . " label.radio, #" . $form_id . " label.select { display:inline; } \n";
|
1242 |
+
$form_styles .= '#' . $form_id . " input[type=text], #" . $form_id . " select { color:".$style->field_fontcolor."; margin:0; width:".$style->input_width."; font-size:".$style->field_fontsize."; background-color:".$style->field_backgroundcolor."; border:1px ".$style->field_borderstyle." ".$style->field_bordercolor."; } \n";
|
1243 |
+
$form_styles .= '#' . $form_id . " select { width:".$style->dropdown_width."; }\n";
|
1244 |
+
//$form_styles .= '#' . $form_id . " input[type=radio] { width:".$style->dropdown_width."; }\n";
|
1245 |
$form_styles .= '#' . $form_id . " .submit { color:".$style->submit_fontcolor."; width:".$style->submit_width."; height:".$style->submit_height."; font-size:".$style->submit_fontsize."; } \n";
|
1246 |
$form_styles .= '#' . $form_id . " textarea { color:".$style->field_fontcolor."; width:".$style->textarea_width."; margin:0; background-color:".$style->textarea_backgroundcolor."; height:".$style->textarea_height."; font-size:".$style->field_fontsize."; border:1px ".$style->field_borderstyle." ".$style->field_bordercolor."; } \n";
|
1247 |
$form_styles .= '</style>' . "\n";
|
1279 |
}
|
1280 |
|
1281 |
function insertFormSuccessCode() {
|
1282 |
+
$admin_options = $this->getAdminOptions();
|
1283 |
+
if ($this->current_form !== 0) {
|
1284 |
+
$form = parent::selectForm($this->current_form);
|
1285 |
+
$success_message = (!empty($form->form_success_message)) ? $form->form_success_message : $admin_options[form_success_message];
|
1286 |
+
$success_title = (!empty($form->form_success_title)) ? $form->form_success_title : $admin_options[form_success_message_title];
|
1287 |
+
} else {
|
1288 |
+
$success_title = $admin_options[form_success_message_title];
|
1289 |
+
$success_message = (empty($this->current_thank_you_message)) ? $admin_options[form_success_message] : $this->current_thank_you_message;
|
1290 |
+
} if ($form->form_style != 0) {
|
1291 |
+
$style = parent::selectStyle($form->form_style);
|
1292 |
+
?>
|
1293 |
+
<style type="text/css">
|
1294 |
+
<!--
|
1295 |
+
#ccf-form-success { border-color:<?php echo $style->success_popover_bordercolor; ?>; }
|
1296 |
+
#ccf-form-success h5 { background-color:<?php echo $style->success_popover_bordercolor; ?>; }
|
1297 |
+
-->
|
1298 |
+
</style>
|
1299 |
+
<?php
|
1300 |
+
}
|
1301 |
?>
|
1302 |
<div id="ccf-form-success">
|
1303 |
+
<h5><?php echo $success_title; ?></h5>
|
1304 |
+
<p><?php echo $success_message; ?></p>
|
1305 |
<a href="javascript:void(0)" class="close">[close]</a>
|
1306 |
</div>
|
1307 |
+
|
1308 |
<?php
|
1309 |
}
|
1310 |
|
1340 |
if ($_POST[thank_you_page])
|
1341 |
header("Location: " . $_POST[thank_you_page]);
|
1342 |
$this->current_thank_you_message = (!empty($_POST[success_message])) ? $_POST[success_message] : $admin_options[form_success_message];
|
1343 |
+
$this->current_form = 0;
|
1344 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1345 |
}
|
1346 |
} elseif ($_POST[customcontactforms_submit]) {
|
1362 |
} elseif ($field->field_slug == 'fixedEmail' && $field->field_required == 1 && !empty($_POST[fixedEmail])) {
|
1363 |
if (!$this->validEmail($_POST[fixedEmail])) $this->setFormError('bad_email', 'The email address you provided was invalid.');
|
1364 |
} else {
|
1365 |
+
if ($field->field_required == 1 && empty($_POST[$field->field_slug])) {
|
1366 |
+
$field_error_label = (empty($field->field_label)) ? $field->field_slug : $field->field_label;
|
1367 |
+
$this->setFormError($field->field_slug, 'You left the "'.$field_error_label.'" field blank.');
|
1368 |
+
}
|
1369 |
} if ($field->field_type == 'Checkbox')
|
1370 |
$checks[] = $field->field_slug;
|
1371 |
}
|
1373 |
foreach ($_POST as $key => $value) {
|
1374 |
$_SESSION[fields][$key] = $value;
|
1375 |
$field = parent::selectField('', $key);
|
1376 |
+
if (!array_key_exists($key, $this->fixed_fields) or $key == 'fixedEmail') {
|
1377 |
+
$mail_field_label = (empty($field->field_label)) ? $field->field_slug : $field->field_label;
|
1378 |
+
$body .= $mail_field_label . ': ' . $value . "\n";
|
1379 |
+
} if (in_array($key, $checks)) {
|
1380 |
$checks_key = array_search($key, $checks);
|
1381 |
unset($checks[$checks_key]);
|
1382 |
}
|
1395 |
if (!empty($form->form_thank_you_page)) {
|
1396 |
header("Location: " . $form->form_thank_you_page);
|
1397 |
}
|
1398 |
+
$this->current_form = $form->id;
|
|
|
1399 |
add_action('wp_footer', array(&$this, 'insertFormSuccessCode'), 1);
|
1400 |
}
|
1401 |
unset($_POST);
|
1414 |
}
|
1415 |
}
|
1416 |
}
|
1417 |
+
|
1418 |
if (!function_exists('serveCustomContactForm')) {
|
1419 |
function serveCustomContactForm($fid) {
|
1420 |
global $customcontact;
|
1421 |
echo $customcontact->getFormCode($fid);
|
1422 |
}
|
1423 |
}
|
1424 |
+
|
1425 |
if (!function_exists('CCFWidgetInit')) {
|
1426 |
function CCFWidgetInit() {
|
1427 |
register_widget('CustomContactFormsWidget');
|
1428 |
}
|
1429 |
}
|
1430 |
+
|
1431 |
if (isset($customcontact)) {
|
1432 |
add_action('init', array(&$customcontact, 'init'), 1);
|
1433 |
+
register_activation_hook(__FILE__, array(&$customcontact, 'activatePlugin'));
|
1434 |
add_action('wp_print_scripts', array(&$customcontact, 'insertFrontEndScripts'), 1);
|
1435 |
add_action('admin_print_scripts', array(&$customcontact, 'insertAdminScripts'), 1);
|
1436 |
+
add_action('wp_print_styles', array(&$customcontact, 'insertFrontEndStyles'), 1);
|
1437 |
+
add_action('admin_print_styles', array(&$customcontact, 'insertBackEndStyles'), 1);
|
1438 |
add_filter('the_content', array(&$customcontact, 'contentFilter'));
|
|
|
1439 |
add_action('widgets_init', 'CCFWidgetInit');
|
1440 |
add_action('admin_menu', 'CustomContactForms_ap');
|
1441 |
}
|
images/success-popover-example.gif
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -2,21 +2,25 @@
|
|
2 |
Contributors: Taylor Lovett
|
3 |
Donate link: http://www.taylorlovett.com
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers
|
5 |
-
Requires at least: 2.
|
6 |
-
Tested up to: 3.1
|
7 |
-
Stable tag: 3.
|
8 |
|
9 |
Gauranteed to be the most customizable and intuitive contact form plugin for Wordpress.
|
10 |
|
11 |
== Description ==
|
|
|
12 |
Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form.
|
13 |
|
14 |
Special Features:
|
15 |
------------------
|
|
|
16 |
* The most customizable form plugin for Wordpress, guaranteed
|
|
|
17 |
* Create __unlimited__ forms
|
18 |
* Create __unlimited__ fields
|
19 |
* Required Fields (New!)
|
|
|
20 |
* Custom HTML Forms Feature - if you are a web developer you can write your own form html and __use this plugin simply to process your form requests__. Comes with a few useful features.
|
21 |
* __Displays forms in theme files__ as well as pages and posts.
|
22 |
* Set a different destination email address for each form
|
@@ -35,6 +39,7 @@ Special Features:
|
|
35 |
* Choose between XHTML or HTML. All code is clean and valid!
|
36 |
* No javascript required
|
37 |
* Stylish field tooltips powered by jquery
|
|
|
38 |
* Popover forms with Jquery (Coming soon!)
|
39 |
* Free unlimited support
|
40 |
* Ability to disable JQuery if it is conflicting with other plugins.
|
@@ -67,70 +72,96 @@ Popover forms will be added in September 2010.
|
|
67 |
Visit http://www.taylorlovett.com/wordpress-plugins for screenshots.
|
68 |
|
69 |
== Changelog ==
|
|
|
70 |
= 1.0.0 =
|
71 |
* Plugin Release
|
|
|
72 |
= 1.0.1 =
|
73 |
* custom-contact-forms.css - Form style changes
|
|
|
74 |
= 1.1.0 =
|
75 |
* custom-contact-forms-db.php - Table upgrade functions added
|
76 |
* custom-contact-forms.php - New functions for error handling and captcha
|
77 |
* custom-contact-forms.css - Forms restyled
|
78 |
* custom-contact-forms-images.php - Image handling class added
|
79 |
* image.php, images/ - Image for captcha displaying
|
|
|
80 |
= 1.1.1 =
|
81 |
* custom-contact-forms.css - Label styles changed
|
82 |
* custom-contact-forms.php - Admin option added to remember field values
|
|
|
83 |
= 1.1.2 =
|
84 |
* custom-contact-forms-db.php - create_tables function edited to work for Wordpress MU due to error in wp-admin/includes/upgrade.php
|
|
|
85 |
= 1.1.3 =
|
86 |
* custom-contact-forms.php - Captcha label bug fixed
|
87 |
* custom-contact-forms-db.php - Default captcha label changed
|
|
|
88 |
= 1.2.0 =
|
89 |
* custom-contact-forms.php - Option to update to Custom Contact Forms Pro
|
|
|
90 |
= 1.2.1 =
|
91 |
* custom-contact-forms.php - Upgrade options changed
|
92 |
* custom-contact-forms-css.php - CSS bug corrected
|
|
|
93 |
= 2.0.0 =
|
94 |
* custom-contact-forms.php - Style manager added
|
95 |
* custom-contact-forms.css - style manager styles added
|
96 |
* custom-contact-forms-db.php - Style manager db functions added
|
|
|
97 |
= 2.0.1 =
|
98 |
* custom-contact-forms.php - Duplicate form slug bug fixed, default style values added, stripslahses on form messages
|
99 |
* custom-contact-forms-db.php - default style values added
|
|
|
100 |
= 2.0.2 =
|
101 |
* custom-contact-forms.php - Form li's changed to p's
|
102 |
* images/ - folder readded to correct captcha error
|
|
|
103 |
= 2.0.3 =
|
104 |
* custom-contact-forms.php - custom style checkbox display:block error fixed
|
105 |
* custom-contact-forms.css - li's converted to p's
|
|
|
106 |
= 2.1.0 =
|
107 |
* custom-contact-forms.php - New fixed field added, plugin news, bug fixes
|
108 |
* custom-contact-forms.css - New styles added and style bugs fixed
|
109 |
* custom-contact-forms-db.php - New fixed field added
|
|
|
110 |
= 2.2.0 =
|
111 |
* custom-contact-forms.php - Plugin nav, hide plugin author link, bug reporting, suggest a feature
|
112 |
* custom-contact-forms.css - New styles added and style bugs fixed
|
|
|
113 |
= 2.2.3 =
|
114 |
* custom-contact-forms.php - Remember fields bug fixed, init rearranged, field instructions
|
115 |
* custom-contact-forms.css
|
116 |
* custom-contact-forms-db.php
|
|
|
117 |
= 2.2.4 =
|
118 |
* custom-contact-forms.php - Textarea field instruction bug fixed
|
|
|
119 |
= 2.2.5 =
|
120 |
* custom-contact-forms.php - Fixed field insert bug fixed
|
|
|
121 |
= 3.0.0 =
|
122 |
* custom-contact-forms.php - Required fields, admin panel changed, style manager bugs fixed, custom html feature added, much more
|
123 |
* custom-contact-forms-db.php - New functions added and old ones fixed
|
124 |
* custom-contact-forms.css - New styles added and old ones modified
|
|
|
125 |
= 3.0.1 =
|
126 |
* custom-contact-forms.php - Php tags added to theme form display code
|
|
|
127 |
= 3.0.2 =
|
128 |
* custom-contact-forms.php - Bugs fixed
|
|
|
129 |
= 3.1.0 =
|
130 |
* custom-contact-forms.php - Success message title, disable jquery, choose between xhmtl and html, and more
|
131 |
* custom-contact-forms-db.php - Success message title added
|
132 |
* custom-contact-forms.css - Form styles rewritten
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
* custom-contact-forms-
|
|
|
|
|
|
|
|
|
|
2 |
Contributors: Taylor Lovett
|
3 |
Donate link: http://www.taylorlovett.com
|
4 |
Tags: contact form, web form, custom contact form, custom forms, captcha form, contact fields, form mailers
|
5 |
+
Requires at least: 2.8.1
|
6 |
+
Tested up to: 3.0.1
|
7 |
+
Stable tag: 3.5.0
|
8 |
|
9 |
Gauranteed to be the most customizable and intuitive contact form plugin for Wordpress.
|
10 |
|
11 |
== Description ==
|
12 |
+
|
13 |
Guaranteed to be 1000X more customizable and intuitive than Fast Secure Contact Forms or Contact Form 7. Customize every aspect of your forms without any knowledge of CSS: borders, padding, sizes, colors. Ton's of great features. Required fields, captchas, tooltip popovers, unlimited fields/forms/form styles, use a custom thank you page or built-in popover with a custom success message set for each form.
|
14 |
|
15 |
Special Features:
|
16 |
------------------
|
17 |
+
|
18 |
* The most customizable form plugin for Wordpress, guaranteed
|
19 |
+
* __Latency problem fixed. Script loads quickly because tables are only checked on plugin activation.__
|
20 |
* Create __unlimited__ forms
|
21 |
* Create __unlimited__ fields
|
22 |
* Required Fields (New!)
|
23 |
+
* Create text fields, textareas, checkboxs, radio __(new)__ and dropdown __(new)__ fields!
|
24 |
* Custom HTML Forms Feature - if you are a web developer you can write your own form html and __use this plugin simply to process your form requests__. Comes with a few useful features.
|
25 |
* __Displays forms in theme files__ as well as pages and posts.
|
26 |
* Set a different destination email address for each form
|
39 |
* Choose between XHTML or HTML. All code is clean and valid!
|
40 |
* No javascript required
|
41 |
* Stylish field tooltips powered by jquery
|
42 |
+
* Manage options for your dropdowns and radio fields in an easy to use manager
|
43 |
* Popover forms with Jquery (Coming soon!)
|
44 |
* Free unlimited support
|
45 |
* Ability to disable JQuery if it is conflicting with other plugins.
|
72 |
Visit http://www.taylorlovett.com/wordpress-plugins for screenshots.
|
73 |
|
74 |
== Changelog ==
|
75 |
+
|
76 |
= 1.0.0 =
|
77 |
* Plugin Release
|
78 |
+
|
79 |
= 1.0.1 =
|
80 |
* custom-contact-forms.css - Form style changes
|
81 |
+
|
82 |
= 1.1.0 =
|
83 |
* custom-contact-forms-db.php - Table upgrade functions added
|
84 |
* custom-contact-forms.php - New functions for error handling and captcha
|
85 |
* custom-contact-forms.css - Forms restyled
|
86 |
* custom-contact-forms-images.php - Image handling class added
|
87 |
* image.php, images/ - Image for captcha displaying
|
88 |
+
|
89 |
= 1.1.1 =
|
90 |
* custom-contact-forms.css - Label styles changed
|
91 |
* custom-contact-forms.php - Admin option added to remember field values
|
92 |
+
|
93 |
= 1.1.2 =
|
94 |
* custom-contact-forms-db.php - create_tables function edited to work for Wordpress MU due to error in wp-admin/includes/upgrade.php
|
95 |
+
|
96 |
= 1.1.3 =
|
97 |
* custom-contact-forms.php - Captcha label bug fixed
|
98 |
* custom-contact-forms-db.php - Default captcha label changed
|
99 |
+
|
100 |
= 1.2.0 =
|
101 |
* custom-contact-forms.php - Option to update to Custom Contact Forms Pro
|
102 |
+
|
103 |
= 1.2.1 =
|
104 |
* custom-contact-forms.php - Upgrade options changed
|
105 |
* custom-contact-forms-css.php - CSS bug corrected
|
106 |
+
|
107 |
= 2.0.0 =
|
108 |
* custom-contact-forms.php - Style manager added
|
109 |
* custom-contact-forms.css - style manager styles added
|
110 |
* custom-contact-forms-db.php - Style manager db functions added
|
111 |
+
|
112 |
= 2.0.1 =
|
113 |
* custom-contact-forms.php - Duplicate form slug bug fixed, default style values added, stripslahses on form messages
|
114 |
* custom-contact-forms-db.php - default style values added
|
115 |
+
|
116 |
= 2.0.2 =
|
117 |
* custom-contact-forms.php - Form li's changed to p's
|
118 |
* images/ - folder readded to correct captcha error
|
119 |
+
|
120 |
= 2.0.3 =
|
121 |
* custom-contact-forms.php - custom style checkbox display:block error fixed
|
122 |
* custom-contact-forms.css - li's converted to p's
|
123 |
+
|
124 |
= 2.1.0 =
|
125 |
* custom-contact-forms.php - New fixed field added, plugin news, bug fixes
|
126 |
* custom-contact-forms.css - New styles added and style bugs fixed
|
127 |
* custom-contact-forms-db.php - New fixed field added
|
128 |
+
|
129 |
= 2.2.0 =
|
130 |
* custom-contact-forms.php - Plugin nav, hide plugin author link, bug reporting, suggest a feature
|
131 |
* custom-contact-forms.css - New styles added and style bugs fixed
|
132 |
+
|
133 |
= 2.2.3 =
|
134 |
* custom-contact-forms.php - Remember fields bug fixed, init rearranged, field instructions
|
135 |
* custom-contact-forms.css
|
136 |
* custom-contact-forms-db.php
|
137 |
+
|
138 |
= 2.2.4 =
|
139 |
* custom-contact-forms.php - Textarea field instruction bug fixed
|
140 |
+
|
141 |
= 2.2.5 =
|
142 |
* custom-contact-forms.php - Fixed field insert bug fixed
|
143 |
+
|
144 |
= 3.0.0 =
|
145 |
* custom-contact-forms.php - Required fields, admin panel changed, style manager bugs fixed, custom html feature added, much more
|
146 |
* custom-contact-forms-db.php - New functions added and old ones fixed
|
147 |
* custom-contact-forms.css - New styles added and old ones modified
|
148 |
+
|
149 |
= 3.0.1 =
|
150 |
* custom-contact-forms.php - Php tags added to theme form display code
|
151 |
+
|
152 |
= 3.0.2 =
|
153 |
* custom-contact-forms.php - Bugs fixed
|
154 |
+
|
155 |
= 3.1.0 =
|
156 |
* custom-contact-forms.php - Success message title, disable jquery, choose between xhmtl and html, and more
|
157 |
* custom-contact-forms-db.php - Success message title added
|
158 |
* custom-contact-forms.css - Form styles rewritten
|
159 |
+
|
160 |
+
= 3.5.0 =
|
161 |
+
* custom-contact-forms.php - Radio and dropdowns added via the field option manager
|
162 |
+
* custom-contact-forms-mailer.php - Email body changed
|
163 |
+
* custom-contact-forms-db.php - Field option methods added
|
164 |
+
* custom-contact-forms.css - Form styles reorganized, file removed
|
165 |
+
* css/custom-contact-forms.css - Form styles reorganized
|
166 |
+
* css/custom-contact-forms-standards.css - Form styles reorganized
|
167 |
+
* css/custom-contact-forms-admin.css - Form styles reorganized
|