PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 3.06.06
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v3.06.06
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/widgets/FrmShowForm.php +40 -71 6.263.06.06 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - die( 'You are not allowed to call this page directly.' );
4 -}
5 2
6 3 class FrmShowForm extends WP_Widget {
7 4
8 5 public function __construct() {
@@ -9,98 +6,70 @@
9 6 $widget_ops = array( 'description' => __( 'Display a Formidable Form', 'formidable' ) );
10 7 parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops );
11 8 }
12 9
13 - /**
14 - * @param array $args
15 - * @param array $instance
16 - *
17 - * @return void
18 - */
19 10 public function widget( $args, $instance ) {
20 - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
11 + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
21 12
22 - FrmAppHelper::kses_echo( $args['before_widget'], 'all' );
13 + echo FrmAppHelper::kses( $args['before_widget'], 'all' ); // WPCS: XSS ok.
23 14
24 15 echo '<div class="frm_form_widget">';
25 -
26 16 if ( $title ) {
27 - FrmAppHelper::kses_echo( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' );
17 + echo FrmAppHelper::kses( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); // WPCS: XSS ok.
28 18 }
29 19
30 20 $form_atts = array(
31 - 'id' => $instance['form'] ?? 0,
32 - 'title' => false,
33 - 'description' => $instance['description'] ?? false,
21 + 'id' => isset( $instance['form'] ) ? $instance['form'] : 0,
22 + 'title' => false,
23 + 'description' => isset( $instance['description'] ) ? $instance['description'] : false,
34 24 );
35 25
36 - echo FrmFormsController::get_form_shortcode( $form_atts ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
26 + echo FrmFormsController::get_form_shortcode( $form_atts ); // WPCS: XSS ok.
37 27
38 28 echo '</div>';
39 - FrmAppHelper::kses_echo( $args['after_widget'], 'all' );
29 + echo FrmAppHelper::kses( $args['after_widget'], 'all' ); // WPCS: XSS ok.
40 30 }
41 31
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 32 public function update( $new_instance, $old_instance ) {
50 33 return $new_instance;
51 34 }
52 35
53 - /**
54 - * Outputs the settings update form.
55 - *
56 - * @param array $instance Current settings.
57 - *
58 - * @return string Default return is 'noform'.
59 - */
60 36 public function form( $instance ) {
61 37 $defaults = array(
62 - 'title' => false,
63 - 'form' => false,
38 + 'title' => false,
39 + 'form' => false,
64 40 'description' => false,
65 41 );
66 - $instance = wp_parse_args( $instance, $defaults );
67 - ?>
68 - <p>
69 - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
70 - <?php esc_html_e( 'Title', 'formidable' ); ?>:
71 - </label>
72 - <br/>
73 - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
74 - name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
75 - value="<?php echo esc_attr( stripslashes( $instance['title'] ) ); ?>"/>
76 - </p>
42 + $instance = wp_parse_args( (array) $instance, $defaults );
43 +?>
44 + <p>
45 + <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
46 + <?php esc_html_e( 'Title', 'formidable' ); ?>:
47 + </label>
48 + <br/>
49 + <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( stripslashes( $instance['title'] ) ); ?>" />
50 + </p>
77 51
78 - <p>
79 - <label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>">
80 - <?php esc_html_e( 'Form', 'formidable' ); ?>:
81 - </label><br/>
82 - <?php
83 - FrmFormsHelper::forms_dropdown(
84 - $this->get_field_name( 'form' ),
85 - $instance['form'],
86 - array(
87 - 'blank' => false,
88 - 'field_id' => $this->get_field_id( 'form' ),
89 - 'class' => 'widefat',
90 - )
91 - );
92 - ?>
93 - </p>
52 + <p>
53 + <label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>"><?php esc_html_e( 'Form', 'formidable' ); ?>:</label><br/>
54 +<?php
55 + FrmFormsHelper::forms_dropdown(
56 + $this->get_field_name( 'form' ),
57 + $instance['form'],
58 + array(
59 + 'blank' => false,
60 + 'field_id' => $this->get_field_id( 'form' ),
61 + 'class' => 'widefat',
62 + )
63 + );
64 +?>
65 + </p>
94 66
95 - <p>
96 - <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>">
97 - <input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ); ?>
98 - id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"
99 - name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" value="1" />
100 - <?php esc_html_e( 'Show Description', 'formidable' ); ?>
101 - </label>
102 - </p>
103 - <?php
104 - return '';
67 + <p>
68 + <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>">
69 + <input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ); ?> id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" value="1" />
70 + <?php esc_html_e( 'Show Description', 'formidable' ); ?>
71 + </label>
72 + </p>
73 +<?php
105 74 }
106 75 }