PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.26
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.26
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 6.26, at classes/widgets/FrmShowForm.php

107 lines 3.1 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 /**
14 * @param array $args
15 * @param array $instance
16 *
17 * @return void
18 */
19 public function widget( $args, $instance ) {
20 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
21
22 FrmAppHelper::kses_echo( $args['before_widget'], 'all' );
23
24 echo '<div class="frm_form_widget">';
25
26 if ( $title ) {
27 FrmAppHelper::kses_echo( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' );
28 }
29
30 $form_atts = array(
31 'id' => $instance['form'] ?? 0,
32 'title' => false,
33 'description' => $instance['description'] ?? false,
34 );
35
36 echo FrmFormsController::get_form_shortcode( $form_atts ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
37
38 echo '</div>';
39 FrmAppHelper::kses_echo( $args['after_widget'], 'all' );
40 }
41
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 public function update( $new_instance, $old_instance ) {
50 return $new_instance;
51 }
52
53 /**
54 * Outputs the settings update form.
55 *
56 * @param array $instance Current settings.
57 *
58 * @return string Default return is 'noform'.
59 */
60 public function form( $instance ) {
61 $defaults = array(
62 'title' => false,
63 'form' => false,
64 'description' => false,
65 );
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>
77
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>
94
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 '';
105 }
106 }
107