| @@ -9,29 +9,22 @@ | ||
| 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 | 16 | FrmAppHelper::kses_echo( $args['before_widget'], 'all' ); |
| 23 | 17 | |
| 24 | 18 | echo '<div class="frm_form_widget">'; |
| 25 | - | |
| 26 | 19 | if ( $title ) { |
| 27 | 20 | FrmAppHelper::kses_echo( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); |
| 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 | |
| @@ -42,9 +35,8 @@ | ||
| 42 | 35 | /** |
| 43 | 36 | * @param array $new_instance New settings for this instance as input by the user via |
| 44 | 37 | * WP_Widget::form(). |
| 45 | 38 | * @param array $old_instance Old settings for this instance. |
| 46 | - * | |
| 47 | 39 | * @return array Settings to save or bool false to cancel saving. |
| 48 | 40 | */ |
| 49 | 41 | public function update( $new_instance, $old_instance ) { |
| 50 | 42 | return $new_instance; |
| @@ -53,9 +45,8 @@ | ||
| 53 | 45 | /** |
| 54 | 46 | * Outputs the settings update form. |
| 55 | 47 | * |
| 56 | 48 | * @param array $instance Current settings. |
| 57 | - * | |
| 58 | 49 | * @return string Default return is 'noform'. |
| 59 | 50 | */ |
| 60 | 51 | public function form( $instance ) { |
| 61 | 52 | $defaults = array( |
| @@ -62,10 +53,9 @@ | ||
| 62 | 53 | 'title' => false, |
| 63 | 54 | 'form' => false, |
| 64 | 55 | 'description' => false, |
| 65 | 56 | ); |
| 66 | - $instance = wp_parse_args( $instance, $defaults ); | |
| 67 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 57 | + $instance = wp_parse_args( (array) $instance, $defaults ); | |
| 68 | 58 | ?> |
| 69 | 59 | <p> |
| 70 | 60 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> |
| 71 | 61 | <?php esc_html_e( 'Title', 'formidable' ); ?>: |
| @@ -101,8 +91,7 @@ | ||
| 101 | 91 | <?php esc_html_e( 'Show Description', 'formidable' ); ?> |
| 102 | 92 | </label> |
| 103 | 93 | </p> |
| 104 | 94 | <?php |
| 105 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 106 | 95 | return ''; |
| 107 | 96 | } |
| 108 | 97 | } |