| @@ -9,55 +9,34 @@ | ||
| 9 | 9 | $widget_ops = array( 'description' => __( 'Display a Formidable Form', 'formidable' ) ); |
| 10 | 10 | parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops ); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - /** | |
| 14 | - * @param array $args | |
| 15 | - * @param array $instance | |
| 16 | - * | |
| 17 | - * @return void | |
| 18 | - */ | |
| 19 | 13 | public function widget( $args, $instance ) { |
| 20 | - $title = apply_filters( 'widget_title', ! empty( $instance['title'] ) ? $instance['title'] : '', $instance, $this->id_base ); | |
| 14 | + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); | |
| 21 | 15 | |
| 22 | - FrmAppHelper::kses_echo( $args['before_widget'], 'all' ); | |
| 16 | + echo FrmAppHelper::kses( $args['before_widget'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 23 | 17 | |
| 24 | 18 | echo '<div class="frm_form_widget">'; |
| 25 | - | |
| 26 | 19 | if ( $title ) { |
| 27 | - FrmAppHelper::kses_echo( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); | |
| 20 | + echo FrmAppHelper::kses( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 28 | 21 | } |
| 29 | 22 | |
| 30 | 23 | $form_atts = array( |
| 31 | - 'id' => $instance['form'] ?? 0, | |
| 24 | + 'id' => isset( $instance['form'] ) ? $instance['form'] : 0, | |
| 32 | 25 | 'title' => false, |
| 33 | - 'description' => $instance['description'] ?? false, | |
| 26 | + 'description' => isset( $instance['description'] ) ? $instance['description'] : false, | |
| 34 | 27 | ); |
| 35 | 28 | |
| 36 | 29 | echo FrmFormsController::get_form_shortcode( $form_atts ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 37 | 30 | |
| 38 | 31 | echo '</div>'; |
| 39 | - FrmAppHelper::kses_echo( $args['after_widget'], 'all' ); | |
| 32 | + echo FrmAppHelper::kses( $args['after_widget'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 40 | 33 | } |
| 41 | 34 | |
| 42 | - /** | |
| 43 | - * @param array $new_instance New settings for this instance as input by the user via | |
| 44 | - * WP_Widget::form(). | |
| 45 | - * @param array $old_instance Old settings for this instance. | |
| 46 | - * | |
| 47 | - * @return array Settings to save or bool false to cancel saving. | |
| 48 | - */ | |
| 49 | 35 | public function update( $new_instance, $old_instance ) { |
| 50 | 36 | return $new_instance; |
| 51 | 37 | } |
| 52 | 38 | |
| 53 | - /** | |
| 54 | - * Outputs the settings update form. | |
| 55 | - * | |
| 56 | - * @param array $instance Current settings. | |
| 57 | - * | |
| 58 | - * @return string Default return is 'noform'. | |
| 59 | - */ | |
| 60 | 39 | public function form( $instance ) { |
| 61 | 40 | $defaults = array( |
| 62 | 41 | 'title' => false, |
| 63 | 42 | 'form' => false, |
| @@ -62,10 +41,9 @@ | ||
| 62 | 41 | 'title' => false, |
| 63 | 42 | 'form' => false, |
| 64 | 43 | 'description' => false, |
| 65 | 44 | ); |
| 66 | - $instance = wp_parse_args( $instance, $defaults ); | |
| 67 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 45 | + $instance = wp_parse_args( (array) $instance, $defaults ); | |
| 68 | 46 | ?> |
| 69 | 47 | <p> |
| 70 | 48 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> |
| 71 | 49 | <?php esc_html_e( 'Title', 'formidable' ); ?>: |
| @@ -101,8 +79,6 @@ | ||
| 101 | 79 | <?php esc_html_e( 'Show Description', 'formidable' ); ?> |
| 102 | 80 | </label> |
| 103 | 81 | </p> |
| 104 | 82 | <?php |
| 105 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 106 | - return ''; | |
| 107 | 83 | } |
| 108 | 84 | } |