Version Description
- CSS: Applies the "not-allowed" cursor style to submit buttons in the "disabled" state.
- Acceptance Checkbox: Revises the tag-generator UI to encourage the use of better options in terms of personal data protection.
- Introduces wpcf7_anonymize_ip_addr() function.
- Introduces the consent_for:storage option for all types of form-tags.
Download this release
Release Info
Developer | takayukister |
Plugin | ![]() |
Version | 5.0.3 |
Comparing to | |
See all releases |
Code changes from version 5.0.2 to 5.0.3
- admin/edit-contact-form.php +13 -2
- includes/css/styles.css +4 -0
- includes/form-tag.php +19 -1
- includes/functions.php +22 -0
- includes/submission.php +11 -2
- modules/acceptance.php +1 -2
- modules/checkbox.php +6 -27
- modules/flamingo.php +5 -2
- modules/select.php +6 -32
- readme.txt +8 -1
- wp-contact-form-7.php +2 -2
admin/edit-contact-form.php
CHANGED
@@ -187,12 +187,23 @@ if ( $post ) :
|
|
187 |
__( 'https://wordpress.org/support/plugin/contact-form-7/', 'contact-form-7' ),
|
188 |
__( 'Support Forums', 'contact-form-7' )
|
189 |
); ?></li>
|
190 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
<li><?php echo wpcf7_link(
|
192 |
__( 'https://contactform7.com/custom-development/', 'contact-form-7' ),
|
193 |
__( 'Professional Services', 'contact-form-7' )
|
194 |
); ?></li>
|
195 |
-
<?php
|
|
|
|
|
196 |
</ol>
|
197 |
</div>
|
198 |
</div><!-- #informationdiv -->
|
187 |
__( 'https://wordpress.org/support/plugin/contact-form-7/', 'contact-form-7' ),
|
188 |
__( 'Support Forums', 'contact-form-7' )
|
189 |
); ?></li>
|
190 |
+
<?php
|
191 |
+
$pro_service_langs = array(
|
192 |
+
'en', // English
|
193 |
+
'de', // German
|
194 |
+
'fr', // French
|
195 |
+
'es', // Spanish
|
196 |
+
);
|
197 |
+
|
198 |
+
if ( in_array( substr( get_user_locale(), 0, 2 ), $pro_service_langs ) ) :
|
199 |
+
?>
|
200 |
<li><?php echo wpcf7_link(
|
201 |
__( 'https://contactform7.com/custom-development/', 'contact-form-7' ),
|
202 |
__( 'Professional Services', 'contact-form-7' )
|
203 |
); ?></li>
|
204 |
+
<?php
|
205 |
+
endif;
|
206 |
+
?>
|
207 |
</ol>
|
208 |
</div>
|
209 |
</div><!-- #informationdiv -->
|
includes/css/styles.css
CHANGED
@@ -108,3 +108,7 @@ div.wpcf7 input[type="file"] {
|
|
108 |
div.wpcf7 input[type="file"]:disabled {
|
109 |
cursor: default;
|
110 |
}
|
|
|
|
|
|
|
|
108 |
div.wpcf7 input[type="file"]:disabled {
|
109 |
cursor: default;
|
110 |
}
|
111 |
+
|
112 |
+
div.wpcf7 .wpcf7-submit:disabled {
|
113 |
+
cursor: not-allowed;
|
114 |
+
}
|
includes/form-tag.php
CHANGED
@@ -204,7 +204,9 @@ class WPCF7_FormTag implements ArrayAccess {
|
|
204 |
|
205 |
public function get_default_option( $default = '', $args = '' ) {
|
206 |
$args = wp_parse_args( $args, array(
|
207 |
-
'multiple' => false
|
|
|
|
|
208 |
|
209 |
$options = (array) $this->get_option( 'default' );
|
210 |
$values = array();
|
@@ -283,6 +285,22 @@ class WPCF7_FormTag implements ArrayAccess {
|
|
283 |
}
|
284 |
}
|
285 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
}
|
287 |
}
|
288 |
|
204 |
|
205 |
public function get_default_option( $default = '', $args = '' ) {
|
206 |
$args = wp_parse_args( $args, array(
|
207 |
+
'multiple' => false,
|
208 |
+
'shifted' => false,
|
209 |
+
) );
|
210 |
|
211 |
$options = (array) $this->get_option( 'default' );
|
212 |
$values = array();
|
285 |
}
|
286 |
}
|
287 |
}
|
288 |
+
|
289 |
+
} elseif ( preg_match( '/^[0-9_]+$/', $opt ) ) {
|
290 |
+
$nums = explode( '_', $opt );
|
291 |
+
|
292 |
+
foreach ( $nums as $num ) {
|
293 |
+
$num = absint( $num );
|
294 |
+
$num = $args['shifted'] ? $num : $num - 1;
|
295 |
+
|
296 |
+
if ( isset( $this->values[$num] ) ) {
|
297 |
+
if ( $args['multiple'] ) {
|
298 |
+
$values[] = $this->values[$num];
|
299 |
+
} else {
|
300 |
+
return $this->values[$num];
|
301 |
+
}
|
302 |
+
}
|
303 |
+
}
|
304 |
}
|
305 |
}
|
306 |
|
includes/functions.php
CHANGED
@@ -368,3 +368,25 @@ function wpcf7_deprecated_function( $function, $version, $replacement ) {
|
|
368 |
}
|
369 |
}
|
370 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
}
|
369 |
}
|
370 |
}
|
371 |
+
|
372 |
+
function wpcf7_anonymize_ip_addr( $ip_addr ) {
|
373 |
+
if ( ! function_exists( 'inet_ntop' ) || ! function_exists( 'inet_pton' ) ) {
|
374 |
+
return $ip_addr;
|
375 |
+
}
|
376 |
+
|
377 |
+
$packed = inet_pton( $ip_addr );
|
378 |
+
|
379 |
+
if ( false === $packed ) {
|
380 |
+
return $ip_addr;
|
381 |
+
}
|
382 |
+
|
383 |
+
if ( 4 == strlen( $packed ) ) { // IPv4
|
384 |
+
$mask = '255.255.255.0';
|
385 |
+
} elseif ( 16 == strlen( $packed ) ) { // IPv6
|
386 |
+
$mask = 'ffff:ffff:ffff:0000:0000:0000:0000:0000';
|
387 |
+
} else {
|
388 |
+
return $ip_addr;
|
389 |
+
}
|
390 |
+
|
391 |
+
return inet_ntop( $packed & inet_pton( $mask ) );
|
392 |
+
}
|
includes/submission.php
CHANGED
@@ -136,6 +136,11 @@ class WPCF7_Submission {
|
|
136 |
$value_orig, $tag );
|
137 |
|
138 |
$posted_data[$name] = $value;
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
$this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data );
|
@@ -159,7 +164,7 @@ class WPCF7_Submission {
|
|
159 |
return $this->status;
|
160 |
}
|
161 |
|
162 |
-
$this->meta = array(
|
163 |
'remote_ip' => $this->get_remote_ip_addr(),
|
164 |
'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] )
|
165 |
? substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ) : '',
|
@@ -170,10 +175,14 @@ class WPCF7_Submission {
|
|
170 |
'container_post_id' => isset( $_POST['_wpcf7_container_post'] )
|
171 |
? (int) $_POST['_wpcf7_container_post'] : 0,
|
172 |
'current_user_id' => get_current_user_id(),
|
173 |
-
);
|
174 |
|
175 |
$contact_form = $this->contact_form;
|
176 |
|
|
|
|
|
|
|
|
|
177 |
if ( ! $this->validate() ) { // Validation error occured
|
178 |
$this->set_status( 'validation_failed' );
|
179 |
$this->set_response( $contact_form->message( 'validation_error' ) );
|
136 |
$value_orig, $tag );
|
137 |
|
138 |
$posted_data[$name] = $value;
|
139 |
+
|
140 |
+
if ( $tag->has_option( 'consent_for:storage' )
|
141 |
+
&& empty( $posted_data[$name] ) ) {
|
142 |
+
$this->meta['do_not_store'] = true;
|
143 |
+
}
|
144 |
}
|
145 |
|
146 |
$this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data );
|
164 |
return $this->status;
|
165 |
}
|
166 |
|
167 |
+
$this->meta = array_merge( $this->meta, array(
|
168 |
'remote_ip' => $this->get_remote_ip_addr(),
|
169 |
'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] )
|
170 |
? substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ) : '',
|
175 |
'container_post_id' => isset( $_POST['_wpcf7_container_post'] )
|
176 |
? (int) $_POST['_wpcf7_container_post'] : 0,
|
177 |
'current_user_id' => get_current_user_id(),
|
178 |
+
) );
|
179 |
|
180 |
$contact_form = $this->contact_form;
|
181 |
|
182 |
+
if ( $contact_form->is_true( 'do_not_store' ) ) {
|
183 |
+
$this->meta['do_not_store'] = true;
|
184 |
+
}
|
185 |
+
|
186 |
if ( ! $this->validate() ) { // Validation error occured
|
187 |
$this->set_status( 'validation_failed' );
|
188 |
$this->set_response( $contact_form->message( 'validation_error' ) );
|
modules/acceptance.php
CHANGED
@@ -249,8 +249,7 @@ function wpcf7_tag_generator_acceptance( $contact_form, $args = '' ) {
|
|
249 |
<td>
|
250 |
<fieldset>
|
251 |
<legend class="screen-reader-text"><?php echo esc_html( __( 'Options', 'contact-form-7' ) ); ?></legend>
|
252 |
-
<label><input type="checkbox" name="
|
253 |
-
<label><input type="checkbox" name="invert" class="option" /> <?php echo esc_html( __( 'Make this work inversely', 'contact-form-7' ) ); ?></label>
|
254 |
</fieldset>
|
255 |
</td>
|
256 |
</tr>
|
249 |
<td>
|
250 |
<fieldset>
|
251 |
<legend class="screen-reader-text"><?php echo esc_html( __( 'Options', 'contact-form-7' ) ); ?></legend>
|
252 |
+
<label><input type="checkbox" name="optional" class="option" checked="checked" /> <?php echo esc_html( __( 'Make this checkbox optional', 'contact-form-7' ) ); ?></label>
|
|
|
253 |
</fieldset>
|
254 |
</td>
|
255 |
</tr>
|
modules/checkbox.php
CHANGED
@@ -80,39 +80,17 @@ function wpcf7_checkbox_form_tag_handler( $tag ) {
|
|
80 |
}
|
81 |
}
|
82 |
|
83 |
-
$
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
foreach ( $default_choice as $value ) {
|
88 |
-
$key = array_search( $value, $values, true );
|
89 |
-
|
90 |
-
if ( false !== $key ) {
|
91 |
-
$defaults[] = (int) $key + 1;
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) ) {
|
96 |
-
$defaults = array_merge( $defaults, explode( '_', $matches[1] ) );
|
97 |
-
}
|
98 |
-
|
99 |
-
$defaults = array_unique( $defaults );
|
100 |
|
101 |
$hangover = wpcf7_get_hangover( $tag->name, $multiple ? array() : '' );
|
102 |
|
103 |
foreach ( $values as $key => $value ) {
|
104 |
-
$class = 'wpcf7-list-item';
|
105 |
-
|
106 |
-
$checked = false;
|
107 |
-
|
108 |
if ( $hangover ) {
|
109 |
-
|
110 |
-
$checked = in_array( $value, (array) $hangover, true );
|
111 |
-
} else {
|
112 |
-
$checked = ( $hangover === $value );
|
113 |
-
}
|
114 |
} else {
|
115 |
-
$checked = in_array( $
|
116 |
}
|
117 |
|
118 |
if ( isset( $labels[$key] ) ) {
|
@@ -149,6 +127,7 @@ function wpcf7_checkbox_form_tag_handler( $tag ) {
|
|
149 |
$tabindex += 1;
|
150 |
}
|
151 |
|
|
|
152 |
$count += 1;
|
153 |
|
154 |
if ( 1 == $count ) {
|
80 |
}
|
81 |
}
|
82 |
|
83 |
+
$default_choice = $tag->get_default_option( null, array(
|
84 |
+
'multiple' => $multiple,
|
85 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
$hangover = wpcf7_get_hangover( $tag->name, $multiple ? array() : '' );
|
88 |
|
89 |
foreach ( $values as $key => $value ) {
|
|
|
|
|
|
|
|
|
90 |
if ( $hangover ) {
|
91 |
+
$checked = in_array( $value, (array) $hangover, true );
|
|
|
|
|
|
|
|
|
92 |
} else {
|
93 |
+
$checked = in_array( $value, (array) $default_choice, true );
|
94 |
}
|
95 |
|
96 |
if ( isset( $labels[$key] ) ) {
|
127 |
$tabindex += 1;
|
128 |
}
|
129 |
|
130 |
+
$class = 'wpcf7-list-item';
|
131 |
$count += 1;
|
132 |
|
133 |
if ( 1 == $count ) {
|
modules/flamingo.php
CHANGED
@@ -12,8 +12,7 @@ function wpcf7_flamingo_submit( $contact_form, $result ) {
|
|
12 |
return;
|
13 |
}
|
14 |
|
15 |
-
if ( $contact_form->in_demo_mode()
|
16 |
-
|| $contact_form->is_true( 'do_not_store' ) ) {
|
17 |
return;
|
18 |
}
|
19 |
|
@@ -31,6 +30,10 @@ function wpcf7_flamingo_submit( $contact_form, $result ) {
|
|
31 |
return;
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
34 |
$fields_senseless =
|
35 |
$contact_form->scan_form_tags( array( 'feature' => 'do-not-store' ) );
|
36 |
|
12 |
return;
|
13 |
}
|
14 |
|
15 |
+
if ( $contact_form->in_demo_mode() ) {
|
|
|
16 |
return;
|
17 |
}
|
18 |
|
30 |
return;
|
31 |
}
|
32 |
|
33 |
+
if ( $submission->get_meta( 'do_not_store' ) ) {
|
34 |
+
return;
|
35 |
+
}
|
36 |
+
|
37 |
$fields_senseless =
|
38 |
$contact_form->scan_form_tags( array( 'feature' => 'do-not-store' ) );
|
39 |
|
modules/select.php
CHANGED
@@ -66,30 +66,14 @@ function wpcf7_select_form_tag_handler( $tag ) {
|
|
66 |
$labels = array_merge( $labels, array_values( $data ) );
|
67 |
}
|
68 |
|
69 |
-
$
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
foreach ( $default_choice as $value ) {
|
74 |
-
$key = array_search( $value, $values, true );
|
75 |
-
|
76 |
-
if ( false !== $key ) {
|
77 |
-
$defaults[] = (int) $key + 1;
|
78 |
-
}
|
79 |
-
}
|
80 |
-
|
81 |
-
if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) ) {
|
82 |
-
$defaults = array_merge( $defaults, explode( '_', $matches[1] ) );
|
83 |
-
}
|
84 |
-
|
85 |
-
$defaults = array_unique( $defaults );
|
86 |
-
|
87 |
-
$shifted = false;
|
88 |
|
89 |
if ( $include_blank || empty( $values ) ) {
|
90 |
array_unshift( $labels, '---' );
|
91 |
array_unshift( $values, '' );
|
92 |
-
$shifted = true;
|
93 |
} elseif ( $first_as_label ) {
|
94 |
$values[0] = '';
|
95 |
}
|
@@ -98,20 +82,10 @@ function wpcf7_select_form_tag_handler( $tag ) {
|
|
98 |
$hangover = wpcf7_get_hangover( $tag->name );
|
99 |
|
100 |
foreach ( $values as $key => $value ) {
|
101 |
-
$selected = false;
|
102 |
-
|
103 |
if ( $hangover ) {
|
104 |
-
|
105 |
-
$selected = in_array( $value, (array) $hangover, true );
|
106 |
-
} else {
|
107 |
-
$selected = ( $hangover === $value );
|
108 |
-
}
|
109 |
} else {
|
110 |
-
|
111 |
-
$selected = true;
|
112 |
-
} elseif ( $shifted && in_array( (int) $key, (array) $defaults ) ) {
|
113 |
-
$selected = true;
|
114 |
-
}
|
115 |
}
|
116 |
|
117 |
$item_atts = array(
|
66 |
$labels = array_merge( $labels, array_values( $data ) );
|
67 |
}
|
68 |
|
69 |
+
$default_choice = $tag->get_default_option( null, array(
|
70 |
+
'multiple' => $multiple,
|
71 |
+
'shifted' => $include_blank,
|
72 |
+
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
if ( $include_blank || empty( $values ) ) {
|
75 |
array_unshift( $labels, '---' );
|
76 |
array_unshift( $values, '' );
|
|
|
77 |
} elseif ( $first_as_label ) {
|
78 |
$values[0] = '';
|
79 |
}
|
82 |
$hangover = wpcf7_get_hangover( $tag->name );
|
83 |
|
84 |
foreach ( $values as $key => $value ) {
|
|
|
|
|
85 |
if ( $hangover ) {
|
86 |
+
$selected = in_array( $value, (array) $hangover, true );
|
|
|
|
|
|
|
|
|
87 |
} else {
|
88 |
+
$selected = in_array( $value, (array) $default_choice, true );
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
$item_atts = array(
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://contactform7.com/donate/
|
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 5.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -74,6 +74,13 @@ Do you have questions or issues with Contact Form 7? Use these support channels
|
|
74 |
|
75 |
For more information, see [Releases](https://contactform7.com/category/releases/).
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
= 5.0.2 =
|
78 |
|
79 |
* Added the Privacy Notices section to the readme.txt file.
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
Requires at least: 4.8
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 5.0.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
74 |
|
75 |
For more information, see [Releases](https://contactform7.com/category/releases/).
|
76 |
|
77 |
+
= 5.0.3 =
|
78 |
+
|
79 |
+
* CSS: Applies the "not-allowed" cursor style to submit buttons in the "disabled" state.
|
80 |
+
* Acceptance Checkbox: Revises the tag-generator UI to encourage the use of better options in terms of personal data protection.
|
81 |
+
* Introduces wpcf7_anonymize_ip_addr() function.
|
82 |
+
* Introduces the consent_for:storage option for all types of form-tags.
|
83 |
+
|
84 |
= 5.0.2 =
|
85 |
|
86 |
* Added the Privacy Notices section to the readme.txt file.
|
wp-contact-form-7.php
CHANGED
@@ -7,10 +7,10 @@ Author: Takayuki Miyoshi
|
|
7 |
Author URI: https://ideasilo.wordpress.com/
|
8 |
Text Domain: contact-form-7
|
9 |
Domain Path: /languages/
|
10 |
-
Version: 5.0.
|
11 |
*/
|
12 |
|
13 |
-
define( 'WPCF7_VERSION', '5.0.
|
14 |
|
15 |
define( 'WPCF7_REQUIRED_WP_VERSION', '4.8' );
|
16 |
|
7 |
Author URI: https://ideasilo.wordpress.com/
|
8 |
Text Domain: contact-form-7
|
9 |
Domain Path: /languages/
|
10 |
+
Version: 5.0.3
|
11 |
*/
|
12 |
|
13 |
+
define( 'WPCF7_VERSION', '5.0.3' );
|
14 |
|
15 |
define( 'WPCF7_REQUIRED_WP_VERSION', '4.8' );
|
16 |
|