| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
if ( isset( $message ) && '' !== $message ) { |
| 7 |
if ( FrmAppHelper::is_admin() ) { |
| 8 |
echo '<div class="frm_updated_message">'; |
| 9 |
FrmAppHelper::kses_echo( $message, 'all' ); |
| 10 |
echo '</div>'; |
| 11 |
} else { |
| 12 |
echo FrmAppHelper::maybe_kses( $message ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
if ( ! isset( $show_messages ) ) { |
| 17 |
$show_messages = array(); |
| 18 |
} |
| 19 |
|
| 20 |
$show_messages = apply_filters( 'frm_message_list', $show_messages ); |
| 21 |
|
| 22 |
if ( is_array( $show_messages ) && $show_messages !== array() ) { |
| 23 |
// Define a callback function to add 'data-action' attribute to allowed HTML tags |
| 24 |
$add_data_action_callback = function ( $allowed_html ) { |
| 25 |
$allowed_html['span']['data-action'] = true; |
| 26 |
return $allowed_html; |
| 27 |
}; |
| 28 |
?> |
| 29 |
<div class="frm_warning_style" role="alert"> |
| 30 |
<ul id="frm_messages"> |
| 31 |
<?php |
| 32 |
// Add the callback function to the 'frm_striphtml_allowed_tags' filter |
| 33 |
add_filter( 'frm_striphtml_allowed_tags', $add_data_action_callback ); |
| 34 |
|
| 35 |
foreach ( $show_messages as $m ) { |
| 36 |
echo '<li>'; |
| 37 |
FrmAppHelper::kses_echo( $m, array( 'a', 'br', 'span', 'p', 'svg', 'use' ) ); |
| 38 |
echo '</li>'; |
| 39 |
} |
| 40 |
// Remove the callback function from the 'frm_striphtml_allowed_tags' filter |
| 41 |
remove_filter( 'frm_striphtml_allowed_tags', $add_data_action_callback ); |
| 42 |
?> |
| 43 |
</ul> |
| 44 |
</div> |
| 45 |
<?php |
| 46 |
}//end if |
| 47 |
|
| 48 |
if ( ! empty( $warnings ) && is_array( $warnings ) ) { |
| 49 |
?> |
| 50 |
<div class="frm_warning_style inline" role="alert"> |
| 51 |
<div class="frm_warning_heading"> <?php esc_html_e( 'Warning:', 'formidable' ); ?></div> |
| 52 |
<ul id="frm_warnings"> |
| 53 |
<?php |
| 54 |
foreach ( $warnings as $warning ) { |
| 55 |
echo '<li>'; |
| 56 |
FrmAppHelper::kses_echo( $warning, array( 'a', 'br' ) ); |
| 57 |
echo '</li>'; |
| 58 |
} |
| 59 |
?> |
| 60 |
</ul> |
| 61 |
</div> |
| 62 |
<?php |
| 63 |
} |
| 64 |
|
| 65 |
if ( ! empty( $errors ) && is_array( $errors ) ) { |
| 66 |
?> |
| 67 |
<div class="frm_error_style inline" role="alert"> |
| 68 |
<ul id="frm_errors"> |
| 69 |
<?php |
| 70 |
foreach ( $errors as $error ) { |
| 71 |
echo '<li>'; |
| 72 |
FrmAppHelper::kses_echo( $error, array( 'a', 'br' ) ); |
| 73 |
echo '</li>'; |
| 74 |
} |
| 75 |
?> |
| 76 |
</ul> |
| 77 |
</div> |
| 78 |
<?php |
| 79 |
} |
| 80 |
|
| 81 |
if ( ! empty( $notes ) && is_array( $notes ) ) { |
| 82 |
foreach ( $notes as $note ) { |
| 83 |
?> |
| 84 |
<div class="frm_note_style"> |
| 85 |
<?php |
| 86 |
if ( is_string( $note ) ) { |
| 87 |
echo esc_html( $note ); |
| 88 |
} elseif ( is_callable( $note ) ) { |
| 89 |
// If $note is a function call it so we can handle cases where we don't want to wrap the whole note in esc_html. |
| 90 |
$note(); |
| 91 |
} |
| 92 |
?> |
| 93 |
</div> |
| 94 |
<?php |
| 95 |
} |
| 96 |
} |
| 97 |
|