| @@ -1,16 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Form errors and success message wrapper. | |
| 4 | - * | |
| 5 | - * @package Formidable | |
| 6 | - * | |
| 7 | - * @var stdClass|null $form Form object when available. | |
| 8 | - * @var string|null $message Success message HTML. | |
| 9 | - * @var array|null $errors Field errors keyed by field id. | |
| 10 | - * @var string|null $include_extra_container Optional CSS class for a wrapping container. | |
| 11 | - */ | |
| 12 | - | |
| 13 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 15 | 4 | } |
| 16 | 5 | |
| @@ -17,10 +6,8 @@ | ||
| 17 | 6 | if ( isset( $include_extra_container ) ) { ?> |
| 18 | 7 | <div class="<?php echo esc_attr( $include_extra_container ); ?>" id="frm_form_<?php echo esc_attr( $form->id ); ?>_container"> |
| 19 | 8 | <?php |
| 20 | 9 | } |
| 21 | - | |
| 22 | -// phpcs:ignore Universal.Operators.StrictComparisons | |
| 23 | 10 | if ( isset( $message ) && $message != '' ) { |
| 24 | 11 | if ( FrmAppHelper::is_admin() ) { |
| 25 | 12 | ?> |
| 26 | 13 | <div id="message" class="frm_updated_message" role="status"><?php echo wp_kses_post( $message ); ?></div> |
| @@ -27,14 +14,15 @@ | ||
| 27 | 14 | <?php |
| 28 | 15 | } else { |
| 29 | 16 | FrmFormsHelper::maybe_get_scroll_js( $form->id ); |
| 30 | 17 | |
| 31 | - // We need to allow scripts here for javascript in the success message | |
| 18 | + // we need to allow scripts here for javascript in the success message | |
| 32 | 19 | echo FrmAppHelper::maybe_kses( $message ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 33 | 20 | } |
| 34 | 21 | } |
| 35 | 22 | |
| 36 | -if ( ! empty( $errors ) && is_array( $errors ) ) { | |
| 23 | +if ( isset( $errors ) && is_array( $errors ) && ! empty( $errors ) ) { | |
| 24 | + | |
| 37 | 25 | if ( isset( $form ) && is_object( $form ) ) { |
| 38 | 26 | FrmFormsHelper::get_scroll_js( $form->id ); |
| 39 | 27 | } |
| 40 | 28 | ?> |
| @@ -40,13 +28,11 @@ | ||
| 40 | 28 | ?> |
| 41 | 29 | <div class="<?php echo esc_attr( FrmFormsHelper::form_error_class() ); ?>" role="alert"> |
| 42 | 30 | <?php |
| 43 | 31 | $img = ''; |
| 44 | - | |
| 45 | 32 | if ( ! FrmAppHelper::is_admin() ) { |
| 46 | 33 | $img = apply_filters( 'frm_error_icon', $img ); |
| 47 | - | |
| 48 | - if ( $img ) { | |
| 34 | + if ( $img && ! empty( $img ) ) { | |
| 49 | 35 | echo '<img src="' . esc_url( $img ) . '" alt="" />'; |
| 50 | 36 | } |
| 51 | 37 | } |
| 52 | 38 | |
| @@ -54,9 +40,9 @@ | ||
| 54 | 40 | |
| 55 | 41 | ?> |
| 56 | 42 | </div> |
| 57 | 43 | <?php |
| 58 | -}//end if | |
| 44 | +} | |
| 59 | 45 | |
| 60 | 46 | if ( isset( $include_extra_container ) ) { |
| 61 | 47 | ?> |
| 62 | 48 | </div> |