Contact Form 7 - Version 4.1

Version Description

  • Added maxlength and minlength options to several form-tag types.
  • Added [count] form-tag type that represents character count for form fields.
  • Introduced WPCF7_Validation class to handle the user-input validation process.
  • Added the front-end URL normalization for [url] fields.
  • Added default:get, default:post and default:post_meta options to get default values from the context.
  • Translations for Turkish, German, Portuguese, Dutch, and Hebrew have been updated.
  • WordPress 4.0 or higher is required.
Download this release

Release Info

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

Code changes from version 4.1-beta to 4.1

includes/formatting.php CHANGED
@@ -60,6 +60,22 @@ function wpcf7_autop( $pee, $br = 1 ) {
60
  return $pee;
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  function wpcf7_strip_quote( $text ) {
64
  $text = trim( $text );
65
 
@@ -117,20 +133,28 @@ function wpcf7_strip_newline( $str ) {
117
  }
118
 
119
  function wpcf7_canonicalize( $text ) {
120
- if ( function_exists( 'mb_convert_kana' ) && 'UTF-8' == get_option( 'blog_charset' ) )
 
121
  $text = mb_convert_kana( $text, 'asKV', 'UTF-8' );
 
122
 
123
  $text = strtolower( $text );
124
  $text = trim( $text );
125
  return $text;
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
128
  function wpcf7_is_name( $string ) {
129
- // See http://www.w3.org/TR/html401/types.html#h-6.2
130
- // ID and NAME tokens must begin with a letter ([A-Za-z])
131
- // and may be followed by any number of letters, digits ([0-9]),
132
- // hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
133
-
134
  return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string );
135
  }
136
 
60
  return $pee;
61
  }
62
 
63
+ function wpcf7_sanitize_query_var( $text ) {
64
+ $text = wp_unslash( $text );
65
+ $text = wp_check_invalid_utf8( $text );
66
+
67
+ if ( false !== strpos( $text, '<' ) ) {
68
+ $text = wp_pre_kses_less_than( $text );
69
+ $text = wp_strip_all_tags( $text );
70
+ }
71
+
72
+ $text = preg_replace( '/%[a-f0-9]{2}/i', '', $text );
73
+ $text = preg_replace( '/ +/', ' ', $text );
74
+ $text = trim( $text, ' ' );
75
+
76
+ return $text;
77
+ }
78
+
79
  function wpcf7_strip_quote( $text ) {
80
  $text = trim( $text );
81
 
133
  }
134
 
135
  function wpcf7_canonicalize( $text ) {
136
+ if ( function_exists( 'mb_convert_kana' )
137
+ && 'UTF-8' == get_option( 'blog_charset' ) ) {
138
  $text = mb_convert_kana( $text, 'asKV', 'UTF-8' );
139
+ }
140
 
141
  $text = strtolower( $text );
142
  $text = trim( $text );
143
  return $text;
144
  }
145
 
146
+ /**
147
+ * Check whether a string is a valid NAME token.
148
+ *
149
+ * ID and NAME tokens must begin with a letter ([A-Za-z])
150
+ * and may be followed by any number of letters, digits ([0-9]),
151
+ * hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
152
+ *
153
+ * @see http://www.w3.org/TR/html401/types.html#h-6.2
154
+ *
155
+ * @return bool True if it is a valid name, false if not.
156
+ */
157
  function wpcf7_is_name( $string ) {
 
 
 
 
 
158
  return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string );
159
  }
160
 
includes/functions.php CHANGED
@@ -216,6 +216,12 @@ function wpcf7_format_atts( $atts ) {
216
  }
217
 
218
  foreach ( $atts as $key => $value ) {
 
 
 
 
 
 
219
  $value = trim( $value );
220
 
221
  if ( '' !== $value ) {
216
  }
217
 
218
  foreach ( $atts as $key => $value ) {
219
+ $key = strtolower( trim( $key ) );
220
+
221
+ if ( ! preg_match( '/^[a-z_:][a-z_:.0-9-]*$/', $key ) ) {
222
+ continue;
223
+ }
224
+
225
  $value = trim( $value );
226
 
227
  if ( '' !== $value ) {
includes/js/scripts.js CHANGED
@@ -144,7 +144,7 @@
144
  $responseOutput.attr('role', 'alert');
145
 
146
  $.wpcf7UpdateScreenReaderResponse($form, data);
147
- }
148
 
149
  $.fn.wpcf7ExclusiveCheckbox = function() {
150
  return this.find('input:checkbox').click(function() {
@@ -392,7 +392,7 @@
392
 
393
  $response.attr('role', 'alert').focus();
394
  }
395
- }
396
 
397
  $.wpcf7SupportHtml5 = function() {
398
  var features = {};
144
  $responseOutput.attr('role', 'alert');
145
 
146
  $.wpcf7UpdateScreenReaderResponse($form, data);
147
+ };
148
 
149
  $.fn.wpcf7ExclusiveCheckbox = function() {
150
  return this.find('input:checkbox').click(function() {
392
 
393
  $response.attr('role', 'alert').focus();
394
  }
395
+ };
396
 
397
  $.wpcf7SupportHtml5 = function() {
398
  var features = {};
includes/mail.php CHANGED
@@ -19,6 +19,10 @@ class WPCF7_Mail {
19
 
20
  private function __construct() {}
21
 
 
 
 
 
22
  public static function get_current() {
23
  return self::$current;
24
  }
@@ -55,7 +59,7 @@ class WPCF7_Mail {
55
  'recipient', 'additional_headers', 'attachments' );
56
 
57
  $components = apply_filters( 'wpcf7_mail_components',
58
- $components, wpcf7_get_current_contact_form() );
59
 
60
  $subject = wpcf7_strip_newline( $components['subject'] );
61
  $sender = wpcf7_strip_newline( $components['sender'] );
19
 
20
  private function __construct() {}
21
 
22
+ public function name() {
23
+ return $this->name;
24
+ }
25
+
26
  public static function get_current() {
27
  return self::$current;
28
  }
59
  'recipient', 'additional_headers', 'attachments' );
60
 
61
  $components = apply_filters( 'wpcf7_mail_components',
62
+ $components, wpcf7_get_current_contact_form(), $this );
63
 
64
  $subject = wpcf7_strip_newline( $components['subject'] );
65
  $sender = wpcf7_strip_newline( $components['sender'] );
includes/shortcodes.php CHANGED
@@ -33,12 +33,21 @@ class WPCF7_ShortcodeManager {
33
  $tags = array_filter( array_unique( (array) $tag ) );
34
 
35
  foreach ( $tags as $tag ) {
 
 
36
  $this->shortcode_tags[$tag] = array(
37
  'function' => $func,
38
  'has_name' => (boolean) $has_name );
39
  }
40
  }
41
 
 
 
 
 
 
 
 
42
  public function remove_shortcode( $tag ) {
43
  unset( $this->shortcode_tags[$tag] );
44
  }
@@ -380,11 +389,15 @@ class WPCF7_Shortcode {
380
  return false;
381
  }
382
 
383
- public function get_default_option() {
 
 
 
384
  $options = (array) $this->get_option( 'default' );
 
385
 
386
  if ( empty( $options ) ) {
387
- return false;
388
  }
389
 
390
  foreach ( $options as $opt ) {
@@ -398,12 +411,61 @@ class WPCF7_Shortcode {
398
  $user_prop = $user->get( $opt );
399
 
400
  if ( ! empty( $user_prop ) ) {
401
- return $user_prop;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
402
  }
403
  }
404
  }
405
 
406
- return false;
 
 
 
 
 
407
  }
408
 
409
  public function get_data_option( $args = '' ) {
33
  $tags = array_filter( array_unique( (array) $tag ) );
34
 
35
  foreach ( $tags as $tag ) {
36
+ $tag = $this->sanitize_tag_type( $tag );
37
+
38
  $this->shortcode_tags[$tag] = array(
39
  'function' => $func,
40
  'has_name' => (boolean) $has_name );
41
  }
42
  }
43
 
44
+ private function sanitize_tag_type( $tag ) {
45
+ $tag = preg_replace( '/[^a-zA-Z0-9_*]+/', '_', $tag );
46
+ $tag = rtrim( $tag, '_' );
47
+ $tag = strtolower( $tag );
48
+ return $tag;
49
+ }
50
+
51
  public function remove_shortcode( $tag ) {
52
  unset( $this->shortcode_tags[$tag] );
53
  }
389
  return false;
390
  }
391
 
392
+ public function get_default_option( $default = '', $args = '' ) {
393
+ $args = wp_parse_args( $args, array(
394
+ 'multiple' => false ) );
395
+
396
  $options = (array) $this->get_option( 'default' );
397
+ $values = array();
398
 
399
  if ( empty( $options ) ) {
400
+ return $args['multiple'] ? $values : $default;
401
  }
402
 
403
  foreach ( $options as $opt ) {
411
  $user_prop = $user->get( $opt );
412
 
413
  if ( ! empty( $user_prop ) ) {
414
+ if ( $args['multiple'] ) {
415
+ $values[] = $user_prop;
416
+ } else {
417
+ return $user_prop;
418
+ }
419
+ }
420
+
421
+ } elseif ( 'post_meta' == $opt && in_the_loop() ) {
422
+ if ( $args['multiple'] ) {
423
+ $values = array_merge( $values,
424
+ get_post_meta( get_the_ID(), $this->name ) );
425
+ } else {
426
+ $val = (string) get_post_meta( get_the_ID(), $this->name, true );
427
+
428
+ if ( strlen( $val ) ) {
429
+ return $val;
430
+ }
431
+ }
432
+
433
+ } elseif ( 'get' == $opt && isset( $_GET[$this->name] ) ) {
434
+ $vals = (array) $_GET[$this->name];
435
+ $vals = array_map( 'wpcf7_sanitize_query_var', $vals );
436
+
437
+ if ( $args['multiple'] ) {
438
+ $values = array_merge( $values, $vals );
439
+ } else {
440
+ $val = isset( $vals[0] ) ? (string) $vals[0] : '';
441
+
442
+ if ( strlen( $val ) ) {
443
+ return $val;
444
+ }
445
+ }
446
+
447
+ } elseif ( 'post' == $opt && isset( $_POST[$this->name] ) ) {
448
+ $vals = (array) $_POST[$this->name];
449
+ $vals = array_map( 'wpcf7_sanitize_query_var', $vals );
450
+
451
+ if ( $args['multiple'] ) {
452
+ $values = array_merge( $values, $vals );
453
+ } else {
454
+ $val = isset( $vals[0] ) ? (string) $vals[0] : '';
455
+
456
+ if ( strlen( $val ) ) {
457
+ return $val;
458
+ }
459
  }
460
  }
461
  }
462
 
463
+ if ( $args['multiple'] ) {
464
+ $values = array_unique( $values );
465
+ return $values;
466
+ } else {
467
+ return $default;
468
+ }
469
  }
470
 
471
  public function get_data_option( $args = '' ) {
includes/submission.php CHANGED
@@ -70,7 +70,7 @@ class WPCF7_Submission {
70
  }
71
 
72
  private function setup_posted_data() {
73
- $posted_data = (array) $_POST;
74
 
75
  $tags = $this->contact_form->form_scan_shortcode();
76
 
@@ -112,6 +112,17 @@ class WPCF7_Submission {
112
  return $this->posted_data;
113
  }
114
 
 
 
 
 
 
 
 
 
 
 
 
115
  private function submit() {
116
  if ( ! $this->is( 'init' ) ) {
117
  return $this->status;
@@ -174,7 +185,7 @@ class WPCF7_Submission {
174
  $result, $tag );
175
  }
176
 
177
- $result = apply_filters( 'wpcf7_validate', $result );
178
 
179
  $this->invalid_fields = $result->get_invalid_fields();
180
 
70
  }
71
 
72
  private function setup_posted_data() {
73
+ $posted_data = $this->sanitize_posted_data( $_POST );
74
 
75
  $tags = $this->contact_form->form_scan_shortcode();
76
 
112
  return $this->posted_data;
113
  }
114
 
115
+ private function sanitize_posted_data( $value ) {
116
+ if ( is_array( $value ) ) {
117
+ $value = array_map( array( $this, 'sanitize_posted_data' ), $value );
118
+ } elseif ( is_string( $value ) ) {
119
+ $value = wp_check_invalid_utf8( $value );
120
+ $value = wp_kses_no_null( $value );
121
+ }
122
+
123
+ return $value;
124
+ }
125
+
126
  private function submit() {
127
  if ( ! $this->is( 'init' ) ) {
128
  return $this->status;
185
  $result, $tag );
186
  }
187
 
188
+ $result = apply_filters( 'wpcf7_validate', $result, $tags );
189
 
190
  $this->invalid_fields = $result->get_invalid_fields();
191
 
languages/contact-form-7-he_IL.mo CHANGED
Binary file
languages/contact-form-7-nl_NL.mo CHANGED
Binary file
languages/contact-form-7.pot CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Contact Form 7\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-01-06 10:11+0900\n"
6
- "PO-Revision-Date: 2015-01-06 10:11+0900\n"
7
  "Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -13,7 +13,7 @@ msgstr ""
13
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_c\n"
14
  "X-Poedit-Basepath: ../..\n"
15
  "Plural-Forms: nplurals=1; plural=0;\n"
16
- "X-Generator: Poedit 1.7.1\n"
17
  "X-Poedit-SearchPath-0: contact-form-7\n"
18
 
19
  #: contact-form-7/wp-contact-form-7.php:5
@@ -297,7 +297,7 @@ msgid "Author"
297
  msgstr ""
298
 
299
  #: contact-form-7/admin/includes/class-contact-forms-list-table.php:14
300
- #: contact-form-7/modules/date.php:139
301
  msgid "Date"
302
  msgstr ""
303
 
@@ -905,48 +905,48 @@ msgid "Acceptance"
905
  msgstr ""
906
 
907
  #: contact-form-7/modules/acceptance.php:141
908
- #: contact-form-7/modules/captcha.php:212
909
- #: contact-form-7/modules/checkbox.php:282 contact-form-7/modules/date.php:156
910
- #: contact-form-7/modules/file.php:231 contact-form-7/modules/number.php:166
911
- #: contact-form-7/modules/quiz.php:172 contact-form-7/modules/select.php:155
912
- #: contact-form-7/modules/text.php:231 contact-form-7/modules/textarea.php:134
913
  msgid "Name"
914
  msgstr ""
915
 
916
  #: contact-form-7/modules/acceptance.php:146
917
  #: contact-form-7/modules/acceptance.php:149
918
- #: contact-form-7/modules/captcha.php:219
919
- #: contact-form-7/modules/captcha.php:222
920
- #: contact-form-7/modules/captcha.php:227
921
- #: contact-form-7/modules/captcha.php:230
922
- #: contact-form-7/modules/captcha.php:234
923
- #: contact-form-7/modules/captcha.php:245
924
- #: contact-form-7/modules/captcha.php:248
925
- #: contact-form-7/modules/captcha.php:253
926
- #: contact-form-7/modules/captcha.php:256
927
- #: contact-form-7/modules/checkbox.php:287
928
- #: contact-form-7/modules/checkbox.php:290 contact-form-7/modules/date.php:161
929
- #: contact-form-7/modules/date.php:164 contact-form-7/modules/date.php:169
930
- #: contact-form-7/modules/date.php:172 contact-form-7/modules/date.php:177
931
- #: contact-form-7/modules/date.php:182 contact-form-7/modules/file.php:236
932
- #: contact-form-7/modules/file.php:239 contact-form-7/modules/file.php:244
933
- #: contact-form-7/modules/file.php:247 contact-form-7/modules/number.php:171
934
- #: contact-form-7/modules/number.php:174 contact-form-7/modules/number.php:179
935
- #: contact-form-7/modules/number.php:182 contact-form-7/modules/number.php:187
936
- #: contact-form-7/modules/number.php:192 contact-form-7/modules/quiz.php:177
937
  #: contact-form-7/modules/quiz.php:180 contact-form-7/modules/quiz.php:185
938
- #: contact-form-7/modules/quiz.php:188 contact-form-7/modules/select.php:160
939
- #: contact-form-7/modules/select.php:163 contact-form-7/modules/submit.php:59
940
  #: contact-form-7/modules/submit.php:62 contact-form-7/modules/submit.php:67
941
  #: contact-form-7/modules/text.php:236 contact-form-7/modules/text.php:239
942
  #: contact-form-7/modules/text.php:244 contact-form-7/modules/text.php:247
943
  #: contact-form-7/modules/text.php:253 contact-form-7/modules/text.php:266
944
- #: contact-form-7/modules/textarea.php:139
945
  #: contact-form-7/modules/textarea.php:142
946
- #: contact-form-7/modules/textarea.php:147
947
  #: contact-form-7/modules/textarea.php:150
948
- #: contact-form-7/modules/textarea.php:155
949
- #: contact-form-7/modules/textarea.php:160
 
950
  msgid "optional"
951
  msgstr ""
952
 
@@ -963,12 +963,12 @@ msgid "* That means visitor who accepts the term unchecks it."
963
  msgstr ""
964
 
965
  #: contact-form-7/modules/acceptance.php:162
966
- #: contact-form-7/modules/captcha.php:261
967
- #: contact-form-7/modules/checkbox.php:310 contact-form-7/modules/date.php:190
968
- #: contact-form-7/modules/file.php:252 contact-form-7/modules/number.php:200
969
- #: contact-form-7/modules/quiz.php:200 contact-form-7/modules/select.php:180
970
  #: contact-form-7/modules/submit.php:74 contact-form-7/modules/text.php:274
971
- #: contact-form-7/modules/textarea.php:168
972
  msgid "Copy this code and paste it into the form left."
973
  msgstr ""
974
 
@@ -978,63 +978,63 @@ msgid ""
978
  "really-simple-captcha/\">Really Simple CAPTCHA</a> plugin installed."
979
  msgstr ""
980
 
981
- #: contact-form-7/modules/captcha.php:184
982
  msgid "The code that sender entered does not match the CAPTCHA"
983
  msgstr ""
984
 
985
- #: contact-form-7/modules/captcha.php:185
986
  msgid "Your entered code is incorrect."
987
  msgstr ""
988
 
989
- #: contact-form-7/modules/captcha.php:198
990
  msgid "CAPTCHA"
991
  msgstr ""
992
 
993
- #: contact-form-7/modules/captcha.php:209
994
  msgid "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed."
995
  msgstr ""
996
 
997
- #: contact-form-7/modules/captcha.php:216
998
  msgid "Image settings"
999
  msgstr ""
1000
 
1001
- #: contact-form-7/modules/captcha.php:227
1002
  msgid "Foreground color"
1003
  msgstr ""
1004
 
1005
- #: contact-form-7/modules/captcha.php:230
1006
  msgid "Background color"
1007
  msgstr ""
1008
 
1009
- #: contact-form-7/modules/captcha.php:234
1010
  msgid "Image size"
1011
  msgstr ""
1012
 
1013
- #: contact-form-7/modules/captcha.php:235
1014
  msgid "Small"
1015
  msgstr ""
1016
 
1017
- #: contact-form-7/modules/captcha.php:236
1018
  msgid "Medium"
1019
  msgstr ""
1020
 
1021
- #: contact-form-7/modules/captcha.php:237
1022
  msgid "Large"
1023
  msgstr ""
1024
 
1025
- #: contact-form-7/modules/captcha.php:242
1026
  msgid "Input field settings"
1027
  msgstr ""
1028
 
1029
- #: contact-form-7/modules/captcha.php:262
1030
  msgid "For image"
1031
  msgstr ""
1032
 
1033
- #: contact-form-7/modules/captcha.php:264
1034
  msgid "For input field"
1035
  msgstr ""
1036
 
1037
- #: contact-form-7/modules/captcha.php:295
1038
  #, php-format
1039
  msgid ""
1040
  "This contact form contains CAPTCHA fields, but the temporary folder for the "
@@ -1042,142 +1042,142 @@ msgid ""
1042
  "change its permission manually."
1043
  msgstr ""
1044
 
1045
- #: contact-form-7/modules/captcha.php:301
1046
  msgid ""
1047
  "This contact form contains CAPTCHA fields, but the necessary libraries (GD "
1048
  "and FreeType) are not available on your server."
1049
  msgstr ""
1050
 
1051
- #: contact-form-7/modules/checkbox.php:255
1052
  msgid "Checkboxes"
1053
  msgstr ""
1054
 
1055
- #: contact-form-7/modules/checkbox.php:258
1056
  msgid "Radio buttons"
1057
  msgstr ""
1058
 
1059
- #: contact-form-7/modules/checkbox.php:279 contact-form-7/modules/date.php:155
1060
- #: contact-form-7/modules/file.php:230 contact-form-7/modules/number.php:165
1061
- #: contact-form-7/modules/select.php:154 contact-form-7/modules/text.php:230
1062
- #: contact-form-7/modules/textarea.php:133
1063
  msgid "Required field?"
1064
  msgstr ""
1065
 
1066
- #: contact-form-7/modules/checkbox.php:295
1067
- #: contact-form-7/modules/select.php:168
1068
  msgid "Choices"
1069
  msgstr ""
1070
 
1071
- #: contact-form-7/modules/checkbox.php:297
1072
- #: contact-form-7/modules/select.php:170
1073
  msgid "* One choice per line."
1074
  msgstr ""
1075
 
1076
- #: contact-form-7/modules/checkbox.php:301
1077
  msgid "Put a label first, a checkbox last?"
1078
  msgstr ""
1079
 
1080
- #: contact-form-7/modules/checkbox.php:302
1081
  msgid "Wrap each item with <label> tag?"
1082
  msgstr ""
1083
 
1084
- #: contact-form-7/modules/checkbox.php:304
1085
  msgid "Make checkboxes exclusive?"
1086
  msgstr ""
1087
 
1088
- #: contact-form-7/modules/checkbox.php:312 contact-form-7/modules/date.php:192
1089
- #: contact-form-7/modules/number.php:202 contact-form-7/modules/select.php:182
1090
- #: contact-form-7/modules/text.php:276 contact-form-7/modules/textarea.php:170
1091
  msgid "And, put this code into the Mail fields below."
1092
  msgstr ""
1093
 
1094
- #: contact-form-7/modules/date.php:115
1095
  msgid "Date format that the sender entered is invalid"
1096
  msgstr ""
1097
 
1098
- #: contact-form-7/modules/date.php:116
1099
  msgid "Date format seems invalid."
1100
  msgstr ""
1101
 
1102
- #: contact-form-7/modules/date.php:120
1103
  msgid "Date is earlier than minimum limit"
1104
  msgstr ""
1105
 
1106
- #: contact-form-7/modules/date.php:121
1107
  msgid "This date is too early."
1108
  msgstr ""
1109
 
1110
- #: contact-form-7/modules/date.php:125
1111
  msgid "Date is later than maximum limit"
1112
  msgstr ""
1113
 
1114
- #: contact-form-7/modules/date.php:126
1115
  msgid "This date is too late."
1116
  msgstr ""
1117
 
1118
- #: contact-form-7/modules/date.php:182 contact-form-7/modules/number.php:192
1119
- #: contact-form-7/modules/text.php:266 contact-form-7/modules/textarea.php:160
1120
  msgid "Default value"
1121
  msgstr ""
1122
 
1123
- #: contact-form-7/modules/date.php:185 contact-form-7/modules/number.php:195
1124
- #: contact-form-7/modules/text.php:269 contact-form-7/modules/textarea.php:163
1125
  msgid "Use this text as placeholder?"
1126
  msgstr ""
1127
 
1128
- #: contact-form-7/modules/file.php:191
1129
  msgid "Uploading a file fails for any reason"
1130
  msgstr ""
1131
 
1132
- #: contact-form-7/modules/file.php:192
1133
  msgid "Failed to upload file."
1134
  msgstr ""
1135
 
1136
- #: contact-form-7/modules/file.php:196
1137
  msgid "Uploaded file is not allowed file type"
1138
  msgstr ""
1139
 
1140
- #: contact-form-7/modules/file.php:197
1141
  msgid "This file type is not allowed."
1142
  msgstr ""
1143
 
1144
- #: contact-form-7/modules/file.php:201
1145
  msgid "Uploaded file is too large"
1146
  msgstr ""
1147
 
1148
- #: contact-form-7/modules/file.php:202
1149
  msgid "This file is too large."
1150
  msgstr ""
1151
 
1152
- #: contact-form-7/modules/file.php:206
1153
  msgid "Uploading a file fails for PHP error"
1154
  msgstr ""
1155
 
1156
- #: contact-form-7/modules/file.php:207
1157
  msgid "Failed to upload file. Error occurred."
1158
  msgstr ""
1159
 
1160
- #: contact-form-7/modules/file.php:221
1161
  msgid "File upload"
1162
  msgstr ""
1163
 
1164
- #: contact-form-7/modules/file.php:244
1165
  msgid "File size limit"
1166
  msgstr ""
1167
 
1168
- #: contact-form-7/modules/file.php:244
1169
  msgid "bytes"
1170
  msgstr ""
1171
 
1172
- #: contact-form-7/modules/file.php:247
1173
  msgid "Acceptable file types"
1174
  msgstr ""
1175
 
1176
- #: contact-form-7/modules/file.php:254
1177
  msgid "And, put this code into the File Attachments field below."
1178
  msgstr ""
1179
 
1180
- #: contact-form-7/modules/file.php:280
1181
  #, php-format
1182
  msgid ""
1183
  "This contact form contains file uploading fields, but the temporary folder "
@@ -1192,35 +1192,35 @@ msgid ""
1192
  "strong> <a href=\"%s\" target=\"_blank\">See how to avoid it.</a>"
1193
  msgstr ""
1194
 
1195
- #: contact-form-7/modules/number.php:118
1196
  msgid "Number format that the sender entered is invalid"
1197
  msgstr ""
1198
 
1199
- #: contact-form-7/modules/number.php:119
1200
  msgid "Number format seems invalid."
1201
  msgstr ""
1202
 
1203
- #: contact-form-7/modules/number.php:123
1204
  msgid "Number is smaller than minimum limit"
1205
  msgstr ""
1206
 
1207
- #: contact-form-7/modules/number.php:124
1208
  msgid "This number is too small."
1209
  msgstr ""
1210
 
1211
- #: contact-form-7/modules/number.php:128
1212
  msgid "Number is larger than maximum limit"
1213
  msgstr ""
1214
 
1215
- #: contact-form-7/modules/number.php:129
1216
  msgid "This number is too large."
1217
  msgstr ""
1218
 
1219
- #: contact-form-7/modules/number.php:142
1220
  msgid "Number (spinbox)"
1221
  msgstr ""
1222
 
1223
- #: contact-form-7/modules/number.php:145
1224
  msgid "Number (slider)"
1225
  msgstr ""
1226
 
@@ -1244,15 +1244,15 @@ msgstr ""
1244
  msgid "* quiz|answer (e.g. 1+1=?|2)"
1245
  msgstr ""
1246
 
1247
- #: contact-form-7/modules/select.php:145
1248
  msgid "Drop-down menu"
1249
  msgstr ""
1250
 
1251
- #: contact-form-7/modules/select.php:174
1252
  msgid "Allow multiple selections?"
1253
  msgstr ""
1254
 
1255
- #: contact-form-7/modules/select.php:175
1256
  msgid "Insert a blank item as the first option?"
1257
  msgstr ""
1258
 
@@ -1320,7 +1320,7 @@ msgstr ""
1320
  msgid "This field requires author's URL"
1321
  msgstr ""
1322
 
1323
- #: contact-form-7/modules/textarea.php:124
1324
  msgid "Text area"
1325
  msgstr ""
1326
 
2
  msgstr ""
3
  "Project-Id-Version: Contact Form 7\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-01-26 16:25+0900\n"
6
+ "PO-Revision-Date: 2015-01-26 16:25+0900\n"
7
  "Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
13
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_c\n"
14
  "X-Poedit-Basepath: ../..\n"
15
  "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "X-Generator: Poedit 1.7.3\n"
17
  "X-Poedit-SearchPath-0: contact-form-7\n"
18
 
19
  #: contact-form-7/wp-contact-form-7.php:5
297
  msgstr ""
298
 
299
  #: contact-form-7/admin/includes/class-contact-forms-list-table.php:14
300
+ #: contact-form-7/modules/date.php:141
301
  msgid "Date"
302
  msgstr ""
303
 
905
  msgstr ""
906
 
907
  #: contact-form-7/modules/acceptance.php:141
908
+ #: contact-form-7/modules/captcha.php:213
909
+ #: contact-form-7/modules/checkbox.php:295 contact-form-7/modules/date.php:158
910
+ #: contact-form-7/modules/file.php:233 contact-form-7/modules/number.php:168
911
+ #: contact-form-7/modules/quiz.php:172 contact-form-7/modules/select.php:171
912
+ #: contact-form-7/modules/text.php:231 contact-form-7/modules/textarea.php:137
913
  msgid "Name"
914
  msgstr ""
915
 
916
  #: contact-form-7/modules/acceptance.php:146
917
  #: contact-form-7/modules/acceptance.php:149
918
+ #: contact-form-7/modules/captcha.php:220
919
+ #: contact-form-7/modules/captcha.php:223
920
+ #: contact-form-7/modules/captcha.php:228
921
+ #: contact-form-7/modules/captcha.php:231
922
+ #: contact-form-7/modules/captcha.php:235
923
+ #: contact-form-7/modules/captcha.php:246
924
+ #: contact-form-7/modules/captcha.php:249
925
+ #: contact-form-7/modules/captcha.php:254
926
+ #: contact-form-7/modules/captcha.php:257
927
+ #: contact-form-7/modules/checkbox.php:300
928
+ #: contact-form-7/modules/checkbox.php:303 contact-form-7/modules/date.php:163
929
+ #: contact-form-7/modules/date.php:166 contact-form-7/modules/date.php:171
930
+ #: contact-form-7/modules/date.php:174 contact-form-7/modules/date.php:179
931
+ #: contact-form-7/modules/date.php:184 contact-form-7/modules/file.php:238
932
+ #: contact-form-7/modules/file.php:241 contact-form-7/modules/file.php:246
933
+ #: contact-form-7/modules/file.php:249 contact-form-7/modules/number.php:173
934
+ #: contact-form-7/modules/number.php:176 contact-form-7/modules/number.php:181
935
+ #: contact-form-7/modules/number.php:184 contact-form-7/modules/number.php:189
936
+ #: contact-form-7/modules/number.php:194 contact-form-7/modules/quiz.php:177
937
  #: contact-form-7/modules/quiz.php:180 contact-form-7/modules/quiz.php:185
938
+ #: contact-form-7/modules/quiz.php:188 contact-form-7/modules/select.php:176
939
+ #: contact-form-7/modules/select.php:179 contact-form-7/modules/submit.php:59
940
  #: contact-form-7/modules/submit.php:62 contact-form-7/modules/submit.php:67
941
  #: contact-form-7/modules/text.php:236 contact-form-7/modules/text.php:239
942
  #: contact-form-7/modules/text.php:244 contact-form-7/modules/text.php:247
943
  #: contact-form-7/modules/text.php:253 contact-form-7/modules/text.php:266
 
944
  #: contact-form-7/modules/textarea.php:142
945
+ #: contact-form-7/modules/textarea.php:145
946
  #: contact-form-7/modules/textarea.php:150
947
+ #: contact-form-7/modules/textarea.php:153
948
+ #: contact-form-7/modules/textarea.php:158
949
+ #: contact-form-7/modules/textarea.php:163
950
  msgid "optional"
951
  msgstr ""
952
 
963
  msgstr ""
964
 
965
  #: contact-form-7/modules/acceptance.php:162
966
+ #: contact-form-7/modules/captcha.php:262
967
+ #: contact-form-7/modules/checkbox.php:323 contact-form-7/modules/date.php:192
968
+ #: contact-form-7/modules/file.php:254 contact-form-7/modules/number.php:202
969
+ #: contact-form-7/modules/quiz.php:200 contact-form-7/modules/select.php:196
970
  #: contact-form-7/modules/submit.php:74 contact-form-7/modules/text.php:274
971
+ #: contact-form-7/modules/textarea.php:171
972
  msgid "Copy this code and paste it into the form left."
973
  msgstr ""
974
 
978
  "really-simple-captcha/\">Really Simple CAPTCHA</a> plugin installed."
979
  msgstr ""
980
 
981
+ #: contact-form-7/modules/captcha.php:185
982
  msgid "The code that sender entered does not match the CAPTCHA"
983
  msgstr ""
984
 
985
+ #: contact-form-7/modules/captcha.php:186
986
  msgid "Your entered code is incorrect."
987
  msgstr ""
988
 
989
+ #: contact-form-7/modules/captcha.php:199
990
  msgid "CAPTCHA"
991
  msgstr ""
992
 
993
+ #: contact-form-7/modules/captcha.php:210
994
  msgid "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed."
995
  msgstr ""
996
 
997
+ #: contact-form-7/modules/captcha.php:217
998
  msgid "Image settings"
999
  msgstr ""
1000
 
1001
+ #: contact-form-7/modules/captcha.php:228
1002
  msgid "Foreground color"
1003
  msgstr ""
1004
 
1005
+ #: contact-form-7/modules/captcha.php:231
1006
  msgid "Background color"
1007
  msgstr ""
1008
 
1009
+ #: contact-form-7/modules/captcha.php:235
1010
  msgid "Image size"
1011
  msgstr ""
1012
 
1013
+ #: contact-form-7/modules/captcha.php:236
1014
  msgid "Small"
1015
  msgstr ""
1016
 
1017
+ #: contact-form-7/modules/captcha.php:237
1018
  msgid "Medium"
1019
  msgstr ""
1020
 
1021
+ #: contact-form-7/modules/captcha.php:238
1022
  msgid "Large"
1023
  msgstr ""
1024
 
1025
+ #: contact-form-7/modules/captcha.php:243
1026
  msgid "Input field settings"
1027
  msgstr ""
1028
 
1029
+ #: contact-form-7/modules/captcha.php:263
1030
  msgid "For image"
1031
  msgstr ""
1032
 
1033
+ #: contact-form-7/modules/captcha.php:265
1034
  msgid "For input field"
1035
  msgstr ""
1036
 
1037
+ #: contact-form-7/modules/captcha.php:296
1038
  #, php-format
1039
  msgid ""
1040
  "This contact form contains CAPTCHA fields, but the temporary folder for the "
1042
  "change its permission manually."
1043
  msgstr ""
1044
 
1045
+ #: contact-form-7/modules/captcha.php:302
1046
  msgid ""
1047
  "This contact form contains CAPTCHA fields, but the necessary libraries (GD "
1048
  "and FreeType) are not available on your server."
1049
  msgstr ""
1050
 
1051
+ #: contact-form-7/modules/checkbox.php:268
1052
  msgid "Checkboxes"
1053
  msgstr ""
1054
 
1055
+ #: contact-form-7/modules/checkbox.php:271
1056
  msgid "Radio buttons"
1057
  msgstr ""
1058
 
1059
+ #: contact-form-7/modules/checkbox.php:292 contact-form-7/modules/date.php:157
1060
+ #: contact-form-7/modules/file.php:232 contact-form-7/modules/number.php:167
1061
+ #: contact-form-7/modules/select.php:170 contact-form-7/modules/text.php:230
1062
+ #: contact-form-7/modules/textarea.php:136
1063
  msgid "Required field?"
1064
  msgstr ""
1065
 
1066
+ #: contact-form-7/modules/checkbox.php:308
1067
+ #: contact-form-7/modules/select.php:184
1068
  msgid "Choices"
1069
  msgstr ""
1070
 
1071
+ #: contact-form-7/modules/checkbox.php:310
1072
+ #: contact-form-7/modules/select.php:186
1073
  msgid "* One choice per line."
1074
  msgstr ""
1075
 
1076
+ #: contact-form-7/modules/checkbox.php:314
1077
  msgid "Put a label first, a checkbox last?"
1078
  msgstr ""
1079
 
1080
+ #: contact-form-7/modules/checkbox.php:315
1081
  msgid "Wrap each item with <label> tag?"
1082
  msgstr ""
1083
 
1084
+ #: contact-form-7/modules/checkbox.php:317
1085
  msgid "Make checkboxes exclusive?"
1086
  msgstr ""
1087
 
1088
+ #: contact-form-7/modules/checkbox.php:325 contact-form-7/modules/date.php:194
1089
+ #: contact-form-7/modules/number.php:204 contact-form-7/modules/select.php:198
1090
+ #: contact-form-7/modules/text.php:276 contact-form-7/modules/textarea.php:173
1091
  msgid "And, put this code into the Mail fields below."
1092
  msgstr ""
1093
 
1094
+ #: contact-form-7/modules/date.php:117
1095
  msgid "Date format that the sender entered is invalid"
1096
  msgstr ""
1097
 
1098
+ #: contact-form-7/modules/date.php:118
1099
  msgid "Date format seems invalid."
1100
  msgstr ""
1101
 
1102
+ #: contact-form-7/modules/date.php:122
1103
  msgid "Date is earlier than minimum limit"
1104
  msgstr ""
1105
 
1106
+ #: contact-form-7/modules/date.php:123
1107
  msgid "This date is too early."
1108
  msgstr ""
1109
 
1110
+ #: contact-form-7/modules/date.php:127
1111
  msgid "Date is later than maximum limit"
1112
  msgstr ""
1113
 
1114
+ #: contact-form-7/modules/date.php:128
1115
  msgid "This date is too late."
1116
  msgstr ""
1117
 
1118
+ #: contact-form-7/modules/date.php:184 contact-form-7/modules/number.php:194
1119
+ #: contact-form-7/modules/text.php:266 contact-form-7/modules/textarea.php:163
1120
  msgid "Default value"
1121
  msgstr ""
1122
 
1123
+ #: contact-form-7/modules/date.php:187 contact-form-7/modules/number.php:197
1124
+ #: contact-form-7/modules/text.php:269 contact-form-7/modules/textarea.php:166
1125
  msgid "Use this text as placeholder?"
1126
  msgstr ""
1127
 
1128
+ #: contact-form-7/modules/file.php:193
1129
  msgid "Uploading a file fails for any reason"
1130
  msgstr ""
1131
 
1132
+ #: contact-form-7/modules/file.php:194
1133
  msgid "Failed to upload file."
1134
  msgstr ""
1135
 
1136
+ #: contact-form-7/modules/file.php:198
1137
  msgid "Uploaded file is not allowed file type"
1138
  msgstr ""
1139
 
1140
+ #: contact-form-7/modules/file.php:199
1141
  msgid "This file type is not allowed."
1142
  msgstr ""
1143
 
1144
+ #: contact-form-7/modules/file.php:203
1145
  msgid "Uploaded file is too large"
1146
  msgstr ""
1147
 
1148
+ #: contact-form-7/modules/file.php:204
1149
  msgid "This file is too large."
1150
  msgstr ""
1151
 
1152
+ #: contact-form-7/modules/file.php:208
1153
  msgid "Uploading a file fails for PHP error"
1154
  msgstr ""
1155
 
1156
+ #: contact-form-7/modules/file.php:209
1157
  msgid "Failed to upload file. Error occurred."
1158
  msgstr ""
1159
 
1160
+ #: contact-form-7/modules/file.php:223
1161
  msgid "File upload"
1162
  msgstr ""
1163
 
1164
+ #: contact-form-7/modules/file.php:246
1165
  msgid "File size limit"
1166
  msgstr ""
1167
 
1168
+ #: contact-form-7/modules/file.php:246
1169
  msgid "bytes"
1170
  msgstr ""
1171
 
1172
+ #: contact-form-7/modules/file.php:249
1173
  msgid "Acceptable file types"
1174
  msgstr ""
1175
 
1176
+ #: contact-form-7/modules/file.php:256
1177
  msgid "And, put this code into the File Attachments field below."
1178
  msgstr ""
1179
 
1180
+ #: contact-form-7/modules/file.php:282
1181
  #, php-format
1182
  msgid ""
1183
  "This contact form contains file uploading fields, but the temporary folder "
1192
  "strong> <a href=\"%s\" target=\"_blank\">See how to avoid it.</a>"
1193
  msgstr ""
1194
 
1195
+ #: contact-form-7/modules/number.php:120
1196
  msgid "Number format that the sender entered is invalid"
1197
  msgstr ""
1198
 
1199
+ #: contact-form-7/modules/number.php:121
1200
  msgid "Number format seems invalid."
1201
  msgstr ""
1202
 
1203
+ #: contact-form-7/modules/number.php:125
1204
  msgid "Number is smaller than minimum limit"
1205
  msgstr ""
1206
 
1207
+ #: contact-form-7/modules/number.php:126
1208
  msgid "This number is too small."
1209
  msgstr ""
1210
 
1211
+ #: contact-form-7/modules/number.php:130
1212
  msgid "Number is larger than maximum limit"
1213
  msgstr ""
1214
 
1215
+ #: contact-form-7/modules/number.php:131
1216
  msgid "This number is too large."
1217
  msgstr ""
1218
 
1219
+ #: contact-form-7/modules/number.php:144
1220
  msgid "Number (spinbox)"
1221
  msgstr ""
1222
 
1223
+ #: contact-form-7/modules/number.php:147
1224
  msgid "Number (slider)"
1225
  msgstr ""
1226
 
1244
  msgid "* quiz|answer (e.g. 1+1=?|2)"
1245
  msgstr ""
1246
 
1247
+ #: contact-form-7/modules/select.php:161
1248
  msgid "Drop-down menu"
1249
  msgstr ""
1250
 
1251
+ #: contact-form-7/modules/select.php:190
1252
  msgid "Allow multiple selections?"
1253
  msgstr ""
1254
 
1255
+ #: contact-form-7/modules/select.php:191
1256
  msgid "Insert a blank item as the first option?"
1257
  msgstr ""
1258
 
1320
  msgid "This field requires author's URL"
1321
  msgstr ""
1322
 
1323
+ #: contact-form-7/modules/textarea.php:127
1324
  msgid "Text area"
1325
  msgstr ""
1326
 
modules/akismet.php CHANGED
@@ -7,42 +7,38 @@
7
  add_filter( 'wpcf7_spam', 'wpcf7_akismet' );
8
 
9
  function wpcf7_akismet( $spam ) {
10
- if ( $spam )
11
  return $spam;
 
12
 
13
  if ( ! wpcf7_akismet_is_available() ) {
14
  return false;
15
  }
16
 
17
- if ( ! $params = wpcf7_akismet_submitted_params() )
18
  return false;
 
19
 
20
  $c = array();
21
 
22
- if ( ! empty( $params['author'] ) )
23
- $c['comment_author'] = $params['author'];
24
-
25
- if ( ! empty( $params['author_email'] ) )
26
- $c['comment_author_email'] = $params['author_email'];
27
-
28
- if ( ! empty( $params['author_url'] ) )
29
- $c['comment_author_url'] = $params['author_url'];
30
-
31
- if ( ! empty( $params['content'] ) )
32
- $c['comment_content'] = $params['content'];
33
 
34
  $c['blog'] = get_option( 'home' );
35
  $c['blog_lang'] = get_locale();
36
  $c['blog_charset'] = get_option( 'blog_charset' );
37
- $c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
38
  $c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
39
  $c['referrer'] = $_SERVER['HTTP_REFERER'];
40
 
41
  // http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
42
  $c['comment_type'] = 'contact-form';
43
 
44
- if ( $permalink = get_permalink() )
45
  $c['permalink'] = $permalink;
 
46
 
47
  $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
48
 
@@ -70,46 +66,52 @@ function wpcf7_akismet_submitted_params() {
70
  $params = array(
71
  'author' => '',
72
  'author_email' => '',
73
- 'author_url' => '' );
74
-
75
- $content = '';
76
 
77
- $fes = wpcf7_scan_shortcode();
78
 
79
- foreach ( $fes as $fe ) {
80
- if ( ! isset( $fe['name'] ) || ! isset( $_POST[$fe['name']] ) )
81
  continue;
 
82
 
83
- $value = $_POST[$fe['name']];
 
 
84
 
85
- if ( is_array( $value ) )
86
- $value = implode( ', ', wpcf7_array_flatten( $value ) );
87
 
88
- $value = trim( $value );
 
 
89
 
90
- $options = (array) $fe['options'];
 
 
91
 
92
- if ( preg_grep( '%^akismet:author$%', $options ) ) {
93
- $params['author'] = trim( $params['author'] . ' ' . $value );
94
 
95
- } elseif ( preg_grep( '%^akismet:author_email$%', $options ) ) {
96
- if ( '' == $params['author_email'] )
97
- $params['author_email'] = $value;
98
 
99
- } elseif ( preg_grep( '%^akismet:author_url$%', $options ) ) {
100
- if ( '' == $params['author_url'] )
101
- $params['author_url'] = $value;
 
 
 
102
  }
103
 
104
- $content = trim( $content . "\n\n" . $value );
105
  }
106
 
107
- $params = array_filter( $params );
108
-
109
- if ( ! $params )
110
  return false;
 
111
 
112
- $params['content'] = $content;
113
 
114
  return $params;
115
  }
7
  add_filter( 'wpcf7_spam', 'wpcf7_akismet' );
8
 
9
  function wpcf7_akismet( $spam ) {
10
+ if ( $spam ) {
11
  return $spam;
12
+ }
13
 
14
  if ( ! wpcf7_akismet_is_available() ) {
15
  return false;
16
  }
17
 
18
+ if ( ! $params = wpcf7_akismet_submitted_params() ) {
19
  return false;
20
+ }
21
 
22
  $c = array();
23
 
24
+ $c['comment_author'] = $params['author'];
25
+ $c['comment_author_email'] = $params['author_email'];
26
+ $c['comment_author_url'] = $params['author_url'];
27
+ $c['comment_content'] = $params['content'];
 
 
 
 
 
 
 
28
 
29
  $c['blog'] = get_option( 'home' );
30
  $c['blog_lang'] = get_locale();
31
  $c['blog_charset'] = get_option( 'blog_charset' );
32
+ $c['user_ip'] = $_SERVER['REMOTE_ADDR'];
33
  $c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
34
  $c['referrer'] = $_SERVER['HTTP_REFERER'];
35
 
36
  // http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
37
  $c['comment_type'] = 'contact-form';
38
 
39
+ if ( $permalink = get_permalink() ) {
40
  $c['permalink'] = $permalink;
41
+ }
42
 
43
  $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
44
 
66
  $params = array(
67
  'author' => '',
68
  'author_email' => '',
69
+ 'author_url' => '',
70
+ 'content' => '' );
 
71
 
72
+ $has_akismet_option = false;
73
 
74
+ foreach ( (array) $_POST as $key => $val ) {
75
+ if ( '_wpcf7' == substr( $key, 0, 6 ) || '_wpnonce' == $key ) {
76
  continue;
77
+ }
78
 
79
+ if ( is_array( $val ) ) {
80
+ $val = implode( ', ', wpcf7_array_flatten( $val ) );
81
+ }
82
 
83
+ $val = trim( $val );
 
84
 
85
+ if ( 0 == strlen( $val ) ) {
86
+ continue;
87
+ }
88
 
89
+ if ( $tags = wpcf7_scan_shortcode( array( 'name' => $key ) ) ) {
90
+ $tag = $tags[0];
91
+ $tag = new WPCF7_Shortcode( $tag );
92
 
93
+ $akismet = $tag->get_option( 'akismet',
94
+ '(author|author_email|author_url)', true );
95
 
96
+ if ( $akismet ) {
97
+ $has_akismet_option = true;
 
98
 
99
+ if ( 'author' == $akismet ) {
100
+ $params[$akismet] = trim( $params[$akismet] . ' ' . $val );
101
+ } elseif ( '' == $params[$akismet] ) {
102
+ $params[$akismet] = $val;
103
+ }
104
+ }
105
  }
106
 
107
+ $params['content'] .= "\n\n" . $val;
108
  }
109
 
110
+ if ( ! $has_akismet_option ) {
 
 
111
  return false;
112
+ }
113
 
114
+ $params['content'] = trim( $params['content'] );
115
 
116
  return $params;
117
  }
modules/captcha.php CHANGED
@@ -125,6 +125,7 @@ function wpcf7_captcha_validation_filter( $result, $tag ) {
125
 
126
  $prefix = isset( $_POST[$captchac] ) ? (string) $_POST[$captchac] : '';
127
  $response = isset( $_POST[$name] ) ? (string) $_POST[$name] : '';
 
128
 
129
  if ( 0 == strlen( $prefix ) || ! wpcf7_check_captcha( $prefix, $response ) ) {
130
  $result->invalidate( $tag, wpcf7_get_message( 'captcha_not_match' ) );
125
 
126
  $prefix = isset( $_POST[$captchac] ) ? (string) $_POST[$captchac] : '';
127
  $response = isset( $_POST[$name] ) ? (string) $_POST[$name] : '';
128
+ $response = wpcf7_canonicalize( $response );
129
 
130
  if ( 0 == strlen( $prefix ) || ! wpcf7_check_captcha( $prefix, $response ) ) {
131
  $result->invalidate( $tag, wpcf7_get_message( 'captcha_not_match' ) );
modules/checkbox.php CHANGED
@@ -49,11 +49,6 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
49
  if ( false !== $tabindex )
50
  $tabindex = absint( $tabindex );
51
 
52
- $defaults = array();
53
-
54
- if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) )
55
- $defaults = explode( '_', $matches[1] );
56
-
57
  $html = '';
58
  $count = 0;
59
 
@@ -76,6 +71,24 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
76
  }
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  $hangover = wpcf7_get_hangover( $tag->name, $multiple ? array() : '' );
80
 
81
  foreach ( $values as $key => $value ) {
49
  if ( false !== $tabindex )
50
  $tabindex = absint( $tabindex );
51
 
 
 
 
 
 
52
  $html = '';
53
  $count = 0;
54
 
71
  }
72
  }
73
 
74
+ $defaults = array();
75
+
76
+ $default_choice = $tag->get_default_option( null, 'multiple=1' );
77
+
78
+ foreach ( $default_choice as $value ) {
79
+ $key = array_search( $value, $values, true );
80
+
81
+ if ( false !== $key ) {
82
+ $defaults[] = (int) $key + 1;
83
+ }
84
+ }
85
+
86
+ if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) ) {
87
+ $defaults = array_merge( $defaults, explode( '_', $matches[1] ) );
88
+ }
89
+
90
+ $defaults = array_unique( $defaults );
91
+
92
  $hangover = wpcf7_get_hangover( $tag->name, $multiple ? array() : '' );
93
 
94
  foreach ( $values as $key => $value ) {
modules/date.php CHANGED
@@ -52,6 +52,8 @@ function wpcf7_date_shortcode_handler( $tag ) {
52
  $value = '';
53
  }
54
 
 
 
55
  $value = wpcf7_get_hangover( $tag->name, $value );
56
 
57
  $atts['value'] = $value;
52
  $value = '';
53
  }
54
 
55
+ $value = $tag->get_default_option( $value );
56
+
57
  $value = wpcf7_get_hangover( $tag->name, $value );
58
 
59
  $atts['value'] = $value;
modules/file.php CHANGED
@@ -160,6 +160,8 @@ function wpcf7_file_validation_filter( $result, $tag ) {
160
  $uploads_dir = wpcf7_maybe_add_random_dir( $uploads_dir );
161
 
162
  $filename = $file['name'];
 
 
163
  $filename = wpcf7_antiscript_file_name( $filename );
164
  $filename = wp_unique_filename( $uploads_dir, $filename );
165
 
160
  $uploads_dir = wpcf7_maybe_add_random_dir( $uploads_dir );
161
 
162
  $filename = $file['name'];
163
+ $filename = wpcf7_canonicalize( $filename );
164
+ $filename = sanitize_file_name( $filename );
165
  $filename = wpcf7_antiscript_file_name( $filename );
166
  $filename = wp_unique_filename( $uploads_dir, $filename );
167
 
modules/number.php CHANGED
@@ -53,6 +53,8 @@ function wpcf7_number_shortcode_handler( $tag ) {
53
  $value = '';
54
  }
55
 
 
 
56
  $value = wpcf7_get_hangover( $tag->name, $value );
57
 
58
  $atts['value'] = $value;
53
  $value = '';
54
  }
55
 
56
+ $value = $tag->get_default_option( $value );
57
+
58
  $value = wpcf7_get_hangover( $tag->name, $value );
59
 
60
  $atts['value'] = $value;
modules/select.php CHANGED
@@ -36,11 +36,6 @@ function wpcf7_select_shortcode_handler( $tag ) {
36
 
37
  $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
38
 
39
- $defaults = array();
40
-
41
- if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) )
42
- $defaults = explode( '_', $matches[1] );
43
-
44
  $multiple = $tag->has_option( 'multiple' );
45
  $include_blank = $tag->has_option( 'include_blank' );
46
  $first_as_label = $tag->has_option( 'first_as_label' );
@@ -53,11 +48,30 @@ function wpcf7_select_shortcode_handler( $tag ) {
53
  $labels = array_merge( $labels, array_values( $data ) );
54
  }
55
 
56
- $empty_select = empty( $values );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
- if ( $empty_select || $include_blank ) {
 
 
 
 
59
  array_unshift( $labels, '---' );
60
  array_unshift( $values, '' );
 
61
  } elseif ( $first_as_label ) {
62
  $values[0] = '';
63
  }
@@ -75,7 +89,9 @@ function wpcf7_select_shortcode_handler( $tag ) {
75
  $selected = ( $hangover == esc_sql( $value ) );
76
  }
77
  } else {
78
- if ( ! $empty_select && in_array( $key + 1, (array) $defaults ) ) {
 
 
79
  $selected = true;
80
  }
81
  }
36
 
37
  $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
38
 
 
 
 
 
 
39
  $multiple = $tag->has_option( 'multiple' );
40
  $include_blank = $tag->has_option( 'include_blank' );
41
  $first_as_label = $tag->has_option( 'first_as_label' );
48
  $labels = array_merge( $labels, array_values( $data ) );
49
  }
50
 
51
+ $defaults = array();
52
+
53
+ $default_choice = $tag->get_default_option( null, 'multiple=1' );
54
+
55
+ foreach ( $default_choice as $value ) {
56
+ $key = array_search( $value, $values, true );
57
+
58
+ if ( false !== $key ) {
59
+ $defaults[] = (int) $key + 1;
60
+ }
61
+ }
62
+
63
+ if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) ) {
64
+ $defaults = array_merge( $defaults, explode( '_', $matches[1] ) );
65
+ }
66
 
67
+ $defaults = array_unique( $defaults );
68
+
69
+ $shifted = false;
70
+
71
+ if ( $include_blank || empty( $values ) ) {
72
  array_unshift( $labels, '---' );
73
  array_unshift( $values, '' );
74
+ $shifted = true;
75
  } elseif ( $first_as_label ) {
76
  $values[0] = '';
77
  }
89
  $selected = ( $hangover == esc_sql( $value ) );
90
  }
91
  } else {
92
+ if ( ! $shifted && in_array( (int) $key + 1, (array) $defaults ) ) {
93
+ $selected = true;
94
+ } elseif ( $shifted && in_array( (int) $key, (array) $defaults ) ) {
95
  $selected = true;
96
  }
97
  }
modules/text.php CHANGED
@@ -60,10 +60,10 @@ function wpcf7_text_shortcode_handler( $tag ) {
60
  if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
61
  $atts['placeholder'] = $value;
62
  $value = '';
63
- } elseif ( '' === $value ) {
64
- $value = $tag->get_default_option();
65
  }
66
 
 
 
67
  $value = wpcf7_get_hangover( $tag->name, $value );
68
 
69
  $atts['value'] = $value;
60
  if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
61
  $atts['placeholder'] = $value;
62
  $value = '';
 
 
63
  }
64
 
65
+ $value = $tag->get_default_option( $value );
66
+
67
  $value = wpcf7_get_hangover( $tag->name, $value );
68
 
69
  $atts['value'] = $value;
modules/textarea.php CHANGED
@@ -40,24 +40,27 @@ function wpcf7_textarea_shortcode_handler( $tag ) {
40
  $atts['id'] = $tag->get_id_option();
41
  $atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
42
 
43
- if ( $tag->has_option( 'readonly' ) )
44
  $atts['readonly'] = 'readonly';
 
45
 
46
- if ( $tag->is_required() )
47
  $atts['aria-required'] = 'true';
 
48
 
49
  $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
50
 
51
- $value = (string) reset( $tag->values );
52
-
53
- if ( '' !== $tag->content )
54
- $value = $tag->content;
55
 
56
  if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
57
  $atts['placeholder'] = $value;
58
  $value = '';
59
  }
60
 
 
 
61
  $value = wpcf7_get_hangover( $tag->name, $value );
62
 
63
  $atts['name'] = $tag->name;
40
  $atts['id'] = $tag->get_id_option();
41
  $atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
42
 
43
+ if ( $tag->has_option( 'readonly' ) ) {
44
  $atts['readonly'] = 'readonly';
45
+ }
46
 
47
+ if ( $tag->is_required() ) {
48
  $atts['aria-required'] = 'true';
49
+ }
50
 
51
  $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
52
 
53
+ $value = empty( $tag->content )
54
+ ? (string) reset( $tag->values )
55
+ : $tag->content;
 
56
 
57
  if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
58
  $atts['placeholder'] = $value;
59
  $value = '';
60
  }
61
 
62
+ $value = $tag->get_default_option( $value );
63
+
64
  $value = wpcf7_get_hangover( $tag->name, $value );
65
 
66
  $atts['name'] = $tag->name;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://contactform7.com/donate/
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 4.0
6
  Tested up to: 4.1
7
- Stable tag: 4.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -60,7 +60,7 @@ The following are other recommended plugins by the author of Contact Form 7.
60
  * Greek (el) - Nick Mouratidis, Pr. friedlich, John D. Dimoferlias
61
  * Gujarati (gu_IN) - Apoto
62
  * Haitian (ht) - Lam Tu Do
63
- * Hebrew (he_IL) - Yaron Ofer, Arik Galansky
64
  * Hindi (hi_IN) - Tarun Joshi, Ashish
65
  * Hungarian (hu_HU) - Andras Hirschler, János Csárdi-Braunstein, Farkas Győző
66
  * Indian Bengali (bn_IN) - Suman Manna
@@ -125,6 +125,16 @@ Do you have questions or issues with Contact Form 7? Use these support channels
125
 
126
  For more information, see [Releases](http://contactform7.com/category/releases/).
127
 
 
 
 
 
 
 
 
 
 
 
128
  = 4.0.3 =
129
 
130
  * The contextual help tab has been added to admin pages.
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 4.0
6
  Tested up to: 4.1
7
+ Stable tag: 4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
60
  * Greek (el) - Nick Mouratidis, Pr. friedlich, John D. Dimoferlias
61
  * Gujarati (gu_IN) - Apoto
62
  * Haitian (ht) - Lam Tu Do
63
+ * Hebrew (he_IL) - Yaron Ofer, Arik Galansky, Ahrale
64
  * Hindi (hi_IN) - Tarun Joshi, Ashish
65
  * Hungarian (hu_HU) - Andras Hirschler, János Csárdi-Braunstein, Farkas Győző
66
  * Indian Bengali (bn_IN) - Suman Manna
125
 
126
  For more information, see [Releases](http://contactform7.com/category/releases/).
127
 
128
+ = 4.1 =
129
+
130
+ * Added maxlength and minlength options to several form-tag types.
131
+ * Added [count] form-tag type that represents character count for form fields.
132
+ * Introduced WPCF7_Validation class to handle the user-input validation process.
133
+ * Added the front-end URL normalization for [url] fields.
134
+ * Added default:get, default:post and default:post_meta options to get default values from the context.
135
+ * Translations for Turkish, German, Portuguese, Dutch, and Hebrew have been updated.
136
+ * WordPress 4.0 or higher is required.
137
+
138
  = 4.0.3 =
139
 
140
  * The contextual help tab has been added to admin pages.
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: 4.1-beta
11
  */
12
 
13
  /* Copyright 2007-2015 Takayuki Miyoshi (email: takayukister at gmail.com)
@@ -27,7 +27,7 @@ Version: 4.1-beta
27
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
  */
29
 
30
- define( 'WPCF7_VERSION', '4.1-beta' );
31
 
32
  define( 'WPCF7_REQUIRED_WP_VERSION', '4.0' );
33
 
7
  Author URI: http://ideasilo.wordpress.com/
8
  Text Domain: contact-form-7
9
  Domain Path: /languages/
10
+ Version: 4.1
11
  */
12
 
13
  /* Copyright 2007-2015 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', '4.1' );
31
 
32
  define( 'WPCF7_REQUIRED_WP_VERSION', '4.0' );
33