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

98 lines 3.3 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' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
17
18 echo '<div class="frm_form_widget">';
19 if ( $title ) {
20 echo FrmAppHelper::kses( $args['before_title'] . stripslashes( $title ) . $args['after_title'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
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 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
30
31 echo '</div>';
32 echo FrmAppHelper::kses( $args['after_widget'], 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
33 }
34
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 public function update( $new_instance, $old_instance ) {
42 return $new_instance;
43 }
44
45 /**
46 * Outputs the settings update form.
47 *
48 * @param array $instance Current settings.
49 * @return string Default return is 'noform'.
50 */
51 public function form( $instance ) {
52 $defaults = array(
53 'title' => false,
54 'form' => false,
55 'description' => false,
56 );
57 $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>
68
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>
85
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';
96 }
97 }
98