This commit is contained in:
2026-03-11 15:57:27 +01:00
parent 481271c972
commit b4b460fd21
10775 changed files with 2071579 additions and 26409 deletions

View File

@@ -98,7 +98,7 @@ add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 );
function wpcf7_quiz_validation_filter( $result, $tag ) {
$name = $tag->name;
$answer = isset( $_POST[$name] ) ? wp_unslash( $_POST[$name] ) : '';
$answer = wp_unslash( $_POST[$name] ?? '' );
$answer = wpcf7_canonicalize( $answer, array(
'strip_separators' => true,
@@ -106,9 +106,7 @@ function wpcf7_quiz_validation_filter( $result, $tag ) {
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
$expected_hash = isset( $_POST['_wpcf7_quiz_answer_' . $name] )
? (string) $_POST['_wpcf7_quiz_answer_' . $name]
: '';
$expected_hash = (string) ( $_POST['_wpcf7_quiz_answer_' . $name] ?? '' );
if ( ! hash_equals( $expected_hash, $answer_hash ) ) {
$result->invalidate( $tag, wpcf7_get_message( 'quiz_answer_not_correct' ) );
@@ -170,24 +168,6 @@ function wpcf7_quiz_ajax_refill( $items ) {
}
/* Mail-tag replacement */
add_filter( 'wpcf7_mail_tag_replaced_quiz', 'wpcf7_quiz_mail_tag', 10, 4 );
function wpcf7_quiz_mail_tag( $replaced, $submitted, $html, $mail_tag ) {
$field_name = $mail_tag->field_name();
$submitted = isset( $_POST[$field_name] ) ? $_POST[$field_name] : '';
$replaced = $submitted;
if ( $html ) {
$replaced = esc_html( $replaced );
$replaced = wptexturize( $replaced );
}
return $replaced;
}
/* Messages */
add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages', 10, 1 );