| 1 |
<?php |
| 2 |
/** |
| 3 |
* Show the GDPR Field on the front-end. |
| 4 |
* |
| 5 |
* @package Formidable |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
die( 'You are not allowed to call this page directly.' ); |
| 10 |
} |
| 11 |
|
| 12 |
$agreement_text = $field['gdpr_agreement_text']; |
| 13 |
$field_id = $field['id']; |
| 14 |
$checked = FrmAppHelper::check_selected( $field['value'], 1 ) ? ' checked="checked"' : ''; |
| 15 |
$label_id = 'frm-gdpr-accept-' . $field_id; |
| 16 |
?> |
| 17 |
|
| 18 |
<?php if ( ! FrmFieldGdprHelper::hide_gdpr_field() ) : ?> |
| 19 |
<div class="frm_checkbox" role="group" aria-labelledby="<?php echo esc_attr( $label_id ); ?>"> |
| 20 |
<label for="<?php echo esc_attr( $label_id ); ?>"> |
| 21 |
<input type="checkbox" aria-required="true" name="item_meta[<?php echo esc_attr( $field_id ); ?>]" id="<?php echo esc_attr( $label_id ); ?>" value="1" |
| 22 |
<?php echo $checked . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 23 |
<?php do_action( 'frm_field_input_html', $field ); ?> |
| 24 |
/> |
| 25 |
<?php FrmAppHelper::kses_echo( $agreement_text, array( 'a', 'b', 'br', 'div', 'em', 'i', 'p', 'span', 'strong' ) ); ?> |
| 26 |
</label> |
| 27 |
</div> |
| 28 |
<?php elseif ( current_user_can( 'frm_edit_forms' ) ) : ?> |
| 29 |
<div class="frm_checkbox" role="group" aria-labelledby="<?php echo esc_attr( $label_id ); ?>"> |
| 30 |
<label for="<?php echo esc_attr( $label_id ); ?>"> |
| 31 |
<?php |
| 32 |
/* translators: %1$s: Link HTML, %2$s: End link */ |
| 33 |
printf( esc_html__( 'GDPR field is disabled. Please enable it in the Formidable %1$sSettings%2$s.', 'formidable' ), '<a href="?page=formidable-settings" target="_blank">', '</a>' ); |
| 34 |
?> |
| 35 |
</label> |
| 36 |
</div> |
| 37 |
<?php endif; ?> |
| 38 |
|