PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.0.03
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.0.03
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 / views / frm-entries / form.php

form.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 5.0.03, at classes/views/frm-entries/form.php

109 lines 4.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 if ( empty( $values ) || ! isset( $values['fields'] ) || empty( $values['fields'] ) ) { ?>
7 <div class="frm_forms <?php echo esc_attr( FrmFormsHelper::get_form_style_class( $form ) ); ?>" id="frm_form_<?php echo esc_attr( $form->id ); ?>_container">
8 <div class="frm_error_style">
9 <strong><?php esc_html_e( 'Oops!', 'formidable' ); ?></strong>
10 <?php
11 printf(
12 /* translators: %1$s: HTML open link, %2$s: HTML close link */
13 esc_html__( 'You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable' ),
14 '<a href="' . esc_url( FrmForm::get_edit_link( $form->id ) ) . '">',
15 '</a>'
16 );
17 ?>
18 </div>
19 </div>
20 <?php
21 return;
22 }
23
24 global $frm_vars;
25 FrmFormsController::maybe_load_css( $form, $values['custom_style'], $frm_vars['load_css'] );
26
27 // Get conditionally hidden fields
28 $frm_hide_fields = FrmAppHelper::get_post_param( 'frm_hide_fields_' . $form->id, '', 'sanitize_text_field' );
29
30 ?>
31 <div class="frm_form_fields <?php echo esc_attr( apply_filters( 'frm_form_fields_class', '', $values ) ); ?>">
32 <fieldset>
33 <?php echo FrmFormsHelper::replace_shortcodes( $values['before_html'], $form, $title, $description ); // WPCS: XSS ok. ?>
34 <div <?php echo wp_strip_all_tags( apply_filters( 'frm_fields_container_class', 'class="frm_fields_container"' ) ); // WPCS: XSS ok. ?>>
35 <?php do_action( 'frm_after_title', compact( 'form' ) ); ?>
36 <input type="hidden" name="frm_action" value="<?php echo esc_attr( $form_action ); ?>" />
37 <input type="hidden" name="form_id" value="<?php echo esc_attr( $form->id ); ?>" />
38 <input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ); ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ); ?>" value="<?php echo esc_attr( $frm_hide_fields ); ?>" />
39 <input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ); ?>" />
40 <input type="hidden" name="item_meta[0]" value="" />
41 <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?>
42 <?php if ( isset( $id ) ) { ?>
43 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
44 <?php } ?>
45 <?php
46 if ( $values['fields'] ) {
47 FrmFieldsHelper::show_fields( $values['fields'], $errors, $form, $form_action );
48 }
49
50 $frm_settings = FrmAppHelper::get_settings();
51 if ( FrmAppHelper::is_admin() ) {
52 ?>
53 <div class="frm_form_field form-field">
54 <label class="frm_primary_label"><?php esc_html_e( 'Entry Key', 'formidable' ); ?></label>
55 <input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ); ?>" />
56 </div>
57 <?php
58 } else {
59 ?>
60 <input type="hidden" name="item_key" value="<?php echo esc_attr( $values['item_key'] ); ?>" />
61 <?php
62 FrmHoneypot::maybe_render_field( $form->id );
63 }
64
65 do_action( 'frm_entry_form', $form, $form_action, $errors );
66
67 global $frm_vars;
68 // close open section div
69 if ( isset( $frm_vars['div'] ) && $frm_vars['div'] ) {
70 echo "</div>\n";
71 unset( $frm_vars['div'] );
72 }
73
74 // close open collapsible toggle div
75 if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) {
76 echo "</div>\n";
77 unset( $frm_vars['collapse_div'] );
78 }
79
80 echo FrmFormsHelper::replace_shortcodes( $values['after_html'], $form ); // WPCS: XSS ok.
81
82 if ( FrmForm::show_submit( $form ) ) {
83 $copy_values = $values;
84 unset( $copy_values['fields'] );
85
86 if ( isset( $form->options['form_class'] ) && strpos( $form->options['form_class'], 'frm_inline_success' ) !== false ) {
87 ob_start();
88 ob_implicit_flush( false );
89 FrmFormsHelper::get_custom_submit( $copy_values['submit_html'], $form, $submit, $form_action, $copy_values );
90 $clip = ob_get_clean();
91
92 ob_start();
93 ob_implicit_flush( false );
94 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php';
95 $message = ob_get_clean();
96
97 echo preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $message . '</div>', $clip ); // WPCS: XSS ok.
98 } else {
99 FrmFormsHelper::get_custom_submit( $copy_values['submit_html'], $form, $submit, $form_action, $copy_values );
100 }
101 }
102 ?>
103 </div>
104 </fieldset>
105 </div>
106 <?php if ( has_action( 'frm_entries_footer_scripts' ) ) { ?>
107 <script type="text/javascript"><?php do_action( 'frm_entries_footer_scripts', $values['fields'], $form ); ?></script>
108 <?php } ?>
109