Version Description
- Makes the [contact-form-7 404 "Not Found"] message localizable.
- REST API: Adds the
permission_callback
argument to every endpoint definition. - Flamingo: Uses
id()
instead ofid
, if available. - Fixed: The
free_text
option did not work correctly with theexclusive
option. - Applies
wpcf7_mail_tag_replaced
filters even when the$posted_data
is null. - Adds custom mail-tag replacement for quiz fields.
- Admin: Updates the date column format in the list table.
Download this release
Release Info
Developer | takayukister |
Plugin | Contact Form 7 |
Version | 5.2.1 |
Comparing to | |
See all releases |
Code changes from version 5.2 to 5.2.1
- admin/css/styles.css +2 -2
- admin/includes/class-contact-forms-list-table.php +12 -20
- includes/css/styles.css +2 -2
- includes/mail.php +16 -15
- includes/rest-api.php +58 -35
- includes/special-mail-tags.php +8 -8
- includes/submission.php +23 -21
- modules/flamingo.php +20 -6
- modules/quiz.php +18 -0
- modules/select.php +9 -10
- readme.txt +12 -2
- wp-contact-form-7.php +2 -2
admin/css/styles.css
CHANGED
@@ -51,7 +51,7 @@ span.shortcode input {
|
|
51 |
}
|
52 |
|
53 |
#submitpost input.delete:hover {
|
54 |
-
color: #
|
55 |
}
|
56 |
|
57 |
#submitpost input.delete:focus {
|
@@ -84,7 +84,7 @@ ul.config-error li {
|
|
84 |
}
|
85 |
|
86 |
[data-config-field][aria-invalid="true"] {
|
87 |
-
border-color: #
|
88 |
}
|
89 |
|
90 |
#contact-form-editor-tabs li a .icon-in-circle,
|
51 |
}
|
52 |
|
53 |
#submitpost input.delete:hover {
|
54 |
+
color: #dc3232;
|
55 |
}
|
56 |
|
57 |
#submitpost input.delete:focus {
|
84 |
}
|
85 |
|
86 |
[data-config-field][aria-invalid="true"] {
|
87 |
+
border-color: #dc3232;
|
88 |
}
|
89 |
|
90 |
#contact-form-editor-tabs li a .icon-in-circle,
|
admin/includes/class-contact-forms-list-table.php
CHANGED
@@ -223,29 +223,21 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
|
|
223 |
}
|
224 |
|
225 |
public function column_date( $item ) {
|
226 |
-
$
|
227 |
-
|
228 |
-
if ( ! $post ) {
|
229 |
-
return;
|
230 |
-
}
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
$time_diff = time() - $time;
|
235 |
-
|
236 |
-
if ( $time and 0 < $time_diff and $time_diff < DAY_IN_SECONDS ) {
|
237 |
-
$h_time = sprintf(
|
238 |
-
/* translators: %s: Human-readable time difference since the creation of the contact form */
|
239 |
-
__( '%s ago', 'contact-form-7' ),
|
240 |
-
human_time_diff( $time )
|
241 |
-
);
|
242 |
-
} else {
|
243 |
-
$h_time = get_the_time( __( 'Y/m/d', 'contact-form-7' ), $post );
|
244 |
}
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
|
|
|
|
|
|
|
|
249 |
);
|
|
|
|
|
250 |
}
|
251 |
}
|
223 |
}
|
224 |
|
225 |
public function column_date( $item ) {
|
226 |
+
$datetime = get_post_datetime( $item->id() );
|
|
|
|
|
|
|
|
|
227 |
|
228 |
+
if ( false === $datetime ) {
|
229 |
+
return '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
}
|
231 |
|
232 |
+
$t_time = sprintf(
|
233 |
+
/* translators: 1: date, 2: time */
|
234 |
+
__( '%1$s at %2$s', 'contact-form-7' ),
|
235 |
+
/* translators: date format, see https://www.php.net/date */
|
236 |
+
$datetime->format( __( 'Y/m/d', 'contact-form-7' ) ),
|
237 |
+
/* translators: time format, see https://www.php.net/date */
|
238 |
+
$datetime->format( __( 'g:i a', 'contact-form-7' ) )
|
239 |
);
|
240 |
+
|
241 |
+
return $t_time;
|
242 |
}
|
243 |
}
|
includes/css/styles.css
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
}
|
43 |
|
44 |
.wpcf7-not-valid-tip {
|
45 |
-
color: #
|
46 |
font-size: 1em;
|
47 |
font-weight: normal;
|
48 |
display: block;
|
@@ -53,7 +53,7 @@
|
|
53 |
top: 20%;
|
54 |
left: 20%;
|
55 |
z-index: 100;
|
56 |
-
border: 1px solid #
|
57 |
background: #fff;
|
58 |
padding: .2em .8em;
|
59 |
}
|
42 |
}
|
43 |
|
44 |
.wpcf7-not-valid-tip {
|
45 |
+
color: #dc3232;
|
46 |
font-size: 1em;
|
47 |
font-weight: normal;
|
48 |
display: block;
|
53 |
top: 20%;
|
54 |
left: 20%;
|
55 |
z-index: 100;
|
56 |
+
border: 1px solid #dc3232;
|
57 |
background: #fff;
|
58 |
padding: .2em .8em;
|
59 |
}
|
includes/mail.php
CHANGED
@@ -317,14 +317,13 @@ class WPCF7_MailTaggedText {
|
|
317 |
? $submission->get_posted_data( $field_name )
|
318 |
: null;
|
319 |
|
320 |
-
if (
|
321 |
-
|
322 |
-
|
323 |
-
$submitted = isset( $_POST[$field_name] ) ? $_POST[$field_name] : '';
|
324 |
-
}
|
325 |
|
326 |
-
|
327 |
|
|
|
328 |
if ( $format = $mail_tag->get_option( 'format' ) ) {
|
329 |
$replaced = $this->format( $replaced, $format );
|
330 |
}
|
@@ -335,21 +334,23 @@ class WPCF7_MailTaggedText {
|
|
335 |
$replaced = esc_html( $replaced );
|
336 |
$replaced = wptexturize( $replaced );
|
337 |
}
|
|
|
338 |
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
$replaced = apply_filters(
|
343 |
-
"wpcf7_mail_tag_replaced_{$type}", $replaced,
|
344 |
-
$submitted, $html, $mail_tag
|
345 |
-
);
|
346 |
-
}
|
347 |
|
348 |
$replaced = apply_filters(
|
349 |
-
|
350 |
$submitted, $html, $mail_tag
|
351 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
|
|
|
353 |
$replaced = wp_unslash( trim( $replaced ) );
|
354 |
|
355 |
$this->replaced_tags[$tag] = $replaced;
|
317 |
? $submission->get_posted_data( $field_name )
|
318 |
: null;
|
319 |
|
320 |
+
if ( $mail_tag->get_option( 'do_not_heat' ) ) {
|
321 |
+
$submitted = isset( $_POST[$field_name] ) ? $_POST[$field_name] : '';
|
322 |
+
}
|
|
|
|
|
323 |
|
324 |
+
$replaced = $submitted;
|
325 |
|
326 |
+
if ( null !== $replaced ) {
|
327 |
if ( $format = $mail_tag->get_option( 'format' ) ) {
|
328 |
$replaced = $this->format( $replaced, $format );
|
329 |
}
|
334 |
$replaced = esc_html( $replaced );
|
335 |
$replaced = wptexturize( $replaced );
|
336 |
}
|
337 |
+
}
|
338 |
|
339 |
+
if ( $form_tag = $mail_tag->corresponding_form_tag() ) {
|
340 |
+
$type = $form_tag->type;
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
$replaced = apply_filters(
|
343 |
+
"wpcf7_mail_tag_replaced_{$type}", $replaced,
|
344 |
$submitted, $html, $mail_tag
|
345 |
);
|
346 |
+
}
|
347 |
+
|
348 |
+
$replaced = apply_filters(
|
349 |
+
'wpcf7_mail_tag_replaced', $replaced,
|
350 |
+
$submitted, $html, $mail_tag
|
351 |
+
);
|
352 |
|
353 |
+
if ( null !== $replaced ) {
|
354 |
$replaced = wp_unslash( trim( $replaced ) );
|
355 |
|
356 |
$this->replaced_tags[$tag] = $replaced;
|
includes/rest-api.php
CHANGED
@@ -11,10 +11,30 @@ function wpcf7_rest_api_init() {
|
|
11 |
array(
|
12 |
'methods' => WP_REST_Server::READABLE,
|
13 |
'callback' => 'wpcf7_rest_get_contact_forms',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
),
|
15 |
array(
|
16 |
'methods' => WP_REST_Server::CREATABLE,
|
17 |
'callback' => 'wpcf7_rest_create_contact_form',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
),
|
19 |
)
|
20 |
);
|
@@ -25,14 +45,50 @@ function wpcf7_rest_api_init() {
|
|
25 |
array(
|
26 |
'methods' => WP_REST_Server::READABLE,
|
27 |
'callback' => 'wpcf7_rest_get_contact_form',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
),
|
29 |
array(
|
30 |
'methods' => WP_REST_Server::EDITABLE,
|
31 |
'callback' => 'wpcf7_rest_update_contact_form',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
),
|
33 |
array(
|
34 |
'methods' => WP_REST_Server::DELETABLE,
|
35 |
'callback' => 'wpcf7_rest_delete_contact_form',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
),
|
37 |
)
|
38 |
);
|
@@ -43,6 +99,7 @@ function wpcf7_rest_api_init() {
|
|
43 |
array(
|
44 |
'methods' => WP_REST_Server::CREATABLE,
|
45 |
'callback' => 'wpcf7_rest_create_feedback',
|
|
|
46 |
),
|
47 |
)
|
48 |
);
|
@@ -53,19 +110,13 @@ function wpcf7_rest_api_init() {
|
|
53 |
array(
|
54 |
'methods' => WP_REST_Server::READABLE,
|
55 |
'callback' => 'wpcf7_rest_get_refill',
|
|
|
56 |
),
|
57 |
)
|
58 |
);
|
59 |
}
|
60 |
|
61 |
function wpcf7_rest_get_contact_forms( WP_REST_Request $request ) {
|
62 |
-
if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) {
|
63 |
-
return new WP_Error( 'wpcf7_forbidden',
|
64 |
-
__( "You are not allowed to access contact forms.", 'contact-form-7' ),
|
65 |
-
array( 'status' => 403 )
|
66 |
-
);
|
67 |
-
}
|
68 |
-
|
69 |
$args = array();
|
70 |
|
71 |
$per_page = $request->get_param( 'per_page' );
|
@@ -124,13 +175,6 @@ function wpcf7_rest_create_contact_form( WP_REST_Request $request ) {
|
|
124 |
);
|
125 |
}
|
126 |
|
127 |
-
if ( ! current_user_can( 'wpcf7_edit_contact_forms' ) ) {
|
128 |
-
return new WP_Error( 'wpcf7_forbidden',
|
129 |
-
__( "You are not allowed to create a contact form.", 'contact-form-7' ),
|
130 |
-
array( 'status' => 403 )
|
131 |
-
);
|
132 |
-
}
|
133 |
-
|
134 |
$args = $request->get_params();
|
135 |
$args['id'] = -1; // Create
|
136 |
$context = $request->get_param( 'context' );
|
@@ -177,13 +221,6 @@ function wpcf7_rest_get_contact_form( WP_REST_Request $request ) {
|
|
177 |
);
|
178 |
}
|
179 |
|
180 |
-
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
|
181 |
-
return new WP_Error( 'wpcf7_forbidden',
|
182 |
-
__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
|
183 |
-
array( 'status' => 403 )
|
184 |
-
);
|
185 |
-
}
|
186 |
-
|
187 |
$response = array(
|
188 |
'id' => $item->id(),
|
189 |
'slug' => $item->name(),
|
@@ -206,13 +243,6 @@ function wpcf7_rest_update_contact_form( WP_REST_Request $request ) {
|
|
206 |
);
|
207 |
}
|
208 |
|
209 |
-
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
|
210 |
-
return new WP_Error( 'wpcf7_forbidden',
|
211 |
-
__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
|
212 |
-
array( 'status' => 403 )
|
213 |
-
);
|
214 |
-
}
|
215 |
-
|
216 |
$args = $request->get_params();
|
217 |
$context = $request->get_param( 'context' );
|
218 |
$item = wpcf7_save_contact_form( $args, $context );
|
@@ -258,13 +288,6 @@ function wpcf7_rest_delete_contact_form( WP_REST_Request $request ) {
|
|
258 |
);
|
259 |
}
|
260 |
|
261 |
-
if ( ! current_user_can( 'wpcf7_delete_contact_form', $id ) ) {
|
262 |
-
return new WP_Error( 'wpcf7_forbidden',
|
263 |
-
__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
|
264 |
-
array( 'status' => 403 )
|
265 |
-
);
|
266 |
-
}
|
267 |
-
|
268 |
$result = $item->delete();
|
269 |
|
270 |
if ( ! $result ) {
|
11 |
array(
|
12 |
'methods' => WP_REST_Server::READABLE,
|
13 |
'callback' => 'wpcf7_rest_get_contact_forms',
|
14 |
+
'permission_callback' => function() {
|
15 |
+
if ( current_user_can( 'wpcf7_read_contact_forms' ) ) {
|
16 |
+
return true;
|
17 |
+
} else {
|
18 |
+
return new WP_Error( 'wpcf7_forbidden',
|
19 |
+
__( "You are not allowed to access contact forms.", 'contact-form-7' ),
|
20 |
+
array( 'status' => 403 )
|
21 |
+
);
|
22 |
+
}
|
23 |
+
},
|
24 |
),
|
25 |
array(
|
26 |
'methods' => WP_REST_Server::CREATABLE,
|
27 |
'callback' => 'wpcf7_rest_create_contact_form',
|
28 |
+
'permission_callback' => function() {
|
29 |
+
if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) {
|
30 |
+
return true;
|
31 |
+
} else {
|
32 |
+
return new WP_Error( 'wpcf7_forbidden',
|
33 |
+
__( "You are not allowed to create a contact form.", 'contact-form-7' ),
|
34 |
+
array( 'status' => 403 )
|
35 |
+
);
|
36 |
+
}
|
37 |
+
},
|
38 |
),
|
39 |
)
|
40 |
);
|
45 |
array(
|
46 |
'methods' => WP_REST_Server::READABLE,
|
47 |
'callback' => 'wpcf7_rest_get_contact_form',
|
48 |
+
'permission_callback' => function( WP_REST_Request $request ) {
|
49 |
+
$id = (int) $request->get_param( 'id' );
|
50 |
+
|
51 |
+
if ( current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
|
52 |
+
return true;
|
53 |
+
} else {
|
54 |
+
return new WP_Error( 'wpcf7_forbidden',
|
55 |
+
__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
|
56 |
+
array( 'status' => 403 )
|
57 |
+
);
|
58 |
+
}
|
59 |
+
},
|
60 |
),
|
61 |
array(
|
62 |
'methods' => WP_REST_Server::EDITABLE,
|
63 |
'callback' => 'wpcf7_rest_update_contact_form',
|
64 |
+
'permission_callback' => function( WP_REST_Request $request ) {
|
65 |
+
$id = (int) $request->get_param( 'id' );
|
66 |
+
|
67 |
+
if ( current_user_can( 'wpcf7_edit_contact_form', $id ) ) {
|
68 |
+
return true;
|
69 |
+
} else {
|
70 |
+
return new WP_Error( 'wpcf7_forbidden',
|
71 |
+
__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
|
72 |
+
array( 'status' => 403 )
|
73 |
+
);
|
74 |
+
}
|
75 |
+
},
|
76 |
),
|
77 |
array(
|
78 |
'methods' => WP_REST_Server::DELETABLE,
|
79 |
'callback' => 'wpcf7_rest_delete_contact_form',
|
80 |
+
'permission_callback' => function( WP_REST_Request $request ) {
|
81 |
+
$id = (int) $request->get_param( 'id' );
|
82 |
+
|
83 |
+
if ( current_user_can( 'wpcf7_delete_contact_form', $id ) ) {
|
84 |
+
return true;
|
85 |
+
} else {
|
86 |
+
return new WP_Error( 'wpcf7_forbidden',
|
87 |
+
__( "You are not allowed to access the requested contact form.", 'contact-form-7' ),
|
88 |
+
array( 'status' => 403 )
|
89 |
+
);
|
90 |
+
}
|
91 |
+
},
|
92 |
),
|
93 |
)
|
94 |
);
|
99 |
array(
|
100 |
'methods' => WP_REST_Server::CREATABLE,
|
101 |
'callback' => 'wpcf7_rest_create_feedback',
|
102 |
+
'permission_callback' => '__return_true',
|
103 |
),
|
104 |
)
|
105 |
);
|
110 |
array(
|
111 |
'methods' => WP_REST_Server::READABLE,
|
112 |
'callback' => 'wpcf7_rest_get_refill',
|
113 |
+
'permission_callback' => '__return_true',
|
114 |
),
|
115 |
)
|
116 |
);
|
117 |
}
|
118 |
|
119 |
function wpcf7_rest_get_contact_forms( WP_REST_Request $request ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
$args = array();
|
121 |
|
122 |
$per_page = $request->get_param( 'per_page' );
|
175 |
);
|
176 |
}
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
$args = $request->get_params();
|
179 |
$args['id'] = -1; // Create
|
180 |
$context = $request->get_param( 'context' );
|
221 |
);
|
222 |
}
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
$response = array(
|
225 |
'id' => $item->id(),
|
226 |
'slug' => $item->name(),
|
243 |
);
|
244 |
}
|
245 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
$args = $request->get_params();
|
247 |
$context = $request->get_param( 'context' );
|
248 |
$item = wpcf7_save_contact_form( $args, $context );
|
288 |
);
|
289 |
}
|
290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
$result = $item->delete();
|
292 |
|
293 |
if ( ! $result ) {
|
includes/special-mail-tags.php
CHANGED
@@ -4,9 +4,9 @@
|
|
4 |
** https://contactform7.com/special-mail-tags/
|
5 |
**/
|
6 |
|
7 |
-
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag', 10,
|
8 |
|
9 |
-
function wpcf7_special_mail_tag( $output, $name, $html ) {
|
10 |
$name = preg_replace( '/^wpcf7\./', '_', $name ); // for back-compat
|
11 |
|
12 |
$submission = WPCF7_Submission::get_instance();
|
@@ -61,9 +61,9 @@ function wpcf7_special_mail_tag( $output, $name, $html ) {
|
|
61 |
return $output;
|
62 |
}
|
63 |
|
64 |
-
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_post_related_smt', 10,
|
65 |
|
66 |
-
function wpcf7_post_related_smt( $output, $name, $html ) {
|
67 |
if ( '_post_' != substr( $name, 0, 6 ) ) {
|
68 |
return $output;
|
69 |
}
|
@@ -110,9 +110,9 @@ function wpcf7_post_related_smt( $output, $name, $html ) {
|
|
110 |
return $output;
|
111 |
}
|
112 |
|
113 |
-
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_site_related_smt', 10,
|
114 |
|
115 |
-
function wpcf7_site_related_smt( $output, $name, $html ) {
|
116 |
$filter = $html ? 'display' : 'raw';
|
117 |
|
118 |
if ( '_site_title' == $name ) {
|
@@ -134,9 +134,9 @@ function wpcf7_site_related_smt( $output, $name, $html ) {
|
|
134 |
return $output;
|
135 |
}
|
136 |
|
137 |
-
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_user_related_smt', 10,
|
138 |
|
139 |
-
function wpcf7_user_related_smt( $output, $name, $html ) {
|
140 |
if ( '_user_' != substr( $name, 0, 6 )
|
141 |
or '_user_agent' == $name ) {
|
142 |
return $output;
|
4 |
** https://contactform7.com/special-mail-tags/
|
5 |
**/
|
6 |
|
7 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag', 10, 4 );
|
8 |
|
9 |
+
function wpcf7_special_mail_tag( $output, $name, $html, $mail_tag ) {
|
10 |
$name = preg_replace( '/^wpcf7\./', '_', $name ); // for back-compat
|
11 |
|
12 |
$submission = WPCF7_Submission::get_instance();
|
61 |
return $output;
|
62 |
}
|
63 |
|
64 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_post_related_smt', 10, 4 );
|
65 |
|
66 |
+
function wpcf7_post_related_smt( $output, $name, $html, $mail_tag ) {
|
67 |
if ( '_post_' != substr( $name, 0, 6 ) ) {
|
68 |
return $output;
|
69 |
}
|
110 |
return $output;
|
111 |
}
|
112 |
|
113 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_site_related_smt', 10, 4 );
|
114 |
|
115 |
+
function wpcf7_site_related_smt( $output, $name, $html, $mail_tag ) {
|
116 |
$filter = $html ? 'display' : 'raw';
|
117 |
|
118 |
if ( '_site_title' == $name ) {
|
134 |
return $output;
|
135 |
}
|
136 |
|
137 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_user_related_smt', 10, 4 );
|
138 |
|
139 |
+
function wpcf7_user_related_smt( $output, $name, $html, $mail_tag ) {
|
140 |
if ( '_user_' != substr( $name, 0, 6 )
|
141 |
or '_user_agent' == $name ) {
|
142 |
return $output;
|
includes/submission.php
CHANGED
@@ -240,29 +240,31 @@ class WPCF7_Submission {
|
|
240 |
}
|
241 |
}
|
242 |
|
243 |
-
if ( wpcf7_form_tag_supports( $type, 'selectable-values' )
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
$tied_item = html_entity_decode( $tied_item, ENT_QUOTES, 'UTF-8' );
|
255 |
-
|
256 |
-
if ( $last_val === $tied_item ) {
|
257 |
-
$value[] = sprintf( '%s %s',
|
258 |
-
$last_val,
|
259 |
-
$posted_data[$name . '_free_text']
|
260 |
);
|
261 |
-
} else {
|
262 |
-
$value[] = $last_val;
|
263 |
-
}
|
264 |
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
}
|
267 |
|
268 |
$value = apply_filters( "wpcf7_posted_data_{$type}", $value,
|
240 |
}
|
241 |
}
|
242 |
|
243 |
+
if ( wpcf7_form_tag_supports( $type, 'selectable-values' ) ) {
|
244 |
+
$value = (array) $value;
|
245 |
+
|
246 |
+
if ( $tag->has_option( 'free_text' )
|
247 |
+
and isset( $posted_data[$name . '_free_text'] ) ) {
|
248 |
+
$last_val = array_pop( $value );
|
249 |
+
|
250 |
+
list( $tied_item ) = array_slice(
|
251 |
+
WPCF7_USE_PIPE ? $tag->pipes->collect_afters() : $tag->values,
|
252 |
+
-1, 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
);
|
|
|
|
|
|
|
254 |
|
255 |
+
$tied_item = html_entity_decode( $tied_item, ENT_QUOTES, 'UTF-8' );
|
256 |
+
|
257 |
+
if ( $last_val === $tied_item ) {
|
258 |
+
$value[] = sprintf( '%s %s',
|
259 |
+
$last_val,
|
260 |
+
$posted_data[$name . '_free_text']
|
261 |
+
);
|
262 |
+
} else {
|
263 |
+
$value[] = $last_val;
|
264 |
+
}
|
265 |
+
|
266 |
+
unset( $posted_data[$name . '_free_text'] );
|
267 |
+
}
|
268 |
}
|
269 |
|
270 |
$value = apply_filters( "wpcf7_posted_data_{$type}", $value,
|
modules/flamingo.php
CHANGED
@@ -128,11 +128,25 @@ function wpcf7_flamingo_submit( $contact_form, $result ) {
|
|
128 |
|
129 |
$flamingo_inbound = Flamingo_Inbound_Message::add( $args );
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
$result += array(
|
132 |
-
'flamingo_contact_id' =>
|
133 |
-
|
134 |
-
'flamingo_inbound_id' =>
|
135 |
-
empty( $flamingo_inbound ) ? 0 : absint( $flamingo_inbound->id ),
|
136 |
);
|
137 |
|
138 |
do_action( 'wpcf7_after_flamingo', $result );
|
@@ -242,9 +256,9 @@ function wpcf7_flamingo_update_channel( $contact_form ) {
|
|
242 |
}
|
243 |
}
|
244 |
|
245 |
-
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_flamingo_serial_number', 10,
|
246 |
|
247 |
-
function wpcf7_flamingo_serial_number( $output, $name, $html ) {
|
248 |
if ( '_serial_number' != $name ) {
|
249 |
return $output;
|
250 |
}
|
128 |
|
129 |
$flamingo_inbound = Flamingo_Inbound_Message::add( $args );
|
130 |
|
131 |
+
if ( empty( $flamingo_contact ) ) {
|
132 |
+
$flamingo_contact_id = 0;
|
133 |
+
} elseif ( method_exists( $flamingo_contact, 'id' ) ) {
|
134 |
+
$flamingo_contact_id = $flamingo_contact->id();
|
135 |
+
} else {
|
136 |
+
$flamingo_contact_id = $flamingo_contact->id;
|
137 |
+
}
|
138 |
+
|
139 |
+
if ( empty( $flamingo_inbound ) ) {
|
140 |
+
$flamingo_inbound_id = 0;
|
141 |
+
} elseif ( method_exists( $flamingo_inbound, 'id' ) ) {
|
142 |
+
$flamingo_inbound_id = $flamingo_inbound->id();
|
143 |
+
} else {
|
144 |
+
$flamingo_inbound_id = $flamingo_inbound->id;
|
145 |
+
}
|
146 |
+
|
147 |
$result += array(
|
148 |
+
'flamingo_contact_id' => absint( $flamingo_contact_id ),
|
149 |
+
'flamingo_inbound_id' => absint( $flamingo_inbound_id ),
|
|
|
|
|
150 |
);
|
151 |
|
152 |
do_action( 'wpcf7_after_flamingo', $result );
|
256 |
}
|
257 |
}
|
258 |
|
259 |
+
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_flamingo_serial_number', 10, 4 );
|
260 |
|
261 |
+
function wpcf7_flamingo_serial_number( $output, $name, $html, $mail_tag ) {
|
262 |
if ( '_serial_number' != $name ) {
|
263 |
return $output;
|
264 |
}
|
modules/quiz.php
CHANGED
@@ -154,6 +154,24 @@ function wpcf7_quiz_ajax_refill( $items ) {
|
|
154 |
}
|
155 |
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
/* Messages */
|
158 |
|
159 |
add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages', 10, 1 );
|
154 |
}
|
155 |
|
156 |
|
157 |
+
/* Mail-tag replacement */
|
158 |
+
|
159 |
+
add_filter( 'wpcf7_mail_tag_replaced_quiz', 'wpcf7_quiz_mail_tag', 10, 4 );
|
160 |
+
|
161 |
+
function wpcf7_quiz_mail_tag( $replaced, $submitted, $html, $mail_tag ) {
|
162 |
+
$field_name = $mail_tag->field_name();
|
163 |
+
$submitted = isset( $_POST[$field_name] ) ? $_POST[$field_name] : '';
|
164 |
+
$replaced = $submitted;
|
165 |
+
|
166 |
+
if ( $html ) {
|
167 |
+
$replaced = esc_html( $replaced );
|
168 |
+
$replaced = wptexturize( $replaced );
|
169 |
+
}
|
170 |
+
|
171 |
+
return $replaced;
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
/* Messages */
|
176 |
|
177 |
add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages', 10, 1 );
|
modules/select.php
CHANGED
@@ -127,18 +127,17 @@ add_filter( 'wpcf7_validate_select*', 'wpcf7_select_validation_filter', 10, 2 );
|
|
127 |
function wpcf7_select_validation_filter( $result, $tag ) {
|
128 |
$name = $tag->name;
|
129 |
|
130 |
-
|
131 |
-
and is_array( $_POST[$name] ) ) {
|
132 |
-
foreach ( $_POST[$name] as $key => $value ) {
|
133 |
-
if ( '' === $value ) {
|
134 |
-
unset( $_POST[$name][$key] );
|
135 |
-
}
|
136 |
-
}
|
137 |
-
}
|
138 |
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
-
if ( $tag->is_required() and $
|
142 |
$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
|
143 |
}
|
144 |
|
127 |
function wpcf7_select_validation_filter( $result, $tag ) {
|
128 |
$name = $tag->name;
|
129 |
|
130 |
+
$has_value = isset( $_POST[$name] ) && '' !== $_POST[$name];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
+
if ( $has_value and $tag->has_option( 'multiple' ) ) {
|
133 |
+
$vals = array_filter( (array) $_POST[$name], function( $val ) {
|
134 |
+
return '' !== $val;
|
135 |
+
} );
|
136 |
+
|
137 |
+
$has_value = ! empty( $vals );
|
138 |
+
}
|
139 |
|
140 |
+
if ( $tag->is_required() and ! $has_value ) {
|
141 |
$result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
|
142 |
}
|
143 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: takayukister
|
|
3 |
Donate link: https://contactform7.com/donate/
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
Requires at least: 5.3
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 5.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -75,6 +75,16 @@ Do you have questions or issues with Contact Form 7? Use these support channels
|
|
75 |
|
76 |
For more information, see [Releases](https://contactform7.com/category/releases/).
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
= 5.2 =
|
79 |
|
80 |
* Submission: Introduces the `$posted_data_hash` and `$skip_spam_check` properties.
|
3 |
Donate link: https://contactform7.com/donate/
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
Requires at least: 5.3
|
6 |
+
Tested up to: 5.5
|
7 |
+
Stable tag: 5.2.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
75 |
|
76 |
For more information, see [Releases](https://contactform7.com/category/releases/).
|
77 |
|
78 |
+
= 5.2.1 =
|
79 |
+
|
80 |
+
* Makes the [contact-form-7 404 "Not Found"] message localizable.
|
81 |
+
* REST API: Adds the `permission_callback` argument to every endpoint definition.
|
82 |
+
* Flamingo: Uses `id()` instead of `id`, if available.
|
83 |
+
* Fixed: The `free_text` option did not work correctly with the `exclusive` option.
|
84 |
+
* Applies `wpcf7_mail_tag_replaced` filters even when the `$posted_data` is null.
|
85 |
+
* Adds custom mail-tag replacement for quiz fields.
|
86 |
+
* Admin: Updates the date column format in the list table.
|
87 |
+
|
88 |
= 5.2 =
|
89 |
|
90 |
* Submission: Introduces the `$posted_data_hash` and `$skip_spam_check` properties.
|
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.2
|
11 |
*/
|
12 |
|
13 |
-
define( 'WPCF7_VERSION', '5.2' );
|
14 |
|
15 |
define( 'WPCF7_REQUIRED_WP_VERSION', '5.3' );
|
16 |
|
7 |
Author URI: https://ideasilo.wordpress.com/
|
8 |
Text Domain: contact-form-7
|
9 |
Domain Path: /languages/
|
10 |
+
Version: 5.2.1
|
11 |
*/
|
12 |
|
13 |
+
define( 'WPCF7_VERSION', '5.2.1' );
|
14 |
|
15 |
define( 'WPCF7_REQUIRED_WP_VERSION', '5.3' );
|
16 |
|