<?php /** * Reflection module * * @link https://contactform7.com/reflection/ */ add_action( 'wpcf7_init', 'wpcf7_add_form_tag_reflection', 10, 0 ); /** * Registers reflection-related form-tag types. */ function wpcf7_add_form_tag_reflection() { wpcf7_add_form_tag( 'reflection', 'wpcf7_reflection_form_tag_handler', array( 'name-attr' => true, 'display-block' => true, 'not-for-mail' => true, ) ); wpcf7_add_form_tag( 'output', 'wpcf7_output_form_tag_handler', array( 'name-attr' => true, 'not-for-mail' => true, ) ); } /** * The form-tag handler for the reflection type. */ function wpcf7_reflection_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $values = $tag->values ? $tag->values : array( '' ); if ( ! wpcf7_get_validation_error( $tag->name ) ) { $hangover = array_filter( (array) wpcf7_get_hangover( $tag->name ) ); if ( $hangover ) { $values = $hangover; } } $content = array_reduce( $values, static function ( $carry, $item ) use ( $tag ) { $output_tag = sprintf( '<output %1$s>%2$s</output>', wpcf7_format_atts( array( 'name' => $tag->name, 'data-default' => $item, ) ), ( '' !== $item ) ? esc_html( $item ) : ' ' ); return $carry . $output_tag; }, '' ); $html = sprintf( '<fieldset %1$s>%2$s</fieldset>', wpcf7_format_atts( array( 'data-reflection-of' => $tag->name, 'class' => $tag->get_class_option( wpcf7_form_controls_class( $tag->type ) ), 'id' => $tag->get_id_option(), ) ), $content ); return $html; } /** * The form-tag handler for the output type. */ function wpcf7_output_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $value = (string) reset( $tag->values ); if ( ! wpcf7_get_validation_error( $tag->name ) ) { $hangover = array_filter( (array) wpcf7_get_hangover( $tag->name ) ); if ( $hangover ) { $value = (string) reset( $hangover ); } } $html = sprintf( '<output %1$s>%2$s</output>', wpcf7_format_atts( array( 'data-reflection-of' => $tag->name, 'data-default' => $value, 'name' => $tag->name, 'class' => $tag->get_class_option( wpcf7_form_controls_class( $tag->type ) ), 'id' => $tag->get_id_option(), ) ), esc_html( $value ) ); return $html; }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
akismet | Folder | 0755 |
|
|
constant-contact | Folder | 0755 |
|
|
recaptcha | Folder | 0755 |
|
|
sendinblue | Folder | 0755 |
|
|
stripe | Folder | 0755 |
|
|
acceptance.php | File | 7.39 KB | 0644 |
|
checkbox.php | File | 9.52 KB | 0644 |
|
count.php | File | 1.45 KB | 0644 |
|
date.php | File | 5.72 KB | 0644 |
|
disallowed-list.php | File | 1.77 KB | 0644 |
|
doi-helper.php | File | 730 B | 0644 |
|
file.php | File | 6.21 KB | 0644 |
|
flamingo.php | File | 8.34 KB | 0644 |
|
hidden.php | File | 776 B | 0644 |
|
listo.php | File | 755 B | 0644 |
|
number.php | File | 6.28 KB | 0644 |
|
quiz.php | File | 6.29 KB | 0644 |
|
really-simple-captcha.php | File | 13.82 KB | 0644 |
|
reflection.php | File | 2.27 KB | 0644 |
|
response.php | File | 460 B | 0644 |
|
select.php | File | 6.26 KB | 0644 |
|
submit.php | File | 2.31 KB | 0644 |
|
text.php | File | 8 KB | 0644 |
|
textarea.php | File | 4.89 KB | 0644 |
|