| @@ -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() { |
| @@ -10,88 +7,69 @@ | ||
| 10 | 7 | parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops ); |
| 11 | 8 | } |
| 12 | 9 | |
| 13 | 10 | public function widget( $args, $instance ) { |
| 14 | - $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 ); | |
| 15 | 12 | |
| 16 | - echo FrmAppHelper::kses( $args['before_widget'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 13 | + echo FrmAppHelper::kses( $args['before_widget'], 'all' ); // WPCS: XSS ok. | |
| 17 | 14 | |
| 18 | 15 | echo '<div class="frm_form_widget">'; |
| 19 | 16 | if ( $title ) { |
| 20 | - echo FrmAppHelper::kses( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 17 | + echo FrmAppHelper::kses( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); // WPCS: XSS ok. | |
| 21 | 18 | } |
| 22 | 19 | |
| 23 | 20 | $form_atts = array( |
| 24 | - 'id' => isset( $instance['form'] ) ? $instance['form'] : 0, | |
| 25 | - 'title' => false, | |
| 21 | + 'id' => isset( $instance['form'] ) ? $instance['form'] : 0, | |
| 22 | + 'title' => false, | |
| 26 | 23 | 'description' => isset( $instance['description'] ) ? $instance['description'] : false, |
| 27 | 24 | ); |
| 28 | 25 | |
| 29 | - echo FrmFormsController::get_form_shortcode( $form_atts ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 26 | + echo FrmFormsController::get_form_shortcode( $form_atts ); // WPCS: XSS ok. | |
| 30 | 27 | |
| 31 | 28 | echo '</div>'; |
| 32 | - echo FrmAppHelper::kses( $args['after_widget'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 29 | + echo FrmAppHelper::kses( $args['after_widget'], 'all' ); // WPCS: XSS ok. | |
| 33 | 30 | } |
| 34 | 31 | |
| 35 | - /** | |
| 36 | - * @param array $new_instance New settings for this instance as input by the user via | |
| 37 | - * WP_Widget::form(). | |
| 38 | - * @param array $old_instance Old settings for this instance. | |
| 39 | - * @return array Settings to save or bool false to cancel saving. | |
| 40 | - */ | |
| 41 | 32 | public function update( $new_instance, $old_instance ) { |
| 42 | 33 | return $new_instance; |
| 43 | 34 | } |
| 44 | 35 | |
| 45 | - /** | |
| 46 | - * Outputs the settings update form. | |
| 47 | - * | |
| 48 | - * @param array $instance Current settings. | |
| 49 | - * @return string Default return is 'noform'. | |
| 50 | - */ | |
| 51 | 36 | public function form( $instance ) { |
| 52 | 37 | $defaults = array( |
| 53 | - 'title' => false, | |
| 54 | - 'form' => false, | |
| 38 | + 'title' => false, | |
| 39 | + 'form' => false, | |
| 55 | 40 | 'description' => false, |
| 56 | 41 | ); |
| 57 | 42 | $instance = wp_parse_args( (array) $instance, $defaults ); |
| 58 | - ?> | |
| 59 | - <p> | |
| 60 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> | |
| 61 | - <?php esc_html_e( 'Title', 'formidable' ); ?>: | |
| 62 | - </label> | |
| 63 | - <br/> | |
| 64 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" | |
| 65 | - name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" | |
| 66 | - value="<?php echo esc_attr( stripslashes( $instance['title'] ) ); ?>"/> | |
| 67 | - </p> | |
| 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> | |
| 68 | 51 | |
| 69 | - <p> | |
| 70 | - <label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>"> | |
| 71 | - <?php esc_html_e( 'Form', 'formidable' ); ?>: | |
| 72 | - </label><br/> | |
| 73 | - <?php | |
| 74 | - FrmFormsHelper::forms_dropdown( | |
| 75 | - $this->get_field_name( 'form' ), | |
| 76 | - $instance['form'], | |
| 77 | - array( | |
| 78 | - 'blank' => false, | |
| 79 | - 'field_id' => $this->get_field_id( 'form' ), | |
| 80 | - 'class' => 'widefat', | |
| 81 | - ) | |
| 82 | - ); | |
| 83 | - ?> | |
| 84 | - </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> | |
| 85 | 66 | |
| 86 | - <p> | |
| 87 | - <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"> | |
| 88 | - <input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ); ?> | |
| 89 | - id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>" | |
| 90 | - name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" value="1" /> | |
| 91 | - <?php esc_html_e( 'Show Description', 'formidable' ); ?> | |
| 92 | - </label> | |
| 93 | - </p> | |
| 94 | - <?php | |
| 95 | - return 'noform'; | |
| 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 | |
| 96 | 74 | } |
| 97 | 75 | } |