Google Forms - Version 0.54

Version Description

No known upgrade issues.

Download this release

Release Info

Developer mpwalsh8
Plugin Icon wp plugin Google Forms
Version 0.54
Comparing to
See all releases

Code changes from version 0.53 to 0.54

index.php CHANGED
@@ -4,8 +4,8 @@
4
  * Plugin Name: WordPress Google Form
5
  * Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
6
  * Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
7
- * Version: 0.53
8
- * Build: 0.53.$WCREV$
9
  * Last Modified: $WCDATE$
10
  * Author: Mike Walsh
11
  * Author URI: http://www.michaelwalsh.org
@@ -25,7 +25,7 @@
25
  *
26
  */
27
 
28
- define('WPGFORM_VERSION', '0.53') ;
29
 
30
  require_once('wpgform-core.php') ;
31
  require_once('wpgform-post-type.php') ;
4
  * Plugin Name: WordPress Google Form
5
  * Plugin URI: http://michaelwalsh.org/wordpress/wordpress-plugins/wpgform/
6
  * Description: Add Google Forms to a WordPress web site. Display a Google Form directly into your posts, pages or sidebar. Style the Google Form to match your existing theme and display a custom confirmation page after form submission.
7
+ * Version: 0.54
8
+ * Build: 0.54.$WCREV$
9
  * Last Modified: $WCDATE$
10
  * Author: Mike Walsh
11
  * Author URI: http://www.michaelwalsh.org
25
  *
26
  */
27
 
28
+ define('WPGFORM_VERSION', '0.54') ;
29
 
30
  require_once('wpgform-core.php') ;
31
  require_once('wpgform-post-type.php') ;
js/wpgform-post-type.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* vim: set expandtab tabstop=4 shiftwidth=4: */
2
+ jQuery('.repeatable-add').click(function() {
3
+ field = jQuery(this).closest('td').find('.custom_repeatable li:last').clone(true);
4
+ fieldLocation = jQuery(this).closest('td').find('.custom_repeatable li:last');
5
+ jQuery('input', field).val('').attr('name', function(index, name) {
6
+ return name.replace(/(\d+)/, function(fullMatch, n) {
7
+ return Number(n) + 1;
8
+ });
9
+ })
10
+ jQuery('select', field).val('').attr('name', function(index, name) {
11
+ return name.replace(/(\d+)/, function(fullMatch, n) {
12
+ return Number(n) + 1;
13
+ });
14
+ })
15
+ field.insertAfter(fieldLocation, jQuery(this).closest('td'))
16
+ return false;
17
+ });
18
+
19
+ jQuery('.repeatable-remove').click(function(){
20
+ jQuery(this).parent().remove();
21
+ return false;
22
+ });
23
+
24
+ jQuery('.custom_repeatable').sortable({
25
+ opacity: 0.6,
26
+ revert: true,
27
+ cursor: 'move',
28
+ handle: '.sort'
29
+ });
30
+
js/wpgform.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* vim: set expandtab tabstop=4 shiftwidth=4: */
2
+ /**
3
+ * Localization of jQuery Validate error messages.
4
+ *
5
+ */
6
+ jQuery.extend(jQuery.validator.messages, {
7
+ required: wpgform_script_vars.required,
8
+ remote: wpgform_script_vars.remote,
9
+ email: wpgform_script_vars.email,
10
+ url: wpgform_script_vars.url,
11
+ date: wpgform_script_vars.date,
12
+ dateISO: wpgform_script_vars.dateISO,
13
+ number: wpgform_script_vars.number,
14
+ digits: wpgform_script_vars.digits,
15
+ creditcard: wpgform_script_vars.creditcard,
16
+ equalTo: wpgform_script_vars.equalTo,
17
+ accept: wpgform_script_vars.accept,
18
+ maxlength: jQuery.validator.format(wpgform_script_vars.maxlength),
19
+ minlength: jQuery.validator.format(wpgform_script_vars.minlength),
20
+ rangelength: jQuery.validator.format(wpgform_script_vars.rangelength),
21
+ range: jQuery.validator.format(wpgform_script_vars.range),
22
+ max: jQuery.validator.format(wpgform_script_vars.max),
23
+ min: jQuery.validator.format(wpgform_script_vars.min),
24
+ });
25
+
languages/wpgform.mo CHANGED
Binary file
languages/wpgform.po CHANGED
@@ -1,119 +1,264 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WordPress Google Form\n"
4
- "POT-Creation-Date: 2012-11-24 11:54-0000\n"
5
- "PO-Revision-Date: 2012-11-24 11:54-0000\n"
6
  "Last-Translator: Mike Walsh <mpwalsh8@gmail.com>\n"
7
  "Language-Team: Mike Walsh (@mpwalsh8) <mpwalsh8@gmail.com>\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "X-Generator: Poedit 1.5.4\n"
12
  "X-Poedit-KeywordsList: _;gettext;gettext_noop;__\n"
13
  "X-Poedit-Basepath: .\n"
14
  "X-Poedit-SearchPath-0: ..\n"
15
 
16
- #: ../wpgform-core.php:165 ../wpgform-core.php:166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  msgid "Google Forms"
18
  msgstr ""
19
 
20
- #: ../wpgform-core.php:322 ../wpgform-core.php:337
21
  msgid "Unable to process Google Form short code."
22
  msgstr ""
23
 
24
- #: ../wpgform-core.php:465
25
  msgid "Unable to process Google Form."
26
  msgstr ""
27
 
28
- #: ../wpgform-core.php:466
29
  msgid "Server is responding with"
30
  msgstr ""
31
 
32
- #: ../wpgform-core.php:467
33
  msgid "403 Permission Denied"
34
  msgstr ""
35
 
36
- #: ../wpgform-core.php:467
37
  msgid "error"
38
  msgstr ""
39
 
40
  #: ../wpgform-core.php:585
 
 
 
 
41
  msgid "Unable to retrieve Google Form. Please try reloading this page."
42
  msgstr ""
43
 
44
- #: ../wpgform-core.php:647
45
  msgid "Unexpected content encountered, unable to retrieve Google Form."
46
  msgstr ""
47
 
48
- #: ../wpgform-core.php:896
 
 
 
 
 
 
 
 
49
  msgid "Warning: You are using an insecure browser!"
50
  msgstr ""
51
 
52
- #: ../wpgform-core.php:899
53
  msgid "Warning: Your browser is out of date! Please update now."
54
  msgstr ""
55
 
56
- #: ../wpgform-core.php:915
57
  msgid "Form Id:"
58
  msgstr ""
59
 
60
- #: ../wpgform-core.php:917
61
  msgid "Submitted Form Id"
62
  msgstr ""
63
 
64
- #: ../wpgform-core.php:920
65
  msgid "No Submitted Form Id"
66
  msgstr ""
67
 
68
- #: ../wpgform-core.php:1062
69
  msgid "Unable to submit Google Form. Please try reloading this page."
70
  msgstr ""
71
 
72
- #: ../wpgform-core.php:1139
73
- msgid "View Form Submissions"
74
  msgstr ""
75
 
76
- #: ../wpgform-core.php:1192
77
  msgid "A form was submitted on your web site."
78
  msgstr ""
79
 
80
- #: ../wpgform-core.php:1193 ../wpgform-core.php:1204
81
  msgid "Form"
82
  msgstr ""
83
 
84
- #: ../wpgform-core.php:1194 ../wpgform-core.php:1205
 
 
 
 
 
85
  msgid "Responses"
86
  msgstr ""
87
 
88
- #: ../wpgform-core.php:1195 ../wpgform-core.php:1206
89
  msgid "Date"
90
  msgstr ""
91
 
92
- #: ../wpgform-core.php:1196 ../wpgform-core.php:1207
93
  msgid "Time"
94
  msgstr ""
95
 
96
- #: ../wpgform-core.php:1197 ../wpgform-core.php:1209
97
  msgid "Thank you"
98
  msgstr ""
99
 
100
- #: ../wpgform-core.php:1203
101
  msgid "A form was submitted on your web site"
102
  msgstr ""
103
 
104
- #: ../wpgform-options.php:93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  #, php-format
106
  msgid ""
107
  "Please consider making a <a href=\"%s\" target=\"_blank\">PayPal donation</"
108
  "a> if you find this plugin useful."
109
  msgstr ""
110
 
111
- #: ../wpgform-options.php:298
112
  #, php-format
113
  msgid "Custom %s CSS"
114
  msgstr ""
115
 
116
- #: ../wpgform-options.php:387
117
  #, php-format
118
  msgid ""
119
  "Enabling debug will collect data during the form rendering and processing "
@@ -130,18 +275,210 @@ msgid ""
130
  "issues.</a></p>"
131
  msgstr ""
132
 
133
- #: ../wpgform-post-type.php:463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  msgid "Form Name"
135
  msgstr ""
136
 
137
- #: ../wpgform-post-type.php:468
138
  msgid "Short Code"
139
  msgstr ""
140
 
141
- #: ../wpgform-post-type.php:469
142
  msgid "Form Description"
143
  msgstr ""
144
 
145
- #: ../wpgform-post-type.php:549
146
  msgid "Enter WordPress Google Form Title"
147
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WordPress Google Form\n"
4
+ "POT-Creation-Date: 2013-06-21 18:44-0000\n"
5
+ "PO-Revision-Date: 2013-06-21 18:44-0000\n"
6
  "Last-Translator: Mike Walsh <mpwalsh8@gmail.com>\n"
7
  "Language-Team: Mike Walsh (@mpwalsh8) <mpwalsh8@gmail.com>\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.5.5\n"
12
  "X-Poedit-KeywordsList: _;gettext;gettext_noop;__\n"
13
  "X-Poedit-Basepath: .\n"
14
  "X-Poedit-SearchPath-0: ..\n"
15
 
16
+ #: ../wpgform-core.php:139
17
+ msgid "Required"
18
+ msgstr ""
19
+
20
+ #: ../wpgform-core.php:140
21
+ msgid "Submit"
22
+ msgstr ""
23
+
24
+ #: ../wpgform-core.php:141
25
+ msgid "Back"
26
+ msgstr ""
27
+
28
+ #: ../wpgform-core.php:142
29
+ msgid "Continue"
30
+ msgstr ""
31
+
32
+ #: ../wpgform-core.php:143
33
+ msgid "Mark only one oval."
34
+ msgstr ""
35
+
36
+ #: ../wpgform-core.php:144
37
+ msgid "Other:"
38
+ msgstr ""
39
+
40
+ #: ../wpgform-core.php:145
41
+ msgid "Check all that apply."
42
+ msgstr ""
43
+
44
+ #: ../wpgform-core.php:197 ../wpgform-core.php:198
45
  msgid "Google Forms"
46
  msgstr ""
47
 
48
+ #: ../wpgform-core.php:375 ../wpgform-core.php:389
49
  msgid "Unable to process Google Form short code."
50
  msgstr ""
51
 
52
+ #: ../wpgform-core.php:539
53
  msgid "Unable to process Google Form."
54
  msgstr ""
55
 
56
+ #: ../wpgform-core.php:540
57
  msgid "Server is responding with"
58
  msgstr ""
59
 
60
+ #: ../wpgform-core.php:541
61
  msgid "403 Permission Denied"
62
  msgstr ""
63
 
64
+ #: ../wpgform-core.php:541
65
  msgid "error"
66
  msgstr ""
67
 
68
  #: ../wpgform-core.php:585
69
+ msgid "Email Address"
70
+ msgstr ""
71
+
72
+ #: ../wpgform-core.php:717
73
  msgid "Unable to retrieve Google Form. Please try reloading this page."
74
  msgstr ""
75
 
76
+ #: ../wpgform-core.php:779
77
  msgid "Unexpected content encountered, unable to retrieve Google Form."
78
  msgstr ""
79
 
80
+ #: ../wpgform-core.php:930
81
+ msgid "A valid email address is required."
82
+ msgstr ""
83
+
84
+ #: ../wpgform-core.php:954
85
+ msgid "Incorrect answer."
86
+ msgstr ""
87
+
88
+ #: ../wpgform-core.php:1125
89
  msgid "Warning: You are using an insecure browser!"
90
  msgstr ""
91
 
92
+ #: ../wpgform-core.php:1128
93
  msgid "Warning: Your browser is out of date! Please update now."
94
  msgstr ""
95
 
96
+ #: ../wpgform-core.php:1144
97
  msgid "Form Id:"
98
  msgstr ""
99
 
100
+ #: ../wpgform-core.php:1146
101
  msgid "Submitted Form Id"
102
  msgstr ""
103
 
104
+ #: ../wpgform-core.php:1149
105
  msgid "No Submitted Form Id"
106
  msgstr ""
107
 
108
+ #: ../wpgform-core.php:1336
109
  msgid "Unable to submit Google Form. Please try reloading this page."
110
  msgstr ""
111
 
112
+ #: ../wpgform-core.php:1418
113
+ msgid "View Form Results"
114
  msgstr ""
115
 
116
+ #: ../wpgform-core.php:1472
117
  msgid "A form was submitted on your web site."
118
  msgstr ""
119
 
120
+ #: ../wpgform-core.php:1473 ../wpgform-core.php:1485
121
  msgid "Form"
122
  msgstr ""
123
 
124
+ #: ../wpgform-core.php:1474 ../wpgform-core.php:1486
125
+ #: ../wpgform-logging.php:182
126
+ msgid "URL"
127
+ msgstr ""
128
+
129
+ #: ../wpgform-core.php:1475 ../wpgform-core.php:1487
130
  msgid "Responses"
131
  msgstr ""
132
 
133
+ #: ../wpgform-core.php:1476 ../wpgform-core.php:1488
134
  msgid "Date"
135
  msgstr ""
136
 
137
+ #: ../wpgform-core.php:1477 ../wpgform-core.php:1489
138
  msgid "Time"
139
  msgstr ""
140
 
141
+ #: ../wpgform-core.php:1478 ../wpgform-core.php:1491
142
  msgid "Thank you"
143
  msgstr ""
144
 
145
+ #: ../wpgform-core.php:1484
146
  msgid "A form was submitted on your web site"
147
  msgstr ""
148
 
149
+ #: ../wpgform-core.php:1555
150
+ msgid "This field is required."
151
+ msgstr ""
152
+
153
+ #: ../wpgform-core.php:1556
154
+ msgid "Please fix this field."
155
+ msgstr ""
156
+
157
+ #: ../wpgform-core.php:1557
158
+ msgid "Please enter a valid email address."
159
+ msgstr ""
160
+
161
+ #: ../wpgform-core.php:1558
162
+ msgid "Please enter a valid URL."
163
+ msgstr ""
164
+
165
+ #: ../wpgform-core.php:1559
166
+ msgid "Please enter a valid date."
167
+ msgstr ""
168
+
169
+ #: ../wpgform-core.php:1560
170
+ msgid "Please enter a valid date (ISO)."
171
+ msgstr ""
172
+
173
+ #: ../wpgform-core.php:1561
174
+ msgid "Please enter a valid number."
175
+ msgstr ""
176
+
177
+ #: ../wpgform-core.php:1562
178
+ msgid "Please enter only digits."
179
+ msgstr ""
180
+
181
+ #: ../wpgform-core.php:1563
182
+ msgid "Please enter a valid credit card number."
183
+ msgstr ""
184
+
185
+ #: ../wpgform-core.php:1564
186
+ msgid "Please enter the same value again.,"
187
+ msgstr ""
188
+
189
+ #: ../wpgform-core.php:1565
190
+ msgid "Please enter a value with a valid extension."
191
+ msgstr ""
192
+
193
+ #: ../wpgform-core.php:1566
194
+ msgid "Please enter no more than {0} characters."
195
+ msgstr ""
196
+
197
+ #: ../wpgform-core.php:1567
198
+ msgid "Please enter at least {0} characters."
199
+ msgstr ""
200
+
201
+ #: ../wpgform-core.php:1568
202
+ msgid "Please enter a value between {0} and {1} characters long."
203
+ msgstr ""
204
+
205
+ #: ../wpgform-core.php:1569
206
+ msgid "Please enter a value between {0} and {1}."
207
+ msgstr ""
208
+
209
+ #: ../wpgform-core.php:1570
210
+ msgid "Please enter a value less than or equal to {0}."
211
+ msgstr ""
212
+
213
+ #: ../wpgform-core.php:1571
214
+ msgid "Please enter a value greater than or equal to {0}."
215
+ msgstr ""
216
+
217
+ #: ../wpgform-logging.php:30
218
+ msgid "You are not allowed to view the submission log."
219
+ msgstr ""
220
+
221
+ #: ../wpgform-logging.php:181
222
+ msgid "Timestamp"
223
+ msgstr ""
224
+
225
+ #: ../wpgform-logging.php:183
226
+ msgid "Remote Addr"
227
+ msgstr ""
228
+
229
+ #: ../wpgform-logging.php:184
230
+ msgid "Remote Host"
231
+ msgstr ""
232
+
233
+ #: ../wpgform-logging.php:185
234
+ msgid "HTTP Refer"
235
+ msgstr ""
236
+
237
+ #: ../wpgform-logging.php:186
238
+ msgid "HTTP User Agent"
239
+ msgstr ""
240
+
241
+ #: ../wpgform-logging.php:238
242
+ msgid "Delete"
243
+ msgstr ""
244
+
245
+ #: ../wpgform-logging.php:298
246
+ msgid "No log entries selected"
247
+ msgstr ""
248
+
249
+ #: ../wpgform-options.php:94
250
  #, php-format
251
  msgid ""
252
  "Please consider making a <a href=\"%s\" target=\"_blank\">PayPal donation</"
253
  "a> if you find this plugin useful."
254
  msgstr ""
255
 
256
+ #: ../wpgform-options.php:235
257
  #, php-format
258
  msgid "Custom %s CSS"
259
  msgstr ""
260
 
261
+ #: ../wpgform-options.php:458
262
  #, php-format
263
  msgid ""
264
  "Enabling debug will collect data during the form rendering and processing "
275
  "issues.</a></p>"
276
  msgstr ""
277
 
278
+ #: ../wpgform-post-type.php:88
279
+ msgid "Form URL"
280
+ msgstr ""
281
+
282
+ #: ../wpgform-post-type.php:89
283
+ msgid "The full URL to the published Google Form"
284
+ msgstr ""
285
+
286
+ #: ../wpgform-post-type.php:96
287
+ msgid "Confirm URL"
288
+ msgstr ""
289
+
290
+ #: ../wpgform-post-type.php:97
291
+ msgid "The full URL to the optional Confirmation Page"
292
+ msgstr ""
293
+
294
+ #: ../wpgform-post-type.php:104
295
+ msgid "Style"
296
+ msgstr ""
297
+
298
+ #: ../wpgform-post-type.php:105
299
+ msgid "Custom Confirmation Page Style"
300
+ msgstr ""
301
+
302
+ #: ../wpgform-post-type.php:113
303
+ msgid "Alert"
304
+ msgstr ""
305
+
306
+ #: ../wpgform-post-type.php:114
307
+ msgid "Javascript Alert Box message displayed upon submission"
308
+ msgstr ""
309
+
310
+ #: ../wpgform-post-type.php:121
311
+ msgid "Class"
312
+ msgstr ""
313
+
314
+ #: ../wpgform-post-type.php:122
315
+ msgid "CSS class(es) to add to the form's containing DIV"
316
+ msgstr ""
317
+
318
+ #: ../wpgform-post-type.php:129
319
+ msgid "Email"
320
+ msgstr ""
321
+
322
+ #: ../wpgform-post-type.php:130
323
+ msgid "Send email upon form submission"
324
+ msgstr ""
325
+
326
+ #: ../wpgform-post-type.php:138
327
+ msgid "Send To"
328
+ msgstr ""
329
+
330
+ #: ../wpgform-post-type.php:139
331
+ msgid "Email address send submission email to"
332
+ msgstr ""
333
+
334
+ #: ../wpgform-post-type.php:146
335
+ msgid "Form CSS"
336
+ msgstr ""
337
+
338
+ #: ../wpgform-post-type.php:147
339
+ msgid "Form specific CSS rules"
340
+ msgstr ""
341
+
342
+ #: ../wpgform-post-type.php:174 ../wpgform-post-type.php:175
343
+ msgid "CAPTCHA"
344
+ msgstr ""
345
+
346
+ #: ../wpgform-post-type.php:183
347
+ msgid "Columns"
348
+ msgstr ""
349
+
350
+ #: ../wpgform-post-type.php:184
351
+ msgid "Split form into columns"
352
+ msgstr ""
353
+
354
+ #: ../wpgform-post-type.php:192
355
+ msgid "Email End User"
356
+ msgstr ""
357
+
358
+ #: ../wpgform-post-type.php:193
359
+ msgid "Send email to end user upon form submission"
360
+ msgstr ""
361
+
362
+ #: ../wpgform-post-type.php:201
363
+ msgid "Legal"
364
+ msgstr ""
365
+
366
+ #: ../wpgform-post-type.php:202
367
+ msgid "Google Legal Disclaimer"
368
+ msgstr ""
369
+
370
+ #: ../wpgform-post-type.php:210
371
+ msgid "Read Only"
372
+ msgstr ""
373
+
374
+ #: ../wpgform-post-type.php:211
375
+ msgid "Set the form Read Only"
376
+ msgstr ""
377
+
378
+ #: ../wpgform-post-type.php:219
379
+ msgid "BR"
380
+ msgstr ""
381
+
382
+ #: ../wpgform-post-type.php:220
383
+ msgid "Insert &lt;BR&gt; tags between labels and input box"
384
+ msgstr ""
385
+
386
+ #: ../wpgform-post-type.php:228
387
+ msgid "CSS Prefix"
388
+ msgstr ""
389
+
390
+ #: ../wpgform-post-type.php:229
391
+ msgid "Prefix to add to all Google CSS classes"
392
+ msgstr ""
393
+
394
+ #: ../wpgform-post-type.php:236
395
+ msgid "CSS Suffix"
396
+ msgstr ""
397
+
398
+ #: ../wpgform-post-type.php:237
399
+ msgid "Suffix to add to all Google CSS classes"
400
+ msgstr ""
401
+
402
+ #: ../wpgform-post-type.php:244
403
+ msgid "Title"
404
+ msgstr ""
405
+
406
+ #: ../wpgform-post-type.php:245
407
+ msgid "Show or Hide the Google Form's title"
408
+ msgstr ""
409
+
410
+ #: ../wpgform-post-type.php:253
411
+ msgid "Map H1 to H2"
412
+ msgstr ""
413
+
414
+ #: ../wpgform-post-type.php:254
415
+ msgid "Map H1 elements to H2 elements"
416
+ msgstr ""
417
+
418
+ #: ../wpgform-post-type.php:262 ../wpgform-post-type.php:263
419
+ msgid "Unite Theme Hack"
420
+ msgstr ""
421
+
422
+ #: ../wpgform-post-type.php:291
423
+ msgid "Validation"
424
+ msgstr ""
425
+
426
+ #: ../wpgform-post-type.php:292
427
+ msgid "Enable default jQuery Validation on all required fields"
428
+ msgstr ""
429
+
430
+ #: ../wpgform-post-type.php:300
431
+ msgid "Form Fields"
432
+ msgstr ""
433
+
434
+ #: ../wpgform-post-type.php:301
435
+ msgid ""
436
+ "Name of the field on the Google Form (e.g. entry.1.single, entry.12345678, "
437
+ "etc.) - <a href=\"http://jqueryvalidation.org/rules\">Additional details on "
438
+ "jQuery Rules</a>"
439
+ msgstr ""
440
+
441
+ #: ../wpgform-post-type.php:329
442
+ msgid "Type"
443
+ msgstr ""
444
+
445
+ #: ../wpgform-post-type.php:330
446
+ msgid "Type of validation"
447
+ msgstr ""
448
+
449
+ #: ../wpgform-post-type.php:337 ../wpgform-post-type.php:484
450
+ #: ../wpgform-post-type.php:501
451
+ msgid "Value"
452
+ msgstr ""
453
+
454
+ #: ../wpgform-post-type.php:338
455
+ msgid "Value to validate against"
456
+ msgstr ""
457
+
458
+ #: ../wpgform-post-type.php:474
459
+ msgid "Name"
460
+ msgstr ""
461
+
462
+ #: ../wpgform-post-type.php:477 ../wpgform-post-type.php:494
463
+ msgid "Check"
464
+ msgstr ""
465
+
466
+ #: ../wpgform-post-type.php:492
467
+ msgid "Field"
468
+ msgstr ""
469
+
470
+ #: ../wpgform-post-type.php:652
471
  msgid "Form Name"
472
  msgstr ""
473
 
474
+ #: ../wpgform-post-type.php:657
475
  msgid "Short Code"
476
  msgstr ""
477
 
478
+ #: ../wpgform-post-type.php:658
479
  msgid "Form Description"
480
  msgstr ""
481
 
482
+ #: ../wpgform-post-type.php:748
483
  msgid "Enter WordPress Google Form Title"
484
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
5
  Requires at least: 3.3
6
  Tested up to: 3.5.1
7
- Stable tag: 0.53
8
 
9
  Embeds a published, public Google Form in a WordPress post, page, or widget.
10
 
@@ -316,6 +316,16 @@ No known upgrade issues.
316
 
317
  == Changelog ==
318
 
 
 
 
 
 
 
 
 
 
 
319
  = Version 0.53 =
320
  * Added CSS rule to hide Google's new Edit Link "feature".
321
  * Added support for link (A) elements with class attributes when call wp_kses().
4
  Tags: Google Forms, Google Docs, Google, Spreadsheet, shortcode, forms
5
  Requires at least: 3.3
6
  Tested up to: 3.5.1
7
+ Stable tag: 0.54
8
 
9
  Embeds a published, public Google Form in a WordPress post, page, or widget.
10
 
316
 
317
  == Changelog ==
318
 
319
+ = Version 0.54 =
320
+ * Added internationalization support for jQuery Validation messages.
321
+ * New language support files.
322
+ * New jQuery Validation based custom validation option.
323
+ * Fixed problem with escaped characters ending up in Google spreadsheet.
324
+ * Moved transport control out of debug module and into core code so it can be a permanent setting for some server environments.
325
+ * Fixed PHP warning messages which happen with Logging Enabled when some of the server variables don't exist.
326
+ * Fixed bug with Form Submission Log setting stickiness.
327
+ * Added an optional CAPTCHA message which will appear below the CAPTCHA input when set.
328
+
329
  = Version 0.53 =
330
  * Added CSS rule to hide Google's new Edit Link "feature".
331
  * Added support for link (A) elements with class attributes when call wp_kses().
wpgform-core.php CHANGED
@@ -44,11 +44,46 @@ function wpgform_init_i18n()
44
  }
45
  }
46
 
47
-
48
-
49
  // Need the plugin options to initialize debug
50
  $wpgform_options = wpgform_get_plugin_options() ;
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  // Enable debug content?
53
  define('WPGFORM_DEBUG', $wpgform_options['enable_debug'] == 1) ;
54
  //define('WPGFORM_DEBUG', true) ;
@@ -121,6 +156,7 @@ function wpgform_get_default_plugin_options()
121
  ,'captcha_operator_plus' => 1
122
  ,'captcha_operator_minus' => 0
123
  ,'captcha_operator_mult' => 0
 
124
  ,'email_format' => WPGFORM_EMAIL_FORMAT_PLAIN
125
  ,'http_api_timeout' => 5
126
  ,'form_submission_log' => 0
@@ -369,14 +405,10 @@ class wpGForm
369
  function gform_sc($options)
370
  {
371
  if (self::ProcessShortCodeOptions($options))
372
- {
373
  return self::ConstructGoogleForm() ;
374
- }
375
  else
376
- {
377
  return sprintf('<div class="wpgform-google-error gform-google-error">%s</div>',
378
  __('Unable to process Google Form short code.', WPGFORM_I18N_DOMAIN)) ;
379
- }
380
  }
381
 
382
  /**
@@ -469,15 +501,14 @@ class wpGForm
469
  return false ;
470
  }
471
  else
472
- {
473
  return false ;
474
- }
475
 
476
- // get current form meta data
477
 
478
- $mb = wpgform_form_meta_box_content() ;
 
479
 
480
- foreach ($mb['fields'] as $field)
481
  {
482
  // Only show the fields which are not hidden
483
  if ($field['type'] !== 'hidden')
@@ -631,6 +662,8 @@ class wpGForm
631
 
632
  self::$wpgform_captcha = array('a' => $a, 'b' => $b, 'c' => $c, 'x' => $x) ;
633
 
 
 
634
  $captcha_html .= '<div class="wpgform-captcha">' ;
635
  $captcha_html .= sprintf('<div class="%sss-item %sss-item-required %sss-text">', $prefix, $prefix, $prefix) ;
636
  $captcha_html .= sprintf('<div class="%sss-form-entry">', $prefix) ;
@@ -641,7 +674,17 @@ class wpGForm
641
  $captcha_html .= sprintf('<span class="%sss-required-asterisk">*</span></label>', $prefix) ;
642
  $captcha_html .= sprintf('<label for="wpgform-captcha" class="%sss-q-help"></label>', $prefix) ;
643
  $captcha_html .= sprintf('<input style="width: 100px;" type="text" id="wpgform-captcha" class="%sss-q-short" value="" name="wpgform-captcha">', $prefix) ;
644
- $captcha_html .= '</div></div></div>' ;
 
 
 
 
 
 
 
 
 
 
645
  }
646
 
647
  // Use jQuery validation? Force it on when CAPTCHA is on
@@ -697,9 +740,9 @@ class wpGForm
697
 
698
  if (!self::$posted)
699
  {
700
- self::$response = wp_remote_get($form, array('sslverify' => false, 'timeout' => $timeout, 'redirection' => 12, 'cookies' => array($locale_cookie))) ;
701
- //self::$response = wp_remote_get($form, array('sslverify' => false, 'timeout' => $timeout, 'redirection' => 12)) ;
702
- error_log(print_r(self::$response, true)) ;
703
  }
704
 
705
  // Retrieve the HTML from the URL
@@ -725,7 +768,12 @@ class wpGForm
725
  else
726
  $html = self::$response['body'] ;
727
 
728
- if (WPGFORM_DEBUG) wpgform_whereami(__FILE__, __LINE__, 'ConstructGoogleForm') ;
 
 
 
 
 
729
 
730
  // Need to filter the HTML retrieved from the form and strip off the stuff
731
  // we don't want. This gets rid of the HTML wrapper from the Google page.
@@ -771,11 +819,24 @@ class wpGForm
771
 
772
  $html = wp_kses($html, $allowed_tags) ;
773
 
 
 
 
 
 
 
774
  // Did we end up with anything prior to the first DIV? If so, remove it as
775
  // it should have been removed by wp_kses() but sometimes stuff slips through!
776
 
777
  $first_div = strpos($html, '<div') ;
778
 
 
 
 
 
 
 
 
779
  // If there are no DIVs, then we have garbage and should stop now!
780
 
781
  if ($first_div === false)
@@ -931,8 +992,8 @@ jQuery(document).ready(function($) {
931
  "wpgform-user-email": {
932
  email: true
933
  }' ;
934
- $vMsgs_js[] = '
935
- "wpgform-user-email": "A valid email address is required."' ;
936
  }
937
 
938
  // Is CAPTCHA enabled?
@@ -945,7 +1006,7 @@ jQuery(document).ready(function($) {
945
  $("#ss-form input[type=submit][name=submit]").before(\'%s\');
946
  $("div.wpgform-captcha").show();
947
  $.validator.addClassRules("wpgform-captcha", {
948
- required: true
949
  });
950
  }
951
  ', $captcha_html, self::$wpgform_captcha['c']) ;
@@ -954,9 +1015,29 @@ jQuery(document).ready(function($) {
954
  equal: %s
955
  }
956
  ', self::$wpgform_captcha['x']) ;
957
- $vMsgs_js[] = '
958
- "wpgform-captcha": "Incorrect answer."
959
- ' ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
960
  }
961
 
962
  // Include jQuery validation?
@@ -976,6 +1057,11 @@ jQuery(document).ready(function($) {
976
  $("#ss-form").validate({
977
  errorClass: "wpgform-error",
978
  rules: {' ;
 
 
 
 
 
979
  if (empty($vRules_js))
980
  $js .= '},' ;
981
  else
@@ -1159,14 +1245,16 @@ jQuery(document).ready(function($) {
1159
  // Log form submission?
1160
  if (self::$posted && is_null($action))
1161
  {
 
 
1162
  $log = array(
1163
- 'url' => $_SERVER['URL']
1164
  ,'timestamp' => date('Y-m-d H:i:s')
1165
- ,'remote_addr' => $_SERVER['REMOTE_ADDR']
1166
- ,'remote_host' => $_SERVER['REMOTE_HOST']
1167
- ,'http_referer' => $_SERVER['HTTP_REFERER']
1168
- ,'http_user_agent' => $_SERVER['HTTP_USER_AGENT']
1169
- ,'form' => (array_key_exists('id', $o) ? $o['id'] : null)
1170
  ,'post_id' => get_the_ID()
1171
  ) ;
1172
 
@@ -1284,7 +1372,9 @@ jQuery(document).ready(function($) {
1284
  // appropriate HTML entity or some variety of it. Need to undo
1285
  // that so the URL can be actually be used.
1286
 
 
1287
  $action = str_replace(array('&#038;','&#38;','&amp;'), '&', $action) ;
 
1288
  if (WPGFORM_DEBUG)
1289
  {
1290
  wpgform_preprint_r($action) ;
@@ -1528,6 +1618,31 @@ function wpgform_head()
1528
  plugins_url(plugin_basename(dirname(__FILE__) . '/js/jquery.columnizer.js')),
1529
  array('jquery'), false, true) ;
1530
  wp_enqueue_script('jquery-columnizer') ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1531
  }
1532
 
1533
  /**
44
  }
45
  }
46
 
 
 
47
  // Need the plugin options to initialize debug
48
  $wpgform_options = wpgform_get_plugin_options() ;
49
 
50
+ // Disable fsockopen transport?
51
+ if ($wpgform_options['fsockopen_transport'] == 1)
52
+ add_filter('use_fsockopen_transport', '__return_false') ;
53
+
54
+ // Disable streams transport?
55
+ if ($wpgform_options['streams_transport'] == 1)
56
+ add_filter('use_streams_transport', '__return_false') ;
57
+
58
+ // Disable curl transport?
59
+ if ($wpgform_options['curl_transport'] == 1)
60
+ add_filter('use_curl_transport', '__return_false') ;
61
+
62
+ // Disable local ssl verify?
63
+ if ($wpgform_options['local_ssl_verify'] == 1)
64
+ add_filter('https_local_ssl_verify', '__return_false') ;
65
+
66
+ // Disable ssl verify?
67
+ if ($wpgform_options['ssl_verify'] == 1)
68
+ add_filter('https_ssl_verify', '__return_false') ;
69
+
70
+ // Change the HTTP Time out?
71
+ if ($wpgform_options['http_request_timeout'] == 1)
72
+ {
73
+ if (is_int($wpgform_options['http_request_timeout_value'])
74
+ || ctype_digit($wpgform_options['http_request_timeout_value']))
75
+ add_filter('http_request_timeout', 'wpgform_http_request_timeout') ;
76
+ }
77
+
78
+ /**
79
+ * Optional filter to change HTTP Request Timeout
80
+ *
81
+ */
82
+ function wpgform_http_request_timeout($timeout) {
83
+ $wpgform_options = wpgform_get_plugin_options() ;
84
+ return $wpgform_options['http_request_timeout'] ;
85
+ }
86
+
87
  // Enable debug content?
88
  define('WPGFORM_DEBUG', $wpgform_options['enable_debug'] == 1) ;
89
  //define('WPGFORM_DEBUG', true) ;
156
  ,'captcha_operator_plus' => 1
157
  ,'captcha_operator_minus' => 0
158
  ,'captcha_operator_mult' => 0
159
+ ,'captcha_description' => ''
160
  ,'email_format' => WPGFORM_EMAIL_FORMAT_PLAIN
161
  ,'http_api_timeout' => 5
162
  ,'form_submission_log' => 0
405
  function gform_sc($options)
406
  {
407
  if (self::ProcessShortCodeOptions($options))
 
408
  return self::ConstructGoogleForm() ;
 
409
  else
 
410
  return sprintf('<div class="wpgform-google-error gform-google-error">%s</div>',
411
  __('Unable to process Google Form short code.', WPGFORM_I18N_DOMAIN)) ;
 
412
  }
413
 
414
  /**
501
  return false ;
502
  }
503
  else
 
504
  return false ;
 
505
 
506
+ // get current form meta data fields
507
 
508
+ $fields = array_merge(wpgform_primary_meta_box_content(true),
509
+ wpgform_secondary_meta_box_content(true), wpgform_validation_meta_box_content(true)) ;
510
 
511
+ foreach ($fields as $field)
512
  {
513
  // Only show the fields which are not hidden
514
  if ($field['type'] !== 'hidden')
662
 
663
  self::$wpgform_captcha = array('a' => $a, 'b' => $b, 'c' => $c, 'x' => $x) ;
664
 
665
+ // Build the CAPTCHA HTML
666
+
667
  $captcha_html .= '<div class="wpgform-captcha">' ;
668
  $captcha_html .= sprintf('<div class="%sss-item %sss-item-required %sss-text">', $prefix, $prefix, $prefix) ;
669
  $captcha_html .= sprintf('<div class="%sss-form-entry">', $prefix) ;
674
  $captcha_html .= sprintf('<span class="%sss-required-asterisk">*</span></label>', $prefix) ;
675
  $captcha_html .= sprintf('<label for="wpgform-captcha" class="%sss-q-help"></label>', $prefix) ;
676
  $captcha_html .= sprintf('<input style="width: 100px;" type="text" id="wpgform-captcha" class="%sss-q-short" value="" name="wpgform-captcha">', $prefix) ;
677
+ $captcha_html .= '</div></div>' ;
678
+
679
+ // Add in the optional CAPTCHA description if one has been set
680
+
681
+ if (!empty($wpgform_options['captcha_description']))
682
+ {
683
+ $captcha_html .= sprintf('<div class="wpgform-captcha-description">%s</div>', $wpgform_options['captcha_description']) ;
684
+ error_log(sprintf('%s::%s', basename(__FILE__), __LINE__)) ;
685
+ }
686
+
687
+ $captcha_html .= '</div>' ;
688
  }
689
 
690
  // Use jQuery validation? Force it on when CAPTCHA is on
740
 
741
  if (!self::$posted)
742
  {
743
+ //self::$response = wp_remote_get($form, array('sslverify' => false, 'timeout' => $timeout, 'redirection' => 12, 'cookies' => array($locale_cookie))) ;
744
+ self::$response = wp_remote_get($form, array('sslverify' => false, 'timeout' => $timeout, 'redirection' => 12)) ;
745
+ //error_log(print_r(self::$response, true)) ;
746
  }
747
 
748
  // Retrieve the HTML from the URL
768
  else
769
  $html = self::$response['body'] ;
770
 
771
+ if (WPGFORM_DEBUG)
772
+ {
773
+ wpgform_whereami(__FILE__, __LINE__, 'ConstructGoogleForm') ;
774
+ wpgform_htmlspecialchars_preprint_r(self::$response) ;
775
+ //wpgform_htmlspecialchars_preprint_r($html) ;
776
+ }
777
 
778
  // Need to filter the HTML retrieved from the form and strip off the stuff
779
  // we don't want. This gets rid of the HTML wrapper from the Google page.
819
 
820
  $html = wp_kses($html, $allowed_tags) ;
821
 
822
+ if (WPGFORM_DEBUG)
823
+ {
824
+ wpgform_whereami(__FILE__, __LINE__, 'ConstructGoogleForm') ;
825
+ wpgform_htmlspecialchars_preprint_r($html) ;
826
+ }
827
+
828
  // Did we end up with anything prior to the first DIV? If so, remove it as
829
  // it should have been removed by wp_kses() but sometimes stuff slips through!
830
 
831
  $first_div = strpos($html, '<div') ;
832
 
833
+ if (WPGFORM_DEBUG)
834
+ {
835
+ wpgform_whereami(__FILE__, __LINE__, 'ConstructGoogleForm') ;
836
+ wpgform_htmlspecialchars_preprint_r($html) ;
837
+ wpgform_preprint_r($first_div) ;
838
+ }
839
+
840
  // If there are no DIVs, then we have garbage and should stop now!
841
 
842
  if ($first_div === false)
992
  "wpgform-user-email": {
993
  email: true
994
  }' ;
995
+ $vMsgs_js[] = sprintf('
996
+ "wpgform-user-email": "%s"', __('A valid email address is required.', WPGFORM_I18N_DOMAIN)) ;
997
  }
998
 
999
  // Is CAPTCHA enabled?
1006
  $("#ss-form input[type=submit][name=submit]").before(\'%s\');
1007
  $("div.wpgform-captcha").show();
1008
  $.validator.addClassRules("wpgform-captcha", {
1009
+ required: true,
1010
  });
1011
  }
1012
  ', $captcha_html, self::$wpgform_captcha['c']) ;
1015
  equal: %s
1016
  }
1017
  ', self::$wpgform_captcha['x']) ;
1018
+ $vMsgs_js[] = sprintf('
1019
+ "wpgform-captcha": "%s"
1020
+ ', __('Incorrect answer.', WPGFORM_I18N_DOMAIN)) ;
1021
+ }
1022
+
1023
+ // Build extra jQuery Validation rules
1024
+
1025
+ $fields = wpgform_validation_meta_box_content(true) ;
1026
+
1027
+ foreach ($fields as $field)
1028
+ {
1029
+ if ('validation' == $field['type'])
1030
+ {
1031
+ $meta_field = get_post_meta($o['id'], $field['id'], true);
1032
+ $meta_type = get_post_meta($o['id'], $field['type_id'], true);
1033
+ $meta_value = get_post_meta($o['id'], $field['value_id'], true);
1034
+
1035
+ if (!empty($meta_field)) {
1036
+ foreach ($meta_field as $key => $value)
1037
+ $extras[$value] = sprintf('{%s: %s}',
1038
+ $meta_type[$key], empty($meta_value[$key]) ? 'true' : $meta_value[$key]) ;
1039
+ }
1040
+ }
1041
  }
1042
 
1043
  // Include jQuery validation?
1057
  $("#ss-form").validate({
1058
  errorClass: "wpgform-error",
1059
  rules: {' ;
1060
+ if (!empty($extras))
1061
+ {
1062
+ foreach ($extras as $key => $value)
1063
+ $js .= sprintf('"%s": %s%s', $key, $value, $value === end($extras) ? ' ,' : ',') ;
1064
+ }
1065
  if (empty($vRules_js))
1066
  $js .= '},' ;
1067
  else
1245
  // Log form submission?
1246
  if (self::$posted && is_null($action))
1247
  {
1248
+ $unknown = __('Unknown', WPGFORM_I18N_DOMAIN) ;
1249
+
1250
  $log = array(
1251
+ 'url' => array_key_exists('URL', $_SERVER) ? $_SERVER['URL'] : $unknown
1252
  ,'timestamp' => date('Y-m-d H:i:s')
1253
+ ,'remote_addr' => array_key_exists('REMOTE_ADDR', $_SERVER) ? $_SERVER['REMOTE_ADDR'] : $unknown
1254
+ ,'remote_host' => array_key_exists('REMOTE_HOST', $_SERVER) ? $_SERVER['REMOTE_HOST'] : $unknown
1255
+ ,'http_referer' => array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : $unknown
1256
+ ,'http_user_agent' => array_key_exists('HTTP_USER_AGENT', $_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : $unknown
1257
+ ,'form' => array_key_exists('id', $o) ? $o['id'] : null
1258
  ,'post_id' => get_the_ID()
1259
  ) ;
1260
 
1372
  // appropriate HTML entity or some variety of it. Need to undo
1373
  // that so the URL can be actually be used.
1374
 
1375
+ $body = stripslashes_deep(urldecode($body)) ;
1376
  $action = str_replace(array('&#038;','&#38;','&amp;'), '&', $action) ;
1377
+
1378
  if (WPGFORM_DEBUG)
1379
  {
1380
  wpgform_preprint_r($action) ;
1618
  plugins_url(plugin_basename(dirname(__FILE__) . '/js/jquery.columnizer.js')),
1619
  array('jquery'), false, true) ;
1620
  wp_enqueue_script('jquery-columnizer') ;
1621
+
1622
+ // Load the WordPress Google Form jQuery Validate script from the plugin
1623
+ wp_register_script('wpgform-jquery-validate',
1624
+ plugins_url(plugin_basename(dirname(__FILE__) . '/js/wpgform.js')),
1625
+ array('jquery', 'jquery-validate'), false, true) ;
1626
+ wp_enqueue_script('wpgform-jquery-validate') ;
1627
+ wp_localize_script('wpgform-jquery-validate', 'wpgform_script_vars', array(
1628
+ 'required' => __('This field is required.', WPGFORM_I18N_DOMAIN),
1629
+ 'remote' => __('Please fix this field.', WPGFORM_I18N_DOMAIN),
1630
+ 'email' => __('Please enter a valid email address.', WPGFORM_I18N_DOMAIN),
1631
+ 'url' => __('Please enter a valid URL.', WPGFORM_I18N_DOMAIN),
1632
+ 'date' => __('Please enter a valid date.', WPGFORM_I18N_DOMAIN),
1633
+ 'dateISO' => __('Please enter a valid date (ISO).', WPGFORM_I18N_DOMAIN),
1634
+ 'number' => __('Please enter a valid number.', WPGFORM_I18N_DOMAIN),
1635
+ 'digits' => __('Please enter only digits.', WPGFORM_I18N_DOMAIN),
1636
+ 'creditcard' => __('Please enter a valid credit card number.', WPGFORM_I18N_DOMAIN),
1637
+ 'equalTo' => __('Please enter the same value again.,', WPGFORM_I18N_DOMAIN),
1638
+ 'accept' => __('Please enter a value with a valid extension.', WPGFORM_I18N_DOMAIN),
1639
+ 'maxlength' => __('Please enter no more than {0} characters.', WPGFORM_I18N_DOMAIN),
1640
+ 'minlength' => __('Please enter at least {0} characters.', WPGFORM_I18N_DOMAIN),
1641
+ 'rangelength' => __('Please enter a value between {0} and {1} characters long.', WPGFORM_I18N_DOMAIN),
1642
+ 'range' => __('Please enter a value between {0} and {1}.', WPGFORM_I18N_DOMAIN),
1643
+ 'max' => __('Please enter a value less than or equal to {0}.', WPGFORM_I18N_DOMAIN),
1644
+ 'min' => __('Please enter a value greater than or equal to {0}.', WPGFORM_I18N_DOMAIN)
1645
+ )) ;
1646
  }
1647
 
1648
  /**
wpgform-debug.php CHANGED
@@ -22,47 +22,6 @@ $wpgform_debug_content = '' ;
22
  add_action('init', 'wpgform_debug', 0) ;
23
  add_action('wp_footer', 'wpgform_show_debug_content') ;
24
 
25
- // In debug mode several filters can be disabled for debugging purposes.
26
-
27
- $wpgform_options = wpgform_get_plugin_options() ;
28
-
29
- // Change the HTTP Time out
30
- if ($wpgform_options['http_request_timeout'] == 1)
31
- {
32
- if (is_int($wpgform_options['http_request_timeout_value'])
33
- || ctype_digit($wpgform_options['http_request_timeout_value']))
34
- add_filter('http_request_timeout', 'wpgform_http_request_timeout') ;
35
- }
36
-
37
- // Disable fsockopen transport?
38
- if ($wpgform_options['fsockopen_transport'] == 1)
39
- add_filter('use_fsockopen_transport', '__return_false') ;
40
-
41
- // Disable streams transport?
42
- if ($wpgform_options['streams_transport'] == 1)
43
- add_filter('use_streams_transport', '__return_false') ;
44
-
45
- // Disable curl transport?
46
- if ($wpgform_options['curl_transport'] == 1)
47
- add_filter('use_curl_transport', '__return_false') ;
48
-
49
- // Disable local ssl verify?
50
- if ($wpgform_options['local_ssl_verify'] == 1)
51
- add_filter('https_local_ssl_verify', '__return_false') ;
52
-
53
- // Disable ssl verify?
54
- if ($wpgform_options['ssl_verify'] == 1)
55
- add_filter('https_ssl_verify', '__return_false') ;
56
-
57
- /**
58
- * Optional filter to change HTTP Request Timeout
59
- *
60
- */
61
- function wpgform_http_request_timeout($timeout) {
62
- $wpgform_options = wpgform_get_plugin_options() ;
63
- return $wpgform_options['http_request_timeout'] ;
64
- }
65
-
66
  /**
67
  * Debug action to examine server variables
68
  *
@@ -117,6 +76,7 @@ h2.wpgform-debug {
117
 
118
  div.wpgform-debug {
119
  padding: 10px;
 
120
  }
121
 
122
  div.wpgform-debug h2 {
@@ -205,6 +165,21 @@ function wpgform_preprint_r()
205
  }
206
  wpgform_error_log(func_get_args()) ;
207
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  /**
209
  * Debug functions
210
  */
22
  add_action('init', 'wpgform_debug', 0) ;
23
  add_action('wp_footer', 'wpgform_show_debug_content') ;
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  /**
26
  * Debug action to examine server variables
27
  *
76
 
77
  div.wpgform-debug {
78
  padding: 10px;
79
+ direction: ltr;
80
  }
81
 
82
  div.wpgform-debug h2 {
165
  }
166
  wpgform_error_log(func_get_args()) ;
167
  }
168
+
169
+ /**
170
+ * Debug functions
171
+ */
172
+ function wpgform_htmlspecialchars_preprint_r()
173
+ {
174
+ global $wpgform_debug_content ;
175
+
176
+ $numargs = func_num_args() ;
177
+ $arg_list = func_get_args() ;
178
+ for ($i = 0; $i < $numargs; $i++) {
179
+ $wpgform_debug_content .= sprintf('<pre style="text-align:left;">%s</pre>', htmlspecialchars(print_r($arg_list[$i], true))) ;
180
+ }
181
+ wpgform_error_log(func_get_args()) ;
182
+ }
183
  /**
184
  * Debug functions
185
  */
wpgform-options.php CHANGED
@@ -205,6 +205,7 @@ function wpgform_options_page()
205
  function wpgform_settings_input()
206
  {
207
  $wpgform_options = wpgform_get_plugin_options() ;
 
208
  ?>
209
  <table class="form-table">
210
  <tr valign="top">
@@ -246,7 +247,7 @@ function wpgform_settings_input()
246
  <br/>
247
  <input name="wpgform_options[captcha_terms]" type="radio" id="wpgform_captcha_terms" value="3" <?php checked(3, $wpgform_options['captcha_terms']) ; ?> />
248
  <?php _e('Use three (3) terms for CAPTCHA: e.g. A + B - C = D (when enabled).', WPGFORM_I18N_DOMAIN);?></label>
249
- <br />
250
  <label for="wpgform_captcha_operator_plus">
251
  <input name="wpgform_options[captcha_operator_plus]" type="checkbox" id="wpgform_captcha_operator_plus" value="1" <?php checked('1', $wpgform_options['captcha_operator_plus']) ; ?> />
252
  <?php _e('Addition: +', WPGFORM_I18N_DOMAIN);?><br /></label>
@@ -257,6 +258,14 @@ function wpgform_settings_input()
257
  <input name="wpgform_options[captcha_operator_mult]" type="checkbox" id="wpgform_captcha_operator_mult" value="1" <?php checked('1', $wpgform_options['captcha_operator_mult']) ; ?> />
258
  <?php _e('Multiplication: *', WPGFORM_I18N_DOMAIN);?><br /></label>
259
  <small><?php _e('Choose which operators can be used for CAPTCHA validation (when enabled)', WPGFORM_I18N_DOMAIN);?></small>
 
 
 
 
 
 
 
 
260
  </fieldset></td>
261
  </tr>
262
  <tr valign="top">
@@ -310,7 +319,7 @@ function wpgform_settings_input()
310
  <input name="wpgform_options[http_request_timeout]" type="hidden" id="wpgform_http_request_timeout" value="<?php echo $wpgform_options['http_request_timeout'] ; ?>" />
311
  <input name="wpgform_options[http_request_timeout_value]" type="hidden" id="wpgform_http_request_timeout_value" value="<?php echo $wpgform_options['http_request_timeout_value'] ; ?>" />
312
  <input name="wpgform_options[browser_check]" type="hidden" id="wpgform_browser_check" value="<?php echo $wpgform_options['browser_check'] ; ?>" />
313
- <input name="wpgform_options[submission_log]" type="hidden" id="wpgform_submission_log" value="<?php echo $wpgform_options['submission_log'] ; ?>" />
314
  <?php
315
  }
316
 
205
  function wpgform_settings_input()
206
  {
207
  $wpgform_options = wpgform_get_plugin_options() ;
208
+ error_log(print_r($wpgform_options, true)) ;
209
  ?>
210
  <table class="form-table">
211
  <tr valign="top">
247
  <br/>
248
  <input name="wpgform_options[captcha_terms]" type="radio" id="wpgform_captcha_terms" value="3" <?php checked(3, $wpgform_options['captcha_terms']) ; ?> />
249
  <?php _e('Use three (3) terms for CAPTCHA: e.g. A + B - C = D (when enabled).', WPGFORM_I18N_DOMAIN);?></label>
250
+ <br style="margin-bottom: 10px;"/>
251
  <label for="wpgform_captcha_operator_plus">
252
  <input name="wpgform_options[captcha_operator_plus]" type="checkbox" id="wpgform_captcha_operator_plus" value="1" <?php checked('1', $wpgform_options['captcha_operator_plus']) ; ?> />
253
  <?php _e('Addition: +', WPGFORM_I18N_DOMAIN);?><br /></label>
258
  <input name="wpgform_options[captcha_operator_mult]" type="checkbox" id="wpgform_captcha_operator_mult" value="1" <?php checked('1', $wpgform_options['captcha_operator_mult']) ; ?> />
259
  <?php _e('Multiplication: *', WPGFORM_I18N_DOMAIN);?><br /></label>
260
  <small><?php _e('Choose which operators can be used for CAPTCHA validation (when enabled)', WPGFORM_I18N_DOMAIN);?></small>
261
+
262
+ <br style="margin-bottom: 10px;"/>
263
+ <label for="wpgform_catcha_description">
264
+ <input style="width: 500px;" name="wpgform_options[captcha_description]" type="text" id="wpgform_captcha_description" value="<?php echo $wpgform_options['captcha_description'] ; ?>" /><br />
265
+ <small><?php _e('Optional description of what the CAPTCHA is and used for.', WPGFORM_I18N_DOMAIN);?></small></label>
266
+
267
+
268
+
269
  </fieldset></td>
270
  </tr>
271
  <tr valign="top">
319
  <input name="wpgform_options[http_request_timeout]" type="hidden" id="wpgform_http_request_timeout" value="<?php echo $wpgform_options['http_request_timeout'] ; ?>" />
320
  <input name="wpgform_options[http_request_timeout_value]" type="hidden" id="wpgform_http_request_timeout_value" value="<?php echo $wpgform_options['http_request_timeout_value'] ; ?>" />
321
  <input name="wpgform_options[browser_check]" type="hidden" id="wpgform_browser_check" value="<?php echo $wpgform_options['browser_check'] ; ?>" />
322
+ <input name="wpgform_options[form_submission_log]" type="hidden" id="wpgform_form_submission_log" value="<?php echo $wpgform_options['form_submission_log'] ; ?>" />
323
  <?php
324
  }
325
 
wpgform-post-type.php CHANGED
@@ -62,40 +62,47 @@ function wpgform_register_post_types()
62
  }
63
 
64
  // Build custom meta box support
 
 
 
 
 
 
 
65
 
66
  /**
67
- * Define the WordPress Google Form Meta Box fields so they can be
68
- * used to construct the form as well as validate it and save it.
69
  *
70
  */
71
- function wpgform_form_meta_box_content()
72
  {
73
- return array(
74
- 'id' => 'wpgform-meta-box',
75
  'title' => 'Google Form Details',
76
  'page' => WPGFORM_CPT_FORM,
77
  'context' => 'normal',
78
  'priority' => 'high',
79
  'fields' => array(
80
  array(
81
- 'name' => 'Form URL',
82
- 'desc' => 'The full URL to the published Google Form.',
83
  'id' => WPGFORM_PREFIX . 'form',
84
  'type' => 'lgtext',
85
  'std' => '',
86
  'required' => true
87
  ),
88
  array(
89
- 'name' => 'Confirm URL',
90
- 'desc' => 'The full URL to the optional Confirmation Page.',
91
  'id' => WPGFORM_PREFIX . 'confirm',
92
  'type' => 'lgtext',
93
  'std' => '',
94
  'required' => false
95
  ),
96
  array(
97
- 'name' => 'Style',
98
- 'desc' => 'Custom Confirmation Page Style',
99
  'id' => WPGFORM_PREFIX . 'style',
100
  'type' => 'select',
101
  'options' => array('None', 'Redirect', 'AJAX'),
@@ -103,24 +110,78 @@ function wpgform_form_meta_box_content()
103
  'br' => true
104
  ),
105
  array(
106
- 'name' => 'Alert',
107
- 'desc' => 'Javascript Alert Box message displayed upon submission',
108
  'id' => WPGFORM_PREFIX . 'alert',
109
  'type' => 'lgtext',
110
  'std' => '',
111
  'required' => false
112
  ),
113
  array(
114
- 'name' => 'Class',
115
- 'desc' => 'CSS class(es) to add to the form\'s containing DIV',
116
  'id' => WPGFORM_PREFIX . 'class',
117
  'type' => 'medtext',
118
  'std' => '',
119
  'required' => false
120
  ),
121
  array(
122
- 'name' => 'Columns',
123
- 'desc' => 'Number of columns to render form',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  'id' => WPGFORM_PREFIX . 'columns',
125
  'type' => 'select',
126
  'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
@@ -128,8 +189,17 @@ function wpgform_form_meta_box_content()
128
  'required' => true
129
  ),
130
  array(
131
- 'name' => 'Legal',
132
- 'desc' => 'Google Legal Disclaimer',
 
 
 
 
 
 
 
 
 
133
  'id' => WPGFORM_PREFIX . 'legal',
134
  'type' => 'radio',
135
  'options' => array('On', 'Off'),
@@ -137,8 +207,8 @@ function wpgform_form_meta_box_content()
137
  'br' => false
138
  ),
139
  array(
140
- 'name' => 'Read Only',
141
- 'desc' => 'Set the form Read Only',
142
  'id' => WPGFORM_PREFIX . 'readonly',
143
  'type' => 'radio',
144
  'options' => array('On', 'Off'),
@@ -146,8 +216,8 @@ function wpgform_form_meta_box_content()
146
  'br' => false
147
  ),
148
  array(
149
- 'name' => 'BR',
150
- 'desc' => 'Insert &lt;BR&gt; tags between labels and input box',
151
  'id' => WPGFORM_PREFIX . 'br',
152
  'type' => 'radio',
153
  'options' => array('On', 'Off'),
@@ -155,24 +225,24 @@ function wpgform_form_meta_box_content()
155
  'br' => false
156
  ),
157
  array(
158
- 'name' => 'CSS Prefix',
159
- 'desc' => 'Prefix to add to all Google CSS classes',
160
  'id' => WPGFORM_PREFIX . 'css_prefix',
161
- 'type' => 'smtext',
162
  'std' => '',
163
  'required' => false
164
  ),
165
  array(
166
- 'name' => 'CSS Suffix',
167
- 'desc' => 'Suffix to add to all Google CSS classes',
168
  'id' => WPGFORM_PREFIX . 'css_suffix',
169
- 'type' => 'smtext',
170
  'std' => '',
171
  'required' => false
172
  ),
173
  array(
174
- 'name' => 'Title',
175
- 'desc' => 'Show or Hide the Google Form\'s title',
176
  'id' => WPGFORM_PREFIX . 'title',
177
  'type' => 'radio',
178
  'options' => array('On', 'Off'),
@@ -180,8 +250,8 @@ function wpgform_form_meta_box_content()
180
  'br' => false
181
  ),
182
  array(
183
- 'name' => 'Map H1 to H2',
184
- 'desc' => 'Map the Form\'s H1 elements to H2 elements',
185
  'id' => WPGFORM_PREFIX . 'maph1h2',
186
  'type' => 'radio',
187
  'options' => array('On', 'Off'),
@@ -189,42 +259,37 @@ function wpgform_form_meta_box_content()
189
  'br' => false
190
  ),
191
  array(
192
- 'name' => 'Email',
193
- 'desc' => 'Send email upon form submission',
194
- 'id' => WPGFORM_PREFIX . 'email',
195
- 'type' => 'radio',
196
- 'options' => array('On', 'Off'),
197
- 'required' => false,
198
- 'br' => false
199
- ),
200
- array(
201
- 'name' => 'Send To',
202
- 'desc' => 'E-mail Address send submission email to',
203
- 'id' => WPGFORM_PREFIX . 'sendto',
204
- 'type' => 'medtext',
205
- 'std' => '',
206
- 'required' => false
207
- ),
208
- array(
209
- 'name' => 'Results',
210
- 'desc' => 'The full URL to the published Results Page or Google Spreadsheet.',
211
- 'id' => WPGFORM_PREFIX . 'results',
212
- 'type' => 'lgtext',
213
- 'std' => '',
214
- 'required' => false
215
- ),
216
- array(
217
- 'name' => 'Email End User',
218
- 'desc' => 'Send email to end user upon form submission.',
219
- 'id' => WPGFORM_PREFIX . 'user_email',
220
  'type' => 'radio',
221
  'options' => array('On', 'Off'),
222
  'required' => false,
223
  'br' => false
224
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  array(
226
- 'name' => 'Validation',
227
- 'desc' => 'jQuery Validation',
228
  'id' => WPGFORM_PREFIX . 'validation',
229
  'type' => 'radio',
230
  'options' => array('On', 'Off'),
@@ -232,51 +297,96 @@ function wpgform_form_meta_box_content()
232
  'br' => false
233
  ),
234
  array(
235
- 'name' => 'CAPTCHA',
236
- 'desc' => 'CAPTCHA',
237
- 'id' => WPGFORM_PREFIX . 'captcha',
238
- 'type' => 'radio',
239
- 'options' => array('On', 'Off'),
240
- 'required' => false,
241
- 'br' => false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  ),
243
  array(
244
- 'name' => 'Unite Theme Hack',
245
- 'desc' => 'Unite Theme Hack',
246
- 'id' => WPGFORM_PREFIX . 'unitethemehack',
247
- 'type' => 'radio',
248
- 'options' => array('On', 'Off'),
249
- 'required' => false,
250
- 'br' => false
251
  ),
252
  array(
253
- 'name' => 'Form CSS',
254
- 'desc' => 'Form specific CSS classes',
255
- 'id' => WPGFORM_PREFIX . 'form_css',
256
- 'type' => 'textarea',
257
  'std' => '',
258
  'required' => false
259
  ),
260
  )
261
  ) ;
 
 
262
  }
263
 
264
- add_action('admin_menu', 'wpgform_add_form_meta_box') ;
265
  //add_action('admin_menu', 'wpgform_add_player_profile_meta_box') ;
266
 
267
  // Add form meta box
268
- function wpgform_add_form_meta_box()
269
  {
270
- $mb = wpgform_form_meta_box_content() ;
 
 
 
 
 
 
 
 
 
 
271
 
272
  add_meta_box($mb['id'], $mb['title'],
273
- 'wpgform_show_form_meta_box', $mb['page'], $mb['context'], $mb['priority']);
 
 
 
 
 
 
 
274
  }
275
 
276
  // Callback function to show fields in meta box
277
- function wpgform_show_form_meta_box()
 
 
 
 
 
 
 
278
  {
279
- $mb = wpgform_form_meta_box_content() ;
280
  wpgform_build_meta_box($mb) ;
281
  }
282
 
@@ -284,6 +394,8 @@ function wpgform_show_form_meta_box()
284
  * Build meta box form
285
  *
286
  * @see http://www.deluxeblogtips.com/2010/04/how-to-create-meta-box-wordpress-post.html
 
 
287
  *
288
  */
289
  function wpgform_build_meta_box($mb)
@@ -312,15 +424,19 @@ function wpgform_build_meta_box($mb)
312
  case 'lgtext':
313
  echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '<br />', '<small>', $field['desc'], '</small>';
314
  break;
 
315
  case 'medtext':
316
  echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:47%" />', '<br />', '<small>', $field['desc'], '</small>';
317
  break;
 
318
  case 'smtext':
319
  echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:27%" />', '<br />', '<small>', $field['desc'], '</small>';
320
  break;
 
321
  case 'textarea':
322
  echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>', '<br />', '<small>', $field['desc'], '</small>';
323
  break;
 
324
  case 'select':
325
  echo '<select name="', $field['id'], '" id="', $field['id'], '">';
326
  foreach ($field['options'] as $option => $value) {
@@ -329,15 +445,67 @@ function wpgform_build_meta_box($mb)
329
  echo '</select>';
330
  echo '<br />', '<small>', $field['desc'], '</small>';
331
  break;
 
332
  case 'radio':
333
  foreach ($field['options'] as $option => $value) {
334
  echo '<input type="radio" name="', $field['id'], '" value="', strtolower($value), '"', $meta == strtolower($value) ? ' checked="checked"' : '', ' />&nbsp;', $value, $field['br'] === true ? '<br />' : '&nbsp;&nbsp;';
335
  }
336
  echo '<br />', '<small>', $field['desc'], '</small>';
337
  break;
 
338
  case 'checkbox':
339
  echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
340
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  default :
342
  break ;
343
  }
@@ -349,17 +517,14 @@ function wpgform_build_meta_box($mb)
349
  echo '</table>';
350
  }
351
 
352
- //wpgform_whereami(__FILE__, __LINE__) ;
353
  add_action( 'quick_edit_custom_box', 'wpgform_add_quick_edit_nonce', 10, 2 );
354
  //add_action( 'quick_edit_custom_box', function() { error_log(__LINE__) ; }, 10, 2 );
355
- //wpgform_whereami(__FILE__, __LINE__) ;
356
  /**
357
  * Action to add a nonce to the quick edit form for the custom post types
358
  *
359
  */
360
  function wpgform_add_quick_edit_nonce($column_name, $post_type)
361
  {
362
- //error_log(__LINE__) ;
363
  //wpgform_whereami(__FILE__, __LINE__) ;
364
  static $printNonce = true ;
365
 
@@ -416,7 +581,8 @@ function wpgform_save_meta_box_data($post_id)
416
  // return if the post isn't a CPT which shouldn't happen
417
 
418
  if (get_post_type($post_id) == WPGFORM_CPT_FORM)
419
- $mb = wpgform_form_meta_box_content() ;
 
420
  else
421
  return $post_id ;
422
 
@@ -426,7 +592,7 @@ function wpgform_save_meta_box_data($post_id)
426
  // the Short URL field.
427
 
428
  //wpgform_preprint_r($_POST) ;
429
- foreach ($mb['fields'] as $field)
430
  {
431
  // Only update other Post Meta fields when on the edit screen - ignore in quick edit mode
432
 
@@ -453,6 +619,10 @@ function wpgform_save_meta_box_data($post_id)
453
  //wpgform_whereami(__FILE__, __LINE__);
454
  }
455
  }
 
 
 
 
456
  }
457
  }
458
  }
@@ -530,7 +700,7 @@ add_filter('manage_edit-wpgform_sortable_columns', 'wpgform_form_sortable_column
530
 
531
  /**
532
  * Set up a footer hook to rearrange the post editing screen
533
- * for the WPGFORM_CPT_PLAYER custom post type. The meta box which has all
534
  * of the custom fields in it will appear before the Visual Editor.
535
  * This is accomplished using a simple jQuery script once the
536
  * document is loaded.
@@ -543,6 +713,16 @@ function wpgform_admin_footer_hook()
543
 
544
  if (get_post_type($post) == WPGFORM_CPT_FORM)
545
  {
 
 
 
 
 
 
 
 
 
 
546
  ?>
547
  <script type="text/javascript">
548
  jQuery(document).ready(function($) {
@@ -555,7 +735,7 @@ function wpgform_admin_footer_hook()
555
  }
556
 
557
  /** Hook into the Admin Footer */
558
- //add_action('admin_footer','wpgform_admin_footer_hook');
559
 
560
  /** Filter to change the Title field for the Player post type */
561
  add_filter('enter_title_here', 'wpgform_enter_title_here_filter') ;
@@ -570,14 +750,6 @@ function wpgform_enter_title_here_filter($title)
570
  return $title ;
571
  }
572
 
573
- /** Filter to show all posts for Position and Roster Taxonomies when viewing an archive */
574
- //add_filter('option_posts_per_page', 'wpgform_option_posts_per_page' );
575
-
576
- function wpgform_option_posts_per_page( $value ) {
577
- return (!is_admin() && (is_tax(WPGFORM_TAX_POSITION ) || is_tax(WPGFORM_TAX_ROSTER))) ? -1 : $value ;
578
- }
579
-
580
-
581
  /**
582
  * wpgform_admin_css()
583
  *
62
  }
63
 
64
  // Build custom meta box support
65
+ //
66
+ // There are three (3) meta boxes. The primary meta box collects
67
+ // the key fields and longer text input fields. The secondary meta
68
+ // box provides on/off settings and other selectable options. The
69
+ // third meta box allows entry of advanced validation rules and is
70
+ // hidden by default.
71
+ //
72
 
73
  /**
74
+ * Define the WordPress Google Form Primary Meta Box fields so they
75
+ * can be used to construct the form as well as validate and save it.
76
  *
77
  */
78
+ function wpgform_primary_meta_box_content($fieldsonly = false)
79
  {
80
+ $content = array(
81
+ 'id' => 'wpgform-primary-meta-box',
82
  'title' => 'Google Form Details',
83
  'page' => WPGFORM_CPT_FORM,
84
  'context' => 'normal',
85
  'priority' => 'high',
86
  'fields' => array(
87
  array(
88
+ 'name' => __('Form URL', WPGFORM_I18N_DOMAIN),
89
+ 'desc' => __('The full URL to the published Google Form', WPGFORM_I18N_DOMAIN),
90
  'id' => WPGFORM_PREFIX . 'form',
91
  'type' => 'lgtext',
92
  'std' => '',
93
  'required' => true
94
  ),
95
  array(
96
+ 'name' => __('Confirm URL', WPGFORM_I18N_DOMAIN),
97
+ 'desc' => __('The full URL to the optional Confirmation Page', WPGFORM_I18N_DOMAIN),
98
  'id' => WPGFORM_PREFIX . 'confirm',
99
  'type' => 'lgtext',
100
  'std' => '',
101
  'required' => false
102
  ),
103
  array(
104
+ 'name' => __('Style', WPGFORM_I18N_DOMAIN),
105
+ 'desc' => __('Custom Confirmation Page Style', WPGFORM_I18N_DOMAIN),
106
  'id' => WPGFORM_PREFIX . 'style',
107
  'type' => 'select',
108
  'options' => array('None', 'Redirect', 'AJAX'),
110
  'br' => true
111
  ),
112
  array(
113
+ 'name' => __('Alert', WPGFORM_I18N_DOMAIN),
114
+ 'desc' => __('Javascript Alert Box message displayed upon submission', WPGFORM_I18N_DOMAIN),
115
  'id' => WPGFORM_PREFIX . 'alert',
116
  'type' => 'lgtext',
117
  'std' => '',
118
  'required' => false
119
  ),
120
  array(
121
+ 'name' => __('Class', WPGFORM_I18N_DOMAIN),
122
+ 'desc' => __('CSS class(es) to add to the form\'s containing DIV', WPGFORM_I18N_DOMAIN),
123
  'id' => WPGFORM_PREFIX . 'class',
124
  'type' => 'medtext',
125
  'std' => '',
126
  'required' => false
127
  ),
128
  array(
129
+ 'name' => __('Email', WPGFORM_I18N_DOMAIN),
130
+ 'desc' => __('Send email upon form submission', WPGFORM_I18N_DOMAIN),
131
+ 'id' => WPGFORM_PREFIX . 'email',
132
+ 'type' => 'radio',
133
+ 'options' => array('On', 'Off'),
134
+ 'required' => false,
135
+ 'br' => false
136
+ ),
137
+ array(
138
+ 'name' => __('Send To', WPGFORM_I18N_DOMAIN),
139
+ 'desc' => __('Email address send submission email to', WPGFORM_I18N_DOMAIN),
140
+ 'id' => WPGFORM_PREFIX . 'sendto',
141
+ 'type' => 'medtext',
142
+ 'std' => '',
143
+ 'required' => false
144
+ ),
145
+ array(
146
+ 'name' => __('Form CSS', WPGFORM_I18N_DOMAIN),
147
+ 'desc' => __('Form specific CSS rules', WPGFORM_I18N_DOMAIN),
148
+ 'id' => WPGFORM_PREFIX . 'form_css',
149
+ 'type' => 'textarea',
150
+ 'std' => '',
151
+ 'required' => false
152
+ ),
153
+ )
154
+ ) ;
155
+
156
+ return $fieldsonly ? $content['fields'] : $content ;
157
+ }
158
+
159
+ /**
160
+ * Define the WordPress Google Form Secondary Meta Box fields so they
161
+ * can be used to construct the form as well as validate and save it.
162
+ *
163
+ */
164
+ function wpgform_secondary_meta_box_content($fieldsonly = false)
165
+ {
166
+ $content = array(
167
+ 'id' => 'wpgform-secondary-meta-box',
168
+ 'title' => 'Google Form Options',
169
+ 'page' => WPGFORM_CPT_FORM,
170
+ 'context' => 'side',
171
+ 'priority' => 'high',
172
+ 'fields' => array(
173
+ array(
174
+ 'name' => __('CAPTCHA', WPGFORM_I18N_DOMAIN),
175
+ 'desc' => __('CAPTCHA', WPGFORM_I18N_DOMAIN),
176
+ 'id' => WPGFORM_PREFIX . 'captcha',
177
+ 'type' => 'radio',
178
+ 'options' => array('On', 'Off'),
179
+ 'required' => false,
180
+ 'br' => false
181
+ ),
182
+ array(
183
+ 'name' => __('Columns', WPGFORM_I18N_DOMAIN),
184
+ 'desc' => __('Split form into columns', WPGFORM_I18N_DOMAIN),
185
  'id' => WPGFORM_PREFIX . 'columns',
186
  'type' => 'select',
187
  'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
189
  'required' => true
190
  ),
191
  array(
192
+ 'name' => __('Email End User', WPGFORM_I18N_DOMAIN),
193
+ 'desc' => __('Send email to end user upon form submission', WPGFORM_I18N_DOMAIN),
194
+ 'id' => WPGFORM_PREFIX . 'user_email',
195
+ 'type' => 'radio',
196
+ 'options' => array('On', 'Off'),
197
+ 'required' => false,
198
+ 'br' => false
199
+ ),
200
+ array(
201
+ 'name' => __('Legal', WPGFORM_I18N_DOMAIN),
202
+ 'desc' => __('Google Legal Disclaimer', WPGFORM_I18N_DOMAIN),
203
  'id' => WPGFORM_PREFIX . 'legal',
204
  'type' => 'radio',
205
  'options' => array('On', 'Off'),
207
  'br' => false
208
  ),
209
  array(
210
+ 'name' => __('Read Only', WPGFORM_I18N_DOMAIN),
211
+ 'desc' => __('Set the form Read Only', WPGFORM_I18N_DOMAIN),
212
  'id' => WPGFORM_PREFIX . 'readonly',
213
  'type' => 'radio',
214
  'options' => array('On', 'Off'),
216
  'br' => false
217
  ),
218
  array(
219
+ 'name' => __('BR', WPGFORM_I18N_DOMAIN),
220
+ 'desc' => __('Insert &lt;BR&gt; tags between labels and input box', WPGFORM_I18N_DOMAIN),
221
  'id' => WPGFORM_PREFIX . 'br',
222
  'type' => 'radio',
223
  'options' => array('On', 'Off'),
225
  'br' => false
226
  ),
227
  array(
228
+ 'name' => __('CSS Prefix', WPGFORM_I18N_DOMAIN),
229
+ 'desc' => __('Prefix to add to all Google CSS classes', WPGFORM_I18N_DOMAIN),
230
  'id' => WPGFORM_PREFIX . 'css_prefix',
231
+ 'type' => 'text',
232
  'std' => '',
233
  'required' => false
234
  ),
235
  array(
236
+ 'name' => __('CSS Suffix', WPGFORM_I18N_DOMAIN),
237
+ 'desc' => __('Suffix to add to all Google CSS classes', WPGFORM_I18N_DOMAIN),
238
  'id' => WPGFORM_PREFIX . 'css_suffix',
239
+ 'type' => 'text',
240
  'std' => '',
241
  'required' => false
242
  ),
243
  array(
244
+ 'name' => __('Title', WPGFORM_I18N_DOMAIN),
245
+ 'desc' => __('Show or Hide the Google Form\'s title', WPGFORM_I18N_DOMAIN),
246
  'id' => WPGFORM_PREFIX . 'title',
247
  'type' => 'radio',
248
  'options' => array('On', 'Off'),
250
  'br' => false
251
  ),
252
  array(
253
+ 'name' => __('Map H1 to H2', WPGFORM_I18N_DOMAIN),
254
+ 'desc' => __('Map H1 elements to H2 elements', WPGFORM_I18N_DOMAIN),
255
  'id' => WPGFORM_PREFIX . 'maph1h2',
256
  'type' => 'radio',
257
  'options' => array('On', 'Off'),
259
  'br' => false
260
  ),
261
  array(
262
+ 'name' => __('Unite Theme Hack', WPGFORM_I18N_DOMAIN),
263
+ 'desc' => __('Unite Theme Hack', WPGFORM_I18N_DOMAIN),
264
+ 'id' => WPGFORM_PREFIX . 'unitethemehack',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  'type' => 'radio',
266
  'options' => array('On', 'Off'),
267
  'required' => false,
268
  'br' => false
269
  ),
270
+ )
271
+ ) ;
272
+
273
+ return $fieldsonly ? $content['fields'] : $content ;
274
+ }
275
+
276
+ /**
277
+ * Define the WordPress Google Form Validation Meta Box fields so they
278
+ * can be used to construct the form as well as validate and save it.
279
+ *
280
+ */
281
+ function wpgform_validation_meta_box_content($fieldsonly = false)
282
+ {
283
+ $content = array(
284
+ 'id' => 'wpgform-validation-meta-box',
285
+ 'title' => 'Google Form Field Validation',
286
+ 'page' => WPGFORM_CPT_FORM,
287
+ 'context' => 'normal',
288
+ 'priority' => 'high',
289
+ 'fields' => array(
290
  array(
291
+ 'name' => __('Validation', WPGFORM_I18N_DOMAIN),
292
+ 'desc' => __('Enable default jQuery Validation on all required fields', WPGFORM_I18N_DOMAIN),
293
  'id' => WPGFORM_PREFIX . 'validation',
294
  'type' => 'radio',
295
  'options' => array('On', 'Off'),
297
  'br' => false
298
  ),
299
  array(
300
+ 'name' => __('Form Fields', WPGFORM_I18N_DOMAIN),
301
+ 'desc' => __('Name of the field on the Google Form (e.g. entry.1.single, entry.12345678, etc.) - <a href="http://jqueryvalidation.org/rules">Additional details on jQuery Rules</a>', WPGFORM_I18N_DOMAIN),
302
+ 'id' => WPGFORM_PREFIX . 'validation_field_name',
303
+ 'type' => 'validation',
304
+ 'std' => '',
305
+ 'required' => true,
306
+ 'type_id' => WPGFORM_PREFIX . 'validation_field_type',
307
+ 'value_id' => WPGFORM_PREFIX . 'validation_field_value',
308
+ 'options' => array(
309
+ 'required',
310
+ 'remote',
311
+ 'email',
312
+ 'url',
313
+ 'date',
314
+ 'dateISO',
315
+ 'number',
316
+ 'digits',
317
+ 'creditcard',
318
+ 'equalTo',
319
+ 'accept',
320
+ 'maxlength',
321
+ 'minlength',
322
+ 'rangelength',
323
+ 'range',
324
+ 'max',
325
+ 'min',
326
+ ),
327
  ),
328
  array(
329
+ 'name' => __('Type', WPGFORM_I18N_DOMAIN),
330
+ 'desc' => __('Type of validation', WPGFORM_I18N_DOMAIN),
331
+ 'id' => WPGFORM_PREFIX . 'validation_field_type',
332
+ 'type' => 'hidden',
333
+ 'std' => '',
334
+ 'required' => true
 
335
  ),
336
  array(
337
+ 'name' => __('Value', WPGFORM_I18N_DOMAIN),
338
+ 'desc' => __('Value to validate against', WPGFORM_I18N_DOMAIN),
339
+ 'id' => WPGFORM_PREFIX . 'validation_field_value',
340
+ 'type' => 'hidden',
341
  'std' => '',
342
  'required' => false
343
  ),
344
  )
345
  ) ;
346
+
347
+ return $fieldsonly ? $content['fields'] : $content ;
348
  }
349
 
350
+ add_action('admin_menu', 'wpgform_add_primary_meta_box') ;
351
  //add_action('admin_menu', 'wpgform_add_player_profile_meta_box') ;
352
 
353
  // Add form meta box
354
+ function wpgform_add_primary_meta_box()
355
  {
356
+ $mb = wpgform_primary_meta_box_content() ;
357
+
358
+ add_meta_box($mb['id'], $mb['title'],
359
+ 'wpgform_show_primary_meta_box', $mb['page'], $mb['context'], $mb['priority']);
360
+
361
+ $mb = wpgform_secondary_meta_box_content() ;
362
+
363
+ add_meta_box($mb['id'], $mb['title'],
364
+ 'wpgform_show_secondary_meta_box', $mb['page'], $mb['context'], $mb['priority']);
365
+
366
+ $mb = wpgform_validation_meta_box_content() ;
367
 
368
  add_meta_box($mb['id'], $mb['title'],
369
+ 'wpgform_show_validation_meta_box', $mb['page'], $mb['context'], $mb['priority']);
370
+ }
371
+
372
+ // Callback function to show fields in meta box
373
+ function wpgform_show_primary_meta_box()
374
+ {
375
+ $mb = wpgform_primary_meta_box_content() ;
376
+ wpgform_build_meta_box($mb) ;
377
  }
378
 
379
  // Callback function to show fields in meta box
380
+ function wpgform_show_secondary_meta_box()
381
+ {
382
+ $mb = wpgform_secondary_meta_box_content() ;
383
+ wpgform_build_meta_box($mb) ;
384
+ }
385
+
386
+ // Callback function to show validation in meta box
387
+ function wpgform_show_validation_meta_box()
388
  {
389
+ $mb = wpgform_validation_meta_box_content() ;
390
  wpgform_build_meta_box($mb) ;
391
  }
392
 
394
  * Build meta box form
395
  *
396
  * @see http://www.deluxeblogtips.com/2010/04/how-to-create-meta-box-wordpress-post.html
397
+ * @see http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-3-extra-fields/
398
+ * @see http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-4-using-the-data/
399
  *
400
  */
401
  function wpgform_build_meta_box($mb)
424
  case 'lgtext':
425
  echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />', '<br />', '<small>', $field['desc'], '</small>';
426
  break;
427
+
428
  case 'medtext':
429
  echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:47%" />', '<br />', '<small>', $field['desc'], '</small>';
430
  break;
431
+
432
  case 'smtext':
433
  echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:27%" />', '<br />', '<small>', $field['desc'], '</small>';
434
  break;
435
+
436
  case 'textarea':
437
  echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>', '<br />', '<small>', $field['desc'], '</small>';
438
  break;
439
+
440
  case 'select':
441
  echo '<select name="', $field['id'], '" id="', $field['id'], '">';
442
  foreach ($field['options'] as $option => $value) {
445
  echo '</select>';
446
  echo '<br />', '<small>', $field['desc'], '</small>';
447
  break;
448
+
449
  case 'radio':
450
  foreach ($field['options'] as $option => $value) {
451
  echo '<input type="radio" name="', $field['id'], '" value="', strtolower($value), '"', $meta == strtolower($value) ? ' checked="checked"' : '', ' />&nbsp;', $value, $field['br'] === true ? '<br />' : '&nbsp;&nbsp;';
452
  }
453
  echo '<br />', '<small>', $field['desc'], '</small>';
454
  break;
455
+
456
  case 'checkbox':
457
  echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
458
  break;
459
+
460
+ case 'validation':
461
+ $meta_field = get_post_meta($post->ID, $field['id'], true);
462
+ $meta_type = get_post_meta($post->ID, $field['type_id'], true);
463
+ $meta_value = get_post_meta($post->ID, $field['value_id'], true);
464
+
465
+ echo '<a class="repeatable-add button" href="#">+</a>
466
+ <ul id="'.$field['id'].'-repeatable" class="custom_repeatable">';
467
+
468
+ $i = 0;
469
+
470
+ if ($meta_field) {
471
+ foreach($meta_field as $key => $value) {
472
+ echo '<li>' ;
473
+
474
+ printf('<label for="%s">%s:&nbsp;</label>', $field['id'].'['.$i.']', __('Name', WPGFORM_I18N_DOMAIN)) ;
475
+ echo '<input type="text" name="'.$field['id'].'['.$i.']" id="'.$field['id'].'" value="'.$meta_field[$key].'" size="30" />' ;
476
+
477
+ printf('<label for="%s">&nbsp;%s:&nbsp;</label>', $field['type_id'].'['.$i.']', __('Check', WPGFORM_I18N_DOMAIN)) ;
478
+ echo '<select name="', $field['type_id'].'['.$i.']', '" id="', $field['type_id'], '">';
479
+ foreach ($field['options'] as $option) {
480
+ echo '<option ', $meta_type[$key] == $option ? 'selected="selected" ' : '', 'value="', $option, '">', $option . '&nbsp;&nbsp;', '</option>';
481
+ }
482
+ echo '</select>';
483
+
484
+ printf('<i><label for="%s">&nbsp;%s:&nbsp;</label></i>', $field['value_id'].'['.$i.']', __('Value', WPGFORM_I18N_DOMAIN)) ;
485
+ echo '<input type="text" name="'.$field['value_id'].'['.$i.']" id="'.$field['value_id'].'" value="'.$meta_value[$key].'" size="15" />' ;
486
+ echo '<a class="repeatable-remove button" href="#">-</a></li>';
487
+
488
+ $i++;
489
+ }
490
+ } else {
491
+ echo '<li>' ;
492
+ printf('<label for="%s">%s:&nbsp;</label>', $field['id'].'['.$i.']', __('Field', WPGFORM_I18N_DOMAIN)) ;
493
+ echo '<input type="text" name="'.$field['id'].'['.$i.']" id="'.$field['id'].'" value="" size="30" />' ;
494
+ printf('<label for="%s">&nbsp;%s:&nbsp;</label>', $field['type_id'].'['.$i.']', __('Check', WPGFORM_I18N_DOMAIN)) ;
495
+ echo '<select name="', $field['type_id'].'['.$i.']', '" id="', $field['type_id'], '">';
496
+ foreach ($field['options'] as $option) {
497
+ echo '<option value="', $option, '">', $option . '&nbsp;&nbsp;', '</option>';
498
+ }
499
+ echo '</select>';
500
+
501
+ printf('<i><label for="%s">&nbsp;%s:&nbsp;</label></i>', $field['value_id'].'['.$i.']', __('Value', WPGFORM_I18N_DOMAIN)) ;
502
+ echo '<input type="text" name="'.$field['value_id'].'['.$i.']" id="'.$field['value_id'].'" value="" size="15" />' ;
503
+ echo '<a class="repeatable-remove button" href="#">-</a></li>';
504
+ }
505
+ echo '</ul>
506
+ <small>'.$field['desc'].'</small>';
507
+ break;
508
+
509
  default :
510
  break ;
511
  }
517
  echo '</table>';
518
  }
519
 
 
520
  add_action( 'quick_edit_custom_box', 'wpgform_add_quick_edit_nonce', 10, 2 );
521
  //add_action( 'quick_edit_custom_box', function() { error_log(__LINE__) ; }, 10, 2 );
 
522
  /**
523
  * Action to add a nonce to the quick edit form for the custom post types
524
  *
525
  */
526
  function wpgform_add_quick_edit_nonce($column_name, $post_type)
527
  {
 
528
  //wpgform_whereami(__FILE__, __LINE__) ;
529
  static $printNonce = true ;
530
 
581
  // return if the post isn't a CPT which shouldn't happen
582
 
583
  if (get_post_type($post_id) == WPGFORM_CPT_FORM)
584
+ $fields = array_merge(wpgform_primary_meta_box_content(true),
585
+ wpgform_secondary_meta_box_content(true), wpgform_validation_meta_box_content(true)) ;
586
  else
587
  return $post_id ;
588
 
592
  // the Short URL field.
593
 
594
  //wpgform_preprint_r($_POST) ;
595
+ foreach ($fields as $field)
596
  {
597
  // Only update other Post Meta fields when on the edit screen - ignore in quick edit mode
598
 
619
  //wpgform_whereami(__FILE__, __LINE__);
620
  }
621
  }
622
+ else
623
+ {
624
+ delete_post_meta($post_id, $field['id']) ;
625
+ }
626
  }
627
  }
628
  }
700
 
701
  /**
702
  * Set up a footer hook to rearrange the post editing screen
703
+ * for the WPGFORM_CPT_FORM custom post type. The meta box which has all
704
  * of the custom fields in it will appear before the Visual Editor.
705
  * This is accomplished using a simple jQuery script once the
706
  * document is loaded.
713
 
714
  if (get_post_type($post) == WPGFORM_CPT_FORM)
715
  {
716
+ // wpGForm needs jQuery!
717
+ wp_enqueue_script('jquery') ;
718
+
719
+ // Load the WordPress Google Form jQuery Admin script from the plugin
720
+ wp_register_script('wpgform-post-type',
721
+ plugins_url(plugin_basename(dirname(__FILE__) . '/js/wpgform-post-type.js')),
722
+ array('jquery'), false, true) ;
723
+ wp_enqueue_script('wpgform-post-type') ;
724
+ return;
725
+
726
  ?>
727
  <script type="text/javascript">
728
  jQuery(document).ready(function($) {
735
  }
736
 
737
  /** Hook into the Admin Footer */
738
+ add_action('admin_footer','wpgform_admin_footer_hook');
739
 
740
  /** Filter to change the Title field for the Player post type */
741
  add_filter('enter_title_here', 'wpgform_enter_title_here_filter') ;
750
  return $title ;
751
  }
752
 
 
 
 
 
 
 
 
 
753
  /**
754
  * wpgform_admin_css()
755
  *