PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0.09
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0.09
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
formidable / classes / widgets / FrmShowForm.php

FrmShowForm.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 5.0.09, at classes/widgets/FrmShowForm.php

85 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 class FrmShowForm extends WP_Widget {
7
8 public function __construct() {
9 $widget_ops = array( 'description' => __( 'Display a Formidable Form', 'formidable' ) );
10 parent::__construct( 'frm_show_form', __( 'Formidable Form', 'formidable' ), $widget_ops );
11 }
12
13 public function widget( $args, $instance ) {
14 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
15
16 echo FrmAppHelper::kses( $args['before_widget'], 'all' ); // WPCS: XSS ok.
17
18 echo '<div class="frm_form_widget">';
19 if ( $title ) {
20 echo FrmAppHelper::kses( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); // WPCS: XSS ok.
21 }
22
23 $form_atts = array(
24 'id' => isset( $instance['form'] ) ? $instance['form'] : 0,
25 'title' => false,
26 'description' => isset( $instance['description'] ) ? $instance['description'] : false,
27 );
28
29 echo FrmFormsController::get_form_shortcode( $form_atts ); // WPCS: XSS ok.
30
31 echo '</div>';
32 echo FrmAppHelper::kses( $args['after_widget'], 'all' ); // WPCS: XSS ok.
33 }
34
35 public function update( $new_instance, $old_instance ) {
36 return $new_instance;
37 }
38
39 public function form( $instance ) {
40 $defaults = array(
41 'title' => false,
42 'form' => false,
43 'description' => false,
44 );
45 $instance = wp_parse_args( (array) $instance, $defaults );
46 ?>
47 <p>
48 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
49 <?php esc_html_e( 'Title', 'formidable' ); ?>:
50 </label>
51 <br/>
52 <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
53 name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
54 value="<?php echo esc_attr( stripslashes( $instance['title'] ) ); ?>"/>
55 </p>
56
57 <p>
58 <label for="<?php echo esc_attr( $this->get_field_id( 'form' ) ); ?>">
59 <?php esc_html_e( 'Form', 'formidable' ); ?>:
60 </label><br/>
61 <?php
62 FrmFormsHelper::forms_dropdown(
63 $this->get_field_name( 'form' ),
64 $instance['form'],
65 array(
66 'blank' => false,
67 'field_id' => $this->get_field_id( 'form' ),
68 'class' => 'widefat',
69 )
70 );
71 ?>
72 </p>
73
74 <p>
75 <label for="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>">
76 <input class="checkbox" type="checkbox" <?php checked( $instance['description'], true ); ?>
77 id="<?php echo esc_attr( $this->get_field_id( 'description' ) ); ?>"
78 name="<?php echo esc_attr( $this->get_field_name( 'description' ) ); ?>" value="1" />
79 <?php esc_html_e( 'Show Description', 'formidable' ); ?>
80 </label>
81 </p>
82 <?php
83 }
84 }
85