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

118 lines 4.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 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 FrmAppHelper::maybe_kses( FrmFormsHelper::replace_shortcodes( $values['before_html'], $form, $title, $description ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
34 <div <?php echo wp_strip_all_tags( apply_filters( 'frm_fields_container_class', 'class="frm_fields_container"' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
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 /**
48 * Allows modifying the list of fields in the frontend form.
49 *
50 * @since 5.0.04
51 *
52 * @param array $fields Array of fields.
53 * @param array $args The arguments. Contains `form`.
54 */
55 $fields_to_show = apply_filters( 'frm_fields_in_form', $values['fields'], compact( 'form' ) );
56 FrmFieldsHelper::show_fields( $fields_to_show, $errors, $form, $form_action );
57 }
58
59 $frm_settings = FrmAppHelper::get_settings();
60 if ( FrmAppHelper::is_admin() ) {
61 ?>
62 <div class="frm_form_field form-field">
63 <label class="frm_primary_label"><?php esc_html_e( 'Entry Key', 'formidable' ); ?></label>
64 <input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ); ?>" />
65 </div>
66 <?php
67 } else {
68 ?>
69 <input type="hidden" name="item_key" value="<?php echo esc_attr( $values['item_key'] ); ?>" />
70 <?php
71 FrmHoneypot::maybe_render_field( $form->id );
72 }
73
74 do_action( 'frm_entry_form', $form, $form_action, $errors );
75
76 global $frm_vars;
77 // close open section div
78 if ( isset( $frm_vars['div'] ) && $frm_vars['div'] ) {
79 echo "</div>\n";
80 unset( $frm_vars['div'] );
81 }
82
83 // close open collapsible toggle div
84 if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) {
85 echo "</div>\n";
86 unset( $frm_vars['collapse_div'] );
87 }
88
89 echo FrmAppHelper::maybe_kses( FrmFormsHelper::replace_shortcodes( $values['after_html'], $form ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
90
91 if ( FrmForm::show_submit( $form ) ) {
92 $copy_values = $values;
93 unset( $copy_values['fields'] );
94
95 if ( isset( $form->options['form_class'] ) && strpos( $form->options['form_class'], 'frm_inline_success' ) !== false ) {
96 ob_start();
97 ob_implicit_flush( false );
98 FrmFormsHelper::get_custom_submit( $copy_values['submit_html'], $form, $submit, $form_action, $copy_values );
99 $clip = ob_get_clean();
100
101 ob_start();
102 ob_implicit_flush( false );
103 include FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php';
104 $message = ob_get_clean();
105
106 echo preg_replace( '~\<\/div\>(?!.*\<\/div\>)~', $message . '</div>', $clip ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
107 } else {
108 FrmFormsHelper::get_custom_submit( $copy_values['submit_html'], $form, $submit, $form_action, $copy_values );
109 }
110 }
111 ?>
112 </div>
113 </fieldset>
114 </div>
115 <?php if ( has_action( 'frm_entries_footer_scripts' ) ) { ?>
116 <script type="text/javascript"><?php do_action( 'frm_entries_footer_scripts', $values['fields'], $form ); ?></script>
117 <?php } ?>
118