Contact Form 7 - Version 3.8

Version Description

  • Introduced data option for select, checkbox and radio form-tags. With Listo plugin, you can make a menu with hundreds of options.
  • Accessibility improvement: add an invisible response message block before <form>.
  • Added relative date notation support in min and max options of date form-tags.
  • Added html_name attribute support in [contact-form-7] shortcodes.
  • WordPress 3.7 or higher is required.
  • Translation for Ukrainian has been updated.
Download this release

Release Info

Developer takayukister
Plugin Icon 128x128 Contact Form 7
Version 3.8
Comparing to
See all releases

Code changes from version 3.7.2 to 3.8

includes/classes.php CHANGED
@@ -205,11 +205,14 @@ class WPCF7_ContactForm {
205
public function form_html( $atts = array() ) {
206
$atts = wp_parse_args( $atts, array(
207
'html_id' => '',
208
'html_class' => '' ) );
209
210
$this->unit_tag = self::get_unit_tag( $this->id );
211
212
- $form = '<div class="wpcf7" id="' . $this->unit_tag . '">';
213
214
$url = wpcf7_get_request_uri();
215
@@ -223,6 +226,9 @@ class WPCF7_ContactForm {
223
$id_attr = apply_filters( 'wpcf7_form_id_attr',
224
preg_replace( '/[^A-Za-z0-9:._-]/', '', $atts['html_id'] ) );
225
226
$class = 'wpcf7-form';
227
228
$result = self::get_submission_status( $this->id );
@@ -238,37 +244,42 @@ class WPCF7_ContactForm {
238
$class .= ' failed';
239
}
240
241
- $atts['html_class'] = array_unique( array_map( 'sanitize_html_class',
242
- explode( ' ', $atts['html_class'] ) ) );
243
-
244
if ( $atts['html_class'] ) {
245
- $class .= ' ' . implode( ' ', $atts['html_class'] );
246
}
247
248
- $class = apply_filters( 'wpcf7_form_class_attr', trim( $class ) );
249
250
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
251
252
$novalidate = apply_filters( 'wpcf7_form_novalidate',
253
wpcf7_support_html5() ? ' novalidate="novalidate"' : '' );
254
255
- $form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
256
. ( $id_attr ? ' id="' . esc_attr( $id_attr ) . '"' : '' )
257
. ' class="' . esc_attr( $class ) . '"'
258
. $enctype . $novalidate . '>' . "\n";
259
260
- $form .= $this->form_hidden_fields();
261
-
262
- $form .= $this->form_elements();
263
264
if ( ! $this->responses_count )
265
- $form .= $this->form_response_output();
266
-
267
- $form .= '</form>';
268
269
- $form .= '</div>';
270
271
- return $form;
272
}
273
274
public function form_hidden_fields() {
@@ -332,6 +343,52 @@ class WPCF7_ContactForm {
332
$output, $class, $content, $this );
333
}
334
335
public function validation_error( $name ) {
336
if ( ! $this->is_posted() )
337
return '';
@@ -445,11 +502,11 @@ class WPCF7_ContactForm {
445
$new_value = array();
446
447
foreach ( $value as $v )
448
- $new_value[] = $pipes->do_pipe( stripslashes( $v ) );
449
450
$value = $new_value;
451
} else {
452
- $value = $pipes->do_pipe( stripslashes( $value ) );
453
}
454
}
455
@@ -466,6 +523,7 @@ class WPCF7_ContactForm {
466
'status' => 'init',
467
'valid' => true,
468
'invalid_reasons' => array(),
469
'spam' => false,
470
'message' => '',
471
'mail_sent' => false,
@@ -480,6 +538,7 @@ class WPCF7_ContactForm {
480
$result['status'] = 'validation_failed';
481
$result['valid'] = false;
482
$result['invalid_reasons'] = $validation['reason'];
483
$result['message'] = $this->message( 'validation_error' );
484
485
} elseif ( ! $this->accepted() ) { // Not accepted terms
@@ -543,7 +602,10 @@ class WPCF7_ContactForm {
543
public function validate() {
544
$fes = $this->form_scan_shortcode();
545
546
- $result = array( 'valid' => true, 'reason' => array() );
547
548
foreach ( $fes as $fe ) {
549
$result = apply_filters( 'wpcf7_validate_' . $fe['type'], $result, $fe );
@@ -749,7 +811,7 @@ class WPCF7_ContactForm {
749
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced,
750
$submitted, $html );
751
752
- return stripslashes( $replaced );
753
}
754
755
$special = apply_filters( 'wpcf7_special_mail_tags', '', $tagname, $html );
205
public function form_html( $atts = array() ) {
206
$atts = wp_parse_args( $atts, array(
207
'html_id' => '',
208
+ 'html_name' => '',
209
'html_class' => '' ) );
210
211
$this->unit_tag = self::get_unit_tag( $this->id );
212
213
+ $html = '<div class="wpcf7" id="' . $this->unit_tag . '">' . "\n";
214
+
215
+ $html .= $this->screen_reader_response() . "\n";
216
217
$url = wpcf7_get_request_uri();
218
226
$id_attr = apply_filters( 'wpcf7_form_id_attr',
227
preg_replace( '/[^A-Za-z0-9:._-]/', '', $atts['html_id'] ) );
228
229
+ $name_attr = apply_filters( 'wpcf7_form_name_attr',
230
+ preg_replace( '/[^A-Za-z0-9:._-]/', '', $atts['html_name'] ) );
231
+
232
$class = 'wpcf7-form';
233
234
$result = self::get_submission_status( $this->id );
244
$class .= ' failed';
245
}
246
247
if ( $atts['html_class'] ) {
248
+ $class .= ' ' . $atts['html_class'];
249
+ }
250
+
251
+ if ( $this->in_demo_mode() ) {
252
+ $class .= ' demo';
253
}
254
255
+ $class = explode( ' ', $class );
256
+ $class = array_map( 'sanitize_html_class', $class );
257
+ $class = array_filter( $class );
258
+ $class = array_unique( $class );
259
+ $class = implode( ' ', $class );
260
+ $class = apply_filters( 'wpcf7_form_class_attr', $class );
261
262
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
263
264
$novalidate = apply_filters( 'wpcf7_form_novalidate',
265
wpcf7_support_html5() ? ' novalidate="novalidate"' : '' );
266
267
+ $html .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
268
. ( $id_attr ? ' id="' . esc_attr( $id_attr ) . '"' : '' )
269
+ . ( $name_attr ? ' name="' . esc_attr( $name_attr ) . '"' : '' )
270
. ' class="' . esc_attr( $class ) . '"'
271
. $enctype . $novalidate . '>' . "\n";
272
273
+ $html .= $this->form_hidden_fields();
274
+ $html .= $this->form_elements();
275
276
if ( ! $this->responses_count )
277
+ $html .= $this->form_response_output();
278
279
+ $html .= '</form>';
280
+ $html .= '</div>';
281
282
+ return $html;
283
}
284
285
public function form_hidden_fields() {
343
$output, $class, $content, $this );
344
}
345
346
+ public function screen_reader_response() {
347
+ $class = 'screen-reader-response';
348
+ $role = '';
349
+ $content = '';
350
+
351
+ if ( $this->is_posted() ) { // Post response output for non-AJAX
352
+ $role = 'alert';
353
+ $result = self::get_submission_status( $this->id );
354
+
355
+ if ( ! empty( $result['message'] ) ) {
356
+ $content = esc_html( $result['message'] );
357
+
358
+ if ( ! empty( $result['invalid_reasons'] ) ) {
359
+ $content .= "\n" . '<ul>' . "\n";
360
+
361
+ foreach ( (array) $result['invalid_reasons'] as $k => $v ) {
362
+ if ( isset( $result['invalid_fields'][$k] )
363
+ && wpcf7_is_name( $result['invalid_fields'][$k] ) ) {
364
+ $link = sprintf( '<a href="#%1$s">%2$s</a>',
365
+ $result['invalid_fields'][$k],
366
+ esc_html( $v ) );
367
+ $content .= sprintf( '<li>%s</li>', $link );
368
+ } else {
369
+ $content .= sprintf( '<li>%s</li>', esc_html( $v ) );
370
+ }
371
+
372
+ $content .= "\n";
373
+ }
374
+
375
+ $content .= '</ul>' . "\n";
376
+ }
377
+ }
378
+ }
379
+
380
+ $atts = array(
381
+ 'class' => trim( $class ),
382
+ 'role' => trim( $role ) );
383
+
384
+ $atts = wpcf7_format_atts( $atts );
385
+
386
+ $output = sprintf( '<div %1$s>%2$s</div>',
387
+ $atts, $content );
388
+
389
+ return $output;
390
+ }
391
+
392
public function validation_error( $name ) {
393
if ( ! $this->is_posted() )
394
return '';
502
$new_value = array();
503
504
foreach ( $value as $v )
505
+ $new_value[] = $pipes->do_pipe( wp_unslash( $v ) );
506
507
$value = $new_value;
508
} else {
509
+ $value = $pipes->do_pipe( wp_unslash( $value ) );
510
}
511
}
512
523
'status' => 'init',
524
'valid' => true,
525
'invalid_reasons' => array(),
526
+ 'invalid_fields' => array(),
527
'spam' => false,
528
'message' => '',
529
'mail_sent' => false,
538
$result['status'] = 'validation_failed';
539
$result['valid'] = false;
540
$result['invalid_reasons'] = $validation['reason'];
541
+ $result['invalid_fields'] = $validation['idref'];
542
$result['message'] = $this->message( 'validation_error' );
543
544
} elseif ( ! $this->accepted() ) { // Not accepted terms
602
public function validate() {
603
$fes = $this->form_scan_shortcode();
604
605
+ $result = array(
606
+ 'valid' => true,
607
+ 'reason' => array(),
608
+ 'idref' => array() );
609
610
foreach ( $fes as $fe ) {
611
$result = apply_filters( 'wpcf7_validate_' . $fe['type'], $result, $fe );
811
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced,
812
$submitted, $html );
813
814
+ return wp_unslash( $replaced );
815
}
816
817
$special = apply_filters( 'wpcf7_special_mail_tags', '', $tagname, $html );
includes/controller.php CHANGED
@@ -65,9 +65,17 @@ function wpcf7_ajax_json_echo() {
65
$invalids = array();
66
67
foreach ( $result['invalid_reasons'] as $name => $reason ) {
68
- $invalids[] = array(
69
- 'into' => 'span.wpcf7-form-control-wrap.' . $name,
70
'message' => $reason );
71
}
72
73
$items['invalids'] = $invalids;
@@ -150,6 +158,7 @@ function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) {
150
'id' => 0,
151
'title' => '',
152
'html_id' => '',
153
'html_class' => '' ), $atts );
154
155
$id = (int) $atts['id'];
65
$invalids = array();
66
67
foreach ( $result['invalid_reasons'] as $name => $reason ) {
68
+ $invalid = array(
69
+ 'into' => 'span.wpcf7-form-control-wrap.'
70
+ . sanitize_html_class( $name ),
71
'message' => $reason );
72
+
73
+ if ( isset( $result['invalid_fields'][$name] )
74
+ && wpcf7_is_name( $result['invalid_fields'][$name] ) ) {
75
+ $invalid['idref'] = $result['invalid_fields'][$name];
76
+ }
77
+
78
+ $invalids[] = $invalid;
79
}
80
81
$items['invalids'] = $invalids;
158
'id' => 0,
159
'title' => '',
160
'html_id' => '',
161
+ 'html_name' => '',
162
'html_class' => '' ), $atts );
163
164
$id = (int) $atts['id'];
includes/css/styles.css CHANGED
@@ -8,6 +8,17 @@ div.wpcf7-response-output {
8
padding: 0.2em 1em;
9
}
10
11
div.wpcf7-mail-sent-ok {
12
border: 2px solid #398f14;
13
}
8
padding: 0.2em 1em;
9
}
10
11
+ div.wpcf7 .screen-reader-response {
12
+ position: absolute;
13
+ overflow: hidden;
14
+ clip: rect(1px, 1px, 1px, 1px);
15
+ height: 1px;
16
+ width: 1px;
17
+ margin: 0;
18
+ padding: 0;
19
+ border: 0;
20
+ }
21
+
22
div.wpcf7-mail-sent-ok {
23
border: 2px solid #398f14;
24
}
includes/functions.php CHANGED
@@ -369,7 +369,7 @@ function wpcf7_load_modules() {
369
'acceptance', 'flamingo', 'special-mail-tags',
370
'akismet', 'jetpack', 'submit', 'captcha', 'number',
371
'text', 'checkbox', 'quiz', 'textarea', 'date',
372
- 'response', 'file', 'select' );
373
374
foreach ( $mods as $mod ) {
375
$file = trailingslashit( $dir ) . $mod . '.php';
369
'acceptance', 'flamingo', 'special-mail-tags',
370
'akismet', 'jetpack', 'submit', 'captcha', 'number',
371
'text', 'checkbox', 'quiz', 'textarea', 'date',
372
+ 'response', 'file', 'select', 'listo' );
373
374
foreach ( $mods as $mod ) {
375
$file = trailingslashit( $dir ) . $mod . '.php';
includes/js/scripts.js CHANGED
@@ -128,7 +128,7 @@
128
$(data.into).trigger('submit.wpcf7');
129
130
if (1 == data.mailSent)
131
- $form.resetForm().clearForm();
132
133
$form.find('[placeholder].placeheld').each(function(i, n) {
134
$(n).val($(n).attr('placeholder'));
@@ -136,6 +136,8 @@
136
137
$responseOutput.append(data.message).slideDown('fast');
138
$responseOutput.attr('role', 'alert');
139
}
140
141
$.fn.wpcf7ExclusiveCheckbox = function() {
@@ -306,6 +308,33 @@
306
});
307
};
308
309
$.wpcf7SupportHtml5 = function() {
310
var features = {};
311
var input = document.createElement('input');
128
$(data.into).trigger('submit.wpcf7');
129
130
if (1 == data.mailSent)
131
+ $form.resetForm();
132
133
$form.find('[placeholder].placeheld').each(function(i, n) {
134
$(n).val($(n).attr('placeholder'));
136
137
$responseOutput.append(data.message).slideDown('fast');
138
$responseOutput.attr('role', 'alert');
139
+
140
+ $.wpcf7UpdateScreenReaderResponse($form, data);
141
}
142
143
$.fn.wpcf7ExclusiveCheckbox = function() {
308
});
309
};
310
311
+ $.wpcf7UpdateScreenReaderResponse = function($form, data) {
312
+ $('.wpcf7 .screen-reader-response').html('').attr('role', '');
313
+
314
+ if (data.message) {
315
+ var $response = $form.siblings('.screen-reader-response').first();
316
+ $response.append(data.message);
317
+
318
+ if (data.invalids) {
319
+ var $invalids = $('<ul></ul>');
320
+
321
+ $.each(data.invalids, function(i, n) {
322
+ if (n.idref) {
323
+ var $li = $('<li></li>').append($('<a></a>').attr('href', '#' + n.idref).append(n.message));
324
+ } else {
325
+ var $li = $('<li></li>').append(n.message);
326
+ }
327
+
328
+ $invalids.append($li);
329
+ });
330
+
331
+ $response.append($invalids);
332
+ }
333
+
334
+ $response.attr('role', 'alert').focus();
335
+ }
336
+ }
337
+
338
$.wpcf7SupportHtml5 = function() {
339
var features = {};
340
var input = document.createElement('input');
includes/shortcodes.php CHANGED
@@ -241,7 +241,7 @@ class WPCF7_Shortcode {
241
242
public function get_option( $opt, $pattern = '', $single = false ) {
243
$preset_patterns = array(
244
- 'date' => '[0-9]{4}-[0-9]{2}-[0-9]{2}',
245
'int' => '[0-9]+',
246
'signed_int' => '-?[0-9]+',
247
'class' => '[-0-9a-zA-Z_]+',
@@ -277,6 +277,10 @@ class WPCF7_Shortcode {
277
}
278
}
279
280
public function get_class_option( $default = '' ) {
281
if ( is_string( $default ) )
282
$default = explode( ' ', $default );
@@ -337,6 +341,29 @@ class WPCF7_Shortcode {
337
return $default;
338
}
339
340
public function get_default_option() {
341
$options = (array) $this->get_option( 'default' );
342
@@ -363,6 +390,12 @@ class WPCF7_Shortcode {
363
return false;
364
}
365
366
public function get_first_match_option( $pattern ) {
367
foreach( (array) $this->options as $option ) {
368
if ( preg_match( $pattern, $option, $matches ) )
241
242
public function get_option( $opt, $pattern = '', $single = false ) {
243
$preset_patterns = array(
244
+ 'date' => '([0-9]{4}-[0-9]{2}-[0-9]{2}|today(.*))',
245
'int' => '[0-9]+',
246
'signed_int' => '-?[0-9]+',
247
'class' => '[-0-9a-zA-Z_]+',
277
}
278
}
279
280
+ public function get_id_option() {
281
+ return $this->get_option( 'id', 'id', true );
282
+ }
283
+
284
public function get_class_option( $default = '' ) {
285
if ( is_string( $default ) )
286
$default = explode( ' ', $default );
341
return $default;
342
}
343
344
+ public function get_date_option( $opt ) {
345
+ $option = $this->get_option( $opt, 'date', true );
346
+
347
+ if ( preg_match( '/^[0-9]{4}-[0-9]{2}-[0-9]{2}#x2F;', $option ) ) {
348
+ return $option;
349
+ }
350
+
351
+ if ( preg_match( '/^today(?:([+-][0-9]+)([a-z]*))?/', $option, $matches ) ) {
352
+ $number = isset( $matches[1] ) ? (int) $matches[1] : 0;
353
+ $unit = isset( $matches[2] ) ? $matches[2] : '';
354
+
355
+ if ( ! preg_match( '/^(day|month|year|week)s?#x2F;', $unit ) ) {
356
+ $unit = 'days';
357
+ }
358
+
359
+ $date = gmdate( 'Y-m-d',
360
+ strtotime( sprintf( 'today %1$s %2$s', $number, $unit ) ) );
361
+ return $date;
362
+ }
363
+
364
+ return false;
365
+ }
366
+
367
public function get_default_option() {
368
$options = (array) $this->get_option( 'default' );
369
390
return false;
391
}
392
393
+ public function get_data_option( $args = '' ) {
394
+ $options = (array) $this->get_option( 'data' );
395
+
396
+ return apply_filters( 'wpcf7_form_tag_data_option', null, $options, $args );
397
+ }
398
+
399
public function get_first_match_option( $pattern ) {
400
foreach( (array) $this->options as $option ) {
401
if ( preg_match( $pattern, $option, $matches ) )
languages/contact-form-7-uk.mo CHANGED
Binary file
modules/acceptance.php CHANGED
@@ -31,7 +31,7 @@ function wpcf7_acceptance_shortcode_handler( $tag ) {
31
$atts = array();
32
33
$atts['class'] = $tag->get_class_option( $class );
34
- $atts['id'] = $tag->get_option( 'id', 'id', true );
35
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
36
37
if ( $tag->has_option( 'default:on' ) )
@@ -47,7 +47,7 @@ function wpcf7_acceptance_shortcode_handler( $tag ) {
47
48
$html = sprintf(
49
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
50
- $tag->name, $atts, $validation_error );
51
52
return $html;
53
}
@@ -73,6 +73,10 @@ function wpcf7_acceptance_validation_filter( $result, $tag ) {
73
$result['reason'][$name] = wpcf7_get_message( 'accept_terms' );
74
}
75
76
return $result;
77
}
78
31
$atts = array();
32
33
$atts['class'] = $tag->get_class_option( $class );
34
+ $atts['id'] = $tag->get_id_option();
35
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
36
37
if ( $tag->has_option( 'default:on' ) )
47
48
$html = sprintf(
49
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
50
+ sanitize_html_class( $tag->name ), $atts, $validation_error );
51
52
return $html;
53
}
73
$result['reason'][$name] = wpcf7_get_message( 'accept_terms' );
74
}
75
76
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
77
+ $result['idref'][$name] = $id;
78
+ }
79
+
80
return $result;
81
}
82
modules/akismet.php CHANGED
@@ -108,7 +108,7 @@ function wpcf7_akismet_comment_check( $comment ) {
108
$query_string = '';
109
110
foreach ( $comment as $key => $data )
111
- $query_string .= $key . '=' . urlencode( stripslashes( (string) $data ) ) . '&';
112
113
$response = akismet_http_post( $query_string,
114
$akismet_api_host, '/1.1/comment-check', $akismet_api_port );
108
$query_string = '';
109
110
foreach ( $comment as $key => $data )
111
+ $query_string .= $key . '=' . urlencode( wp_unslash( (string) $data ) ) . '&';
112
113
$response = akismet_http_post( $query_string,
114
$akismet_api_host, '/1.1/comment-check', $akismet_api_port );
modules/captcha.php CHANGED
@@ -31,7 +31,7 @@ function wpcf7_captcha_shortcode_handler( $tag ) {
31
$atts = array();
32
33
$atts['class'] = $tag->get_class_option( $class );
34
- $atts['id'] = $tag->get_option( 'id', 'id', true );
35
36
$op = array( // Default
37
'img_size' => array( 72, 24 ),
@@ -74,7 +74,7 @@ function wpcf7_captcha_shortcode_handler( $tag ) {
74
$atts['size'] = $tag->get_size_option( '40' );
75
$atts['maxlength'] = $tag->get_maxlength_option();
76
$atts['class'] = $tag->get_class_option( $class );
77
- $atts['id'] = $tag->get_option( 'id', 'id', true );
78
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
79
80
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
@@ -97,7 +97,7 @@ function wpcf7_captcha_shortcode_handler( $tag ) {
97
98
$html = sprintf(
99
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
100
- $tag->name, $atts, $validation_error );
101
102
return $html;
103
}
@@ -124,6 +124,10 @@ function wpcf7_captcha_validation_filter( $result, $tag ) {
124
$result['reason'][$name] = wpcf7_get_message( 'captcha_not_match' );
125
}
126
127
if ( 0 != strlen( $prefix ) ) {
128
wpcf7_remove_captcha( $prefix );
129
}
31
$atts = array();
32
33
$atts['class'] = $tag->get_class_option( $class );
34
+ $atts['id'] = $tag->get_id_option();
35
36
$op = array( // Default
37
'img_size' => array( 72, 24 ),
74
$atts['size'] = $tag->get_size_option( '40' );
75
$atts['maxlength'] = $tag->get_maxlength_option();
76
$atts['class'] = $tag->get_class_option( $class );
77
+ $atts['id'] = $tag->get_id_option();
78
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
79
80
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
97
98
$html = sprintf(
99
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
100
+ sanitize_html_class( $tag->name ), $atts, $validation_error );
101
102
return $html;
103
}
124
$result['reason'][$name] = wpcf7_get_message( 'captcha_not_match' );
125
}
126
127
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
128
+ $result['idref'][$name] = $id;
129
+ }
130
+
131
if ( 0 != strlen( $prefix ) ) {
132
wpcf7_remove_captcha( $prefix );
133
}
modules/checkbox.php CHANGED
@@ -42,7 +42,7 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
42
$atts = array();
43
44
$atts['class'] = $tag->get_class_option( $class );
45
- $atts['id'] = $tag->get_option( 'id', 'id', true );
46
47
$tabindex = $tag->get_option( 'tabindex', 'int', true );
48
@@ -64,7 +64,26 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
64
$html = '';
65
$count = 0;
66
67
- foreach ( (array) $tag->values as $key => $value ) {
68
$class = 'wpcf7-list-item';
69
70
$checked = false;
@@ -79,8 +98,8 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
79
$checked = true;
80
}
81
82
- if ( isset( $tag->labels[$key] ) )
83
- $label = $tag->labels[$key];
84
else
85
$label = $value;
86
@@ -115,7 +134,7 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
115
$class .= ' first';
116
}
117
118
- if ( count( $tag->values ) == $count ) { // last round
119
$class .= ' last';
120
121
if ( $free_text ) {
@@ -128,7 +147,7 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
128
'tabindex' => $tabindex ? $tabindex : '' );
129
130
if ( wpcf7_is_posted() && isset( $_POST[$free_text_name] ) ) {
131
- $free_text_atts['value'] = stripslashes_deep(
132
$_POST[$free_text_name] );
133
}
134
@@ -148,7 +167,7 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
148
149
$html = sprintf(
150
'<span class="wpcf7-form-control-wrap %1$s"><span %2$s>%3$s</span>%4$s</span>',
151
- $tag->name, $atts, $html, $validation_error );
152
153
return $html;
154
}
@@ -175,6 +194,10 @@ function wpcf7_checkbox_validation_filter( $result, $tag ) {
175
}
176
}
177
178
return $result;
179
}
180
42
$atts = array();
43
44
$atts['class'] = $tag->get_class_option( $class );
45
+ $atts['id'] = $tag->get_id_option();
46
47
$tabindex = $tag->get_option( 'tabindex', 'int', true );
48
64
$html = '';
65
$count = 0;
66
67
+ $values = (array) $tag->values;
68
+ $labels = (array) $tag->labels;
69
+
70
+ if ( $data = (array) $tag->get_data_option() ) {
71
+ if ( $free_text ) {
72
+ $values = array_merge(
73
+ array_slice( $values, 0, -1 ),
74
+ array_values( $data ),
75
+ array_slice( $values, -1 ) );
76
+ $labels = array_merge(
77
+ array_slice( $labels, 0, -1 ),
78
+ array_values( $data ),
79
+ array_slice( $labels, -1 ) );
80
+ } else {
81
+ $values = array_merge( $values, array_values( $data ) );
82
+ $labels = array_merge( $labels, array_values( $data ) );
83
+ }
84
+ }
85
+
86
+ foreach ( $values as $key => $value ) {
87
$class = 'wpcf7-list-item';
88
89
$checked = false;
98
$checked = true;
99
}
100
101
+ if ( isset( $labels[$key] ) )
102
+ $label = $labels[$key];
103
else
104
$label = $value;
105
134
$class .= ' first';
135
}
136
137
+ if ( count( $values ) == $count ) { // last round
138
$class .= ' last';
139
140
if ( $free_text ) {
147
'tabindex' => $tabindex ? $tabindex : '' );
148
149
if ( wpcf7_is_posted() && isset( $_POST[$free_text_name] ) ) {
150
+ $free_text_atts['value'] = wp_unslash(
151
$_POST[$free_text_name] );
152
}
153
167
168
$html = sprintf(
169
'<span class="wpcf7-form-control-wrap %1$s"><span %2$s>%3$s</span>%4$s</span>',
170
+ sanitize_html_class( $tag->name ), $atts, $html, $validation_error );
171
172
return $html;
173
}
194
}
195
}
196
197
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
198
+ $result['idref'][$name] = $id;
199
+ }
200
+
201
return $result;
202
}
203
modules/date.php CHANGED
@@ -31,10 +31,10 @@ function wpcf7_date_shortcode_handler( $tag ) {
31
$atts = array();
32
33
$atts['class'] = $tag->get_class_option( $class );
34
- $atts['id'] = $tag->get_option( 'id', 'id', true );
35
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
36
- $atts['min'] = $tag->get_option( 'min', 'date', true );
37
- $atts['max'] = $tag->get_option( 'max', 'date', true );
38
$atts['step'] = $tag->get_option( 'step', 'int', true );
39
40
if ( $tag->has_option( 'readonly' ) )
@@ -53,7 +53,7 @@ function wpcf7_date_shortcode_handler( $tag ) {
53
}
54
55
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
56
- $value = stripslashes_deep( $_POST[$tag->name] );
57
58
$atts['value'] = $value;
59
@@ -69,7 +69,7 @@ function wpcf7_date_shortcode_handler( $tag ) {
69
70
$html = sprintf(
71
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
72
- $tag->name, $atts, $validation_error );
73
74
return $html;
75
}
@@ -85,8 +85,8 @@ function wpcf7_date_validation_filter( $result, $tag ) {
85
86
$name = $tag->name;
87
88
- $min = $tag->get_option( 'min', 'date', true );
89
- $max = $tag->get_option( 'max', 'date', true );
90
91
$value = isset( $_POST[$name] )
92
? trim( strtr( (string) $_POST[$name], "\n", " " ) )
@@ -106,6 +106,10 @@ function wpcf7_date_validation_filter( $result, $tag ) {
106
$result['reason'][$name] = wpcf7_get_message( 'date_too_late' );
107
}
108
109
return $result;
110
}
111
31
$atts = array();
32
33
$atts['class'] = $tag->get_class_option( $class );
34
+ $atts['id'] = $tag->get_id_option();
35
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
36
+ $atts['min'] = $tag->get_date_option( 'min' );
37
+ $atts['max'] = $tag->get_date_option( 'max' );
38
$atts['step'] = $tag->get_option( 'step', 'int', true );
39
40
if ( $tag->has_option( 'readonly' ) )
53
}
54
55
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
56
+ $value = wp_unslash( $_POST[$tag->name] );
57
58
$atts['value'] = $value;
59
69
70
$html = sprintf(
71
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
72
+ sanitize_html_class( $tag->name ), $atts, $validation_error );
73
74
return $html;
75
}
85
86
$name = $tag->name;
87
88
+ $min = $tag->get_date_option( 'min' );
89
+ $max = $tag->get_date_option( 'max' );
90
91
$value = isset( $_POST[$name] )
92
? trim( strtr( (string) $_POST[$name], "\n", " " ) )
106
$result['reason'][$name] = wpcf7_get_message( 'date_too_late' );
107
}
108
109
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
110
+ $result['idref'][$name] = $id;
111
+ }
112
+
113
return $result;
114
}
115
modules/file.php CHANGED
@@ -29,7 +29,7 @@ function wpcf7_file_shortcode_handler( $tag ) {
29
30
$atts['size'] = $tag->get_size_option( '40' );
31
$atts['class'] = $tag->get_class_option( $class );
32
- $atts['id'] = $tag->get_option( 'id', 'id', true );
33
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
34
35
if ( $tag->is_required() )
@@ -45,7 +45,7 @@ function wpcf7_file_shortcode_handler( $tag ) {
45
46
$html = sprintf(
47
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
48
- $tag->name, $atts, $validation_error );
49
50
return $html;
51
}
@@ -74,18 +74,21 @@ function wpcf7_file_validation_filter( $result, $tag ) {
74
$tag = new WPCF7_Shortcode( $tag );
75
76
$name = $tag->name;
77
78
$file = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
79
80
if ( $file['error'] && UPLOAD_ERR_NO_FILE != $file['error'] ) {
81
$result['valid'] = false;
82
$result['reason'][$name] = wpcf7_get_message( 'upload_failed_php_error' );
83
return $result;
84
}
85
86
if ( empty( $file['tmp_name'] ) && $tag->is_required() ) {
87
$result['valid'] = false;
88
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
89
return $result;
90
}
91
@@ -146,6 +149,7 @@ function wpcf7_file_validation_filter( $result, $tag ) {
146
if ( ! preg_match( $file_type_pattern, $file['name'] ) ) {
147
$result['valid'] = false;
148
$result['reason'][$name] = wpcf7_get_message( 'upload_file_type_invalid' );
149
return $result;
150
}
151
@@ -154,6 +158,7 @@ function wpcf7_file_validation_filter( $result, $tag ) {
154
if ( $file['size'] > $allowed_size ) {
155
$result['valid'] = false;
156
$result['reason'][$name] = wpcf7_get_message( 'upload_file_too_large' );
157
return $result;
158
}
159
@@ -169,6 +174,7 @@ function wpcf7_file_validation_filter( $result, $tag ) {
169
if ( false === @move_uploaded_file( $file['tmp_name'], $new_file ) ) {
170
$result['valid'] = false;
171
$result['reason'][$name] = wpcf7_get_message( 'upload_failed' );
172
return $result;
173
}
174
29
30
$atts['size'] = $tag->get_size_option( '40' );
31
$atts['class'] = $tag->get_class_option( $class );
32
+ $atts['id'] = $tag->get_id_option();
33
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
34
35
if ( $tag->is_required() )
45
46
$html = sprintf(
47
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
48
+ sanitize_html_class( $tag->name ), $atts, $validation_error );
49
50
return $html;
51
}
74
$tag = new WPCF7_Shortcode( $tag );
75
76
$name = $tag->name;
77
+ $id = $tag->get_id_option();
78
79
$file = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
80
81
if ( $file['error'] && UPLOAD_ERR_NO_FILE != $file['error'] ) {
82
$result['valid'] = false;
83
$result['reason'][$name] = wpcf7_get_message( 'upload_failed_php_error' );
84
+ $result['idref'][$name] = $id ? $id : null;
85
return $result;
86
}
87
88
if ( empty( $file['tmp_name'] ) && $tag->is_required() ) {
89
$result['valid'] = false;
90
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
91
+ $result['idref'][$name] = $id ? $id : null;
92
return $result;
93
}
94
149
if ( ! preg_match( $file_type_pattern, $file['name'] ) ) {
150
$result['valid'] = false;
151
$result['reason'][$name] = wpcf7_get_message( 'upload_file_type_invalid' );
152
+ $result['idref'][$name] = $id ? $id : null;
153
return $result;
154
}
155
158
if ( $file['size'] > $allowed_size ) {
159
$result['valid'] = false;
160
$result['reason'][$name] = wpcf7_get_message( 'upload_file_too_large' );
161
+ $result['idref'][$name] = $id ? $id : null;
162
return $result;
163
}
164
174
if ( false === @move_uploaded_file( $file['tmp_name'], $new_file ) ) {
175
$result['valid'] = false;
176
$result['reason'][$name] = wpcf7_get_message( 'upload_failed' );
177
+ $result['idref'][$name] = $id ? $id : null;
178
return $result;
179
}
180
modules/listo.php ADDED
@@ -0,0 +1,32 @@
1
+ <?php
2
+ /**
3
+ ** Retrieve list data from the Listo plugin.
4
+ ** Listo http://wordpress.org/plugins/listo/
5
+ **/
6
+
7
+ add_filter( 'wpcf7_form_tag_data_option', 'wpcf7_listo', 10, 3 );
8
+
9
+ function wpcf7_listo( $data, $options, $args ) {
10
+ if ( ! function_exists( 'listo' ) ) {
11
+ return $data;
12
+ }
13
+
14
+ $args = wp_parse_args( $args, array() );
15
+
16
+ $contact_form = wpcf7_get_current_contact_form();
17
+ $args['locale'] = $contact_form->locale;
18
+
19
+ foreach ( (array) $options as $option ) {
20
+ $option = explode( '.', $option );
21
+ $type = $option[0];
22
+ $args['group'] = isset( $option[1] ) ? $option[1] : null;
23
+
24
+ if ( $list = listo( $type, $args ) ) {
25
+ $data = array_merge( (array) $data, $list );
26
+ }
27
+ }
28
+
29
+ return $data;
30
+ }
31
+
32
+ ?>
modules/number.php CHANGED
@@ -32,7 +32,7 @@ function wpcf7_number_shortcode_handler( $tag ) {
32
$atts = array();
33
34
$atts['class'] = $tag->get_class_option( $class );
35
- $atts['id'] = $tag->get_option( 'id', 'id', true );
36
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
37
$atts['min'] = $tag->get_option( 'min', 'signed_int', true );
38
$atts['max'] = $tag->get_option( 'max', 'signed_int', true );
@@ -54,7 +54,7 @@ function wpcf7_number_shortcode_handler( $tag ) {
54
}
55
56
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
57
- $value = stripslashes_deep( $_POST[$tag->name] );
58
59
$atts['value'] = $value;
60
@@ -70,7 +70,7 @@ function wpcf7_number_shortcode_handler( $tag ) {
70
71
$html = sprintf(
72
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
73
- $tag->name, $atts, $validation_error );
74
75
return $html;
76
}
@@ -109,6 +109,10 @@ function wpcf7_number_validation_filter( $result, $tag ) {
109
$result['reason'][$name] = wpcf7_get_message( 'number_too_large' );
110
}
111
112
return $result;
113
}
114
32
$atts = array();
33
34
$atts['class'] = $tag->get_class_option( $class );
35
+ $atts['id'] = $tag->get_id_option();
36
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
37
$atts['min'] = $tag->get_option( 'min', 'signed_int', true );
38
$atts['max'] = $tag->get_option( 'max', 'signed_int', true );
54
}
55
56
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
57
+ $value = wp_unslash( $_POST[$tag->name] );
58
59
$atts['value'] = $value;
60
70
71
$html = sprintf(
72
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
73
+ sanitize_html_class( $tag->name ), $atts, $validation_error );
74
75
return $html;
76
}
109
$result['reason'][$name] = wpcf7_get_message( 'number_too_large' );
110
}
111
112
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
113
+ $result['idref'][$name] = $id;
114
+ }
115
+
116
return $result;
117
}
118
modules/quiz.php CHANGED
@@ -29,7 +29,7 @@ function wpcf7_quiz_shortcode_handler( $tag ) {
29
$atts['size'] = $tag->get_size_option( '40' );
30
$atts['maxlength'] = $tag->get_maxlength_option();
31
$atts['class'] = $tag->get_class_option( $class );
32
- $atts['id'] = $tag->get_option( 'id', 'id', true );
33
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
34
$atts['aria-required'] = 'true';
35
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
@@ -54,8 +54,9 @@ function wpcf7_quiz_shortcode_handler( $tag ) {
54
$atts = wpcf7_format_atts( $atts );
55
56
$html = sprintf(
57
- '<span class="wpcf7-form-control-wrap %1$s"><span class="wpcf7-quiz-label">%2$s</span>&nbsp;<input %3$s /><input type="hidden" name="_wpcf7_quiz_answer_%1$s" value="%4$s" />%5$s</span>',
58
- $tag->name, esc_html( $question ), $atts,
59
wp_hash( $answer, 'wpcf7_quiz' ), $validation_error );
60
61
return $html;
@@ -72,7 +73,7 @@ function wpcf7_quiz_validation_filter( $result, $tag ) {
72
$name = $tag->name;
73
74
$answer = isset( $_POST[$name] ) ? wpcf7_canonicalize( $_POST[$name] ) : '';
75
- $answer = stripslashes( $answer );
76
77
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
78
@@ -85,6 +86,10 @@ function wpcf7_quiz_validation_filter( $result, $tag ) {
85
$result['reason'][$name] = wpcf7_get_message( 'quiz_answer_not_correct' );
86
}
87
88
return $result;
89
}
90
29
$atts['size'] = $tag->get_size_option( '40' );
30
$atts['maxlength'] = $tag->get_maxlength_option();
31
$atts['class'] = $tag->get_class_option( $class );
32
+ $atts['id'] = $tag->get_id_option();
33
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
34
$atts['aria-required'] = 'true';
35
$atts['aria-invalid'] = $validation_error ? 'true' : 'false';
54
$atts = wpcf7_format_atts( $atts );
55
56
$html = sprintf(
57
+ '<span class="wpcf7-form-control-wrap %1$s"><span class="wpcf7-quiz-label">%2$s</span>&nbsp;<input %3$s /><input type="hidden" name="_wpcf7_quiz_answer_%4$s" value="%5$s" />%6$s</span>',
58
+ sanitize_html_class( $tag->name ),
59
+ esc_html( $question ), $atts, $tag->name,
60
wp_hash( $answer, 'wpcf7_quiz' ), $validation_error );
61
62
return $html;
73
$name = $tag->name;
74
75
$answer = isset( $_POST[$name] ) ? wpcf7_canonicalize( $_POST[$name] ) : '';
76
+ $answer = wp_unslash( $answer );
77
78
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
79
86
$result['reason'][$name] = wpcf7_get_message( 'quiz_answer_not_correct' );
87
}
88
89
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
90
+ $result['idref'][$name] = $id;
91
+ }
92
+
93
return $result;
94
}
95
modules/select.php CHANGED
@@ -28,7 +28,7 @@ function wpcf7_select_shortcode_handler( $tag ) {
28
$atts = array();
29
30
$atts['class'] = $tag->get_class_option( $class );
31
- $atts['id'] = $tag->get_option( 'id', 'id', true );
32
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
33
34
if ( $tag->is_required() )
@@ -49,6 +49,11 @@ function wpcf7_select_shortcode_handler( $tag ) {
49
$values = $tag->values;
50
$labels = $tag->labels;
51
52
$empty_select = empty( $values );
53
54
if ( $empty_select || $include_blank ) {
@@ -96,7 +101,7 @@ function wpcf7_select_shortcode_handler( $tag ) {
96
97
$html = sprintf(
98
'<span class="wpcf7-form-control-wrap %1$s"><select %2$s>%3$s</select>%4$s</span>',
99
- $tag->name, $atts, $html, $validation_error );
100
101
return $html;
102
}
@@ -127,6 +132,10 @@ function wpcf7_select_validation_filter( $result, $tag ) {
127
}
128
}
129
130
return $result;
131
}
132
28
$atts = array();
29
30
$atts['class'] = $tag->get_class_option( $class );
31
+ $atts['id'] = $tag->get_id_option();
32
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
33
34
if ( $tag->is_required() )
49
$values = $tag->values;
50
$labels = $tag->labels;
51
52
+ if ( $data = (array) $tag->get_data_option() ) {
53
+ $values = array_merge( $values, array_values( $data ) );
54
+ $labels = array_merge( $labels, array_values( $data ) );
55
+ }
56
+
57
$empty_select = empty( $values );
58
59
if ( $empty_select || $include_blank ) {
101
102
$html = sprintf(
103
'<span class="wpcf7-form-control-wrap %1$s"><select %2$s>%3$s</select>%4$s</span>',
104
+ sanitize_html_class( $tag->name ), $atts, $html, $validation_error );
105
106
return $html;
107
}
132
}
133
}
134
135
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
136
+ $result['idref'][$name] = $id;
137
+ }
138
+
139
return $result;
140
}
141
modules/submit.php CHANGED
@@ -19,7 +19,7 @@ function wpcf7_submit_shortcode_handler( $tag ) {
19
$atts = array();
20
21
$atts['class'] = $tag->get_class_option( $class );
22
- $atts['id'] = $tag->get_option( 'id', 'id', true );
23
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
24
25
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
19
$atts = array();
20
21
$atts['class'] = $tag->get_class_option( $class );
22
+ $atts['id'] = $tag->get_id_option();
23
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
24
25
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
modules/text.php CHANGED
@@ -38,7 +38,7 @@ function wpcf7_text_shortcode_handler( $tag ) {
38
$atts['size'] = $tag->get_size_option( '40' );
39
$atts['maxlength'] = $tag->get_maxlength_option();
40
$atts['class'] = $tag->get_class_option( $class );
41
- $atts['id'] = $tag->get_option( 'id', 'id', true );
42
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
43
44
if ( $tag->has_option( 'readonly' ) )
@@ -54,12 +54,12 @@ function wpcf7_text_shortcode_handler( $tag ) {
54
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
55
$atts['placeholder'] = $value;
56
$value = '';
57
- } elseif ( empty( $value ) ) {
58
$value = $tag->get_default_option();
59
}
60
61
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
62
- $value = stripslashes_deep( $_POST[$tag->name] );
63
64
$atts['value'] = $value;
65
@@ -75,7 +75,7 @@ function wpcf7_text_shortcode_handler( $tag ) {
75
76
$html = sprintf(
77
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
78
- $tag->name, $atts, $validation_error );
79
80
return $html;
81
}
@@ -98,7 +98,7 @@ function wpcf7_text_validation_filter( $result, $tag ) {
98
$name = $tag->name;
99
100
$value = isset( $_POST[$name] )
101
- ? trim( stripslashes( strtr( (string) $_POST[$name], "\n", " " ) ) )
102
: '';
103
104
if ( 'text*' == $tag->type ) {
@@ -138,6 +138,10 @@ function wpcf7_text_validation_filter( $result, $tag ) {
138
}
139
}
140
141
return $result;
142
}
143
38
$atts['size'] = $tag->get_size_option( '40' );
39
$atts['maxlength'] = $tag->get_maxlength_option();
40
$atts['class'] = $tag->get_class_option( $class );
41
+ $atts['id'] = $tag->get_id_option();
42
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
43
44
if ( $tag->has_option( 'readonly' ) )
54
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
55
$atts['placeholder'] = $value;
56
$value = '';
57
+ } elseif ( '' === $value ) {
58
$value = $tag->get_default_option();
59
}
60
61
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
62
+ $value = wp_unslash( $_POST[$tag->name] );
63
64
$atts['value'] = $value;
65
75
76
$html = sprintf(
77
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
78
+ sanitize_html_class( $tag->name ), $atts, $validation_error );
79
80
return $html;
81
}
98
$name = $tag->name;
99
100
$value = isset( $_POST[$name] )
101
+ ? trim( wp_unslash( strtr( (string) $_POST[$name], "\n", " " ) ) )
102
: '';
103
104
if ( 'text*' == $tag->type ) {
138
}
139
}
140
141
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
142
+ $result['idref'][$name] = $id;
143
+ }
144
+
145
return $result;
146
}
147
modules/textarea.php CHANGED
@@ -31,7 +31,7 @@ function wpcf7_textarea_shortcode_handler( $tag ) {
31
$atts['rows'] = $tag->get_rows_option( '10' );
32
$atts['maxlength'] = $tag->get_maxlength_option();
33
$atts['class'] = $tag->get_class_option( $class );
34
- $atts['id'] = $tag->get_option( 'id', 'id', true );
35
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
36
37
if ( $tag->has_option( 'readonly' ) )
@@ -53,7 +53,7 @@ function wpcf7_textarea_shortcode_handler( $tag ) {
53
}
54
55
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
56
- $value = stripslashes_deep( $_POST[$tag->name] );
57
58
$atts['name'] = $tag->name;
59
@@ -61,7 +61,8 @@ function wpcf7_textarea_shortcode_handler( $tag ) {
61
62
$html = sprintf(
63
'<span class="wpcf7-form-control-wrap %1$s"><textarea %2$s>%3$s</textarea>%4$s</span>',
64
- $tag->name, $atts, esc_textarea( $value ), $validation_error );
65
66
return $html;
67
}
@@ -87,6 +88,10 @@ function wpcf7_textarea_validation_filter( $result, $tag ) {
87
}
88
}
89
90
return $result;
91
}
92
31
$atts['rows'] = $tag->get_rows_option( '10' );
32
$atts['maxlength'] = $tag->get_maxlength_option();
33
$atts['class'] = $tag->get_class_option( $class );
34
+ $atts['id'] = $tag->get_id_option();
35
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
36
37
if ( $tag->has_option( 'readonly' ) )
53
}
54
55
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
56
+ $value = wp_unslash( $_POST[$tag->name] );
57
58
$atts['name'] = $tag->name;
59
61
62
$html = sprintf(
63
'<span class="wpcf7-form-control-wrap %1$s"><textarea %2$s>%3$s</textarea>%4$s</span>',
64
+ sanitize_html_class( $tag->name ), $atts,
65
+ esc_textarea( $value ), $validation_error );
66
67
return $html;
68
}
88
}
89
}
90
91
+ if ( isset( $result['reason'][$name] ) && $id = $tag->get_id_option() ) {
92
+ $result['idref'][$name] = $id;
93
+ }
94
+
95
return $result;
96
}
97
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
Contributors: takayukister
3
Donate link: http://contactform7.com/donate/
4
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
- Requires at least: 3.6
6
- Tested up to: 3.8.1
7
- Stable tag: 3.7.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -92,7 +92,7 @@ The following are other recommended plugins by the author of Contact Form 7.
92
* Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
93
* Thai (th) - [ToshiK](http://www.tuntikorn.com/), [kazama](http://blog.wordthai.com/)
94
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/), Burak Yavuz
95
- * Ukrainian (uk) - [Andrey Kovba](http://myserver.com.ua/), [Ukrainian WordPress localization team](http://wordpress.co.ua/plugins/contact-form-7.html)
96
* Vietnamese (vi) - Thanh Hải, Hà, [Khang Minh](http://betterwp.net/)
97
98
If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can download the latest [POT file](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/contact-form-7.pot), and [PO files in each language](http://plugins.svn.wordpress.org/contact-form-7/branches/languages/).
@@ -124,6 +124,15 @@ Do you have questions or issues with Contact Form 7? Use these support channels
124
125
For more information, see [Releases](http://contactform7.com/category/releases/).
126
127
= 3.7.2 =
128
129
* Fixed a bug that allowed to avoid CAPTCHA validation.
@@ -145,19 +154,3 @@ For more information, see [Releases](http://contactform7.com/category/releases/)
145
* Fixed bug where auto-p function wrapped [response] with p.
146
* The jQuery Form Plugin (jquery.form.js) has been updated to 3.48.0.
147
* Translation for Haitian has been created. Translations for German, Hungarian, Czech, Turkish, Lithuanian, French, Basque, and Brazilian Portuguese have been updated.
148
-
149
- = 3.6 =
150
-
151
- * Accessibility: Apply role="alert" to response message and validation errors.
152
- * Accessibility: Apply aria-invalid="true" to input fields in which validation errors occuring.
153
- * Accessibility: Stop using floating-style validation error messages (not-valid-tip) which disappear with mouse-over, as it is not accessible.
154
- * Text domain has been changed from "wpcf7" to "contact-form-7" according with the standard of WordPress.org language packs.
155
- * Admin: "Add New" submenu has been added.
156
- * Flamingo: Sub-channel support.
157
- * Flamingo: Pass data to Flamingo in cases of spam detected, in addition to cases of mail sent.
158
- * Flamingo: Support flamingo_email, flamingo_name and flamingo_subject additional settings which allow to alter values passed to Flamingo.
159
- * New: Date format in mail.
160
- * New: wpcf7_submit action hook.
161
- * New: wpcf7_flamingo_submit_if and wpcf7_flamingo_get_value filter hooks.
162
- * The jQuery Form Plugin (jquery.form.js) has been updated to 3.46.0.
163
- * Translations for Brazilian Portuguese and French have been updated.
2
Contributors: takayukister
3
Donate link: http://contactform7.com/donate/
4
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
+ Requires at least: 3.7
6
+ Tested up to: 3.9
7
+ Stable tag: 3.8
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
92
* Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
93
* Thai (th) - [ToshiK](http://www.tuntikorn.com/), [kazama](http://blog.wordthai.com/)
94
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/), Burak Yavuz
95
+ * Ukrainian (uk) - [Andrey Kovba](http://myserver.com.ua/), [Ukrainian WordPress localization team](http://wordpress.co.ua/plugins/contact-form-7.html), Myroslava Pabyrivska
96
* Vietnamese (vi) - Thanh Hải, Hà, [Khang Minh](http://betterwp.net/)
97
98
If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can download the latest [POT file](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/contact-form-7.pot), and [PO files in each language](http://plugins.svn.wordpress.org/contact-form-7/branches/languages/).
124
125
For more information, see [Releases](http://contactform7.com/category/releases/).
126
127
+ = 3.8 =
128
+
129
+ * Introduced data option for select, checkbox and radio form-tags. With Listo plugin, you can make a menu with hundreds of options.
130
+ * Accessibility improvement: add an invisible response message block before &lt;form&gt;.
131
+ * Added relative date notation support in min and max options of date form-tags.
132
+ * Added html_name attribute support in [contact-form-7] shortcodes.
133
+ * WordPress 3.7 or higher is required.
134
+ * Translation for Ukrainian has been updated.
135
+
136
= 3.7.2 =
137
138
* Fixed a bug that allowed to avoid CAPTCHA validation.
154
* Fixed bug where auto-p function wrapped [response] with p.
155
* The jQuery Form Plugin (jquery.form.js) has been updated to 3.48.0.
156
* Translation for Haitian has been created. Translations for German, Hungarian, Czech, Turkish, Lithuanian, French, Basque, and Brazilian Portuguese have been updated.
wp-contact-form-7.php CHANGED
@@ -7,7 +7,7 @@ Author: Takayuki Miyoshi
7
Author URI: http://ideasilo.wordpress.com/
8
Text Domain: contact-form-7
9
Domain Path: /languages/
10
- Version: 3.7.2
11
*/
12
13
/* Copyright 2007-2014 Takayuki Miyoshi (email: takayukister at gmail.com)
@@ -27,9 +27,9 @@ Version: 3.7.2
27
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
*/
29
30
- define( 'WPCF7_VERSION', '3.7.2' );
31
32
- define( 'WPCF7_REQUIRED_WP_VERSION', '3.6' );
33
34
if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
35
define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
7
Author URI: http://ideasilo.wordpress.com/
8
Text Domain: contact-form-7
9
Domain Path: /languages/
10
+ Version: 3.8
11
*/
12
13
/* Copyright 2007-2014 Takayuki Miyoshi (email: takayukister at gmail.com)
27
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
*/
29
30
+ define( 'WPCF7_VERSION', '3.8' );
31
32
+ define( 'WPCF7_REQUIRED_WP_VERSION', '3.7' );
33
34
if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
35
define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );