PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 2.05.09
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v2.05.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 / views / frm-fields / input.php

input.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 2.05.09, at classes/views/frm-fields/input.php

150 lines 6.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( in_array( $field['type'], array( 'email', 'url', 'text' ) ) ) { ?>
2 <input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action('frm_field_input_html', $field) ?>/>
3 <?php } else if ( $field['type'] == 'textarea' ) { ?>
4 <textarea name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php
5 if ( $field['max'] ) {
6 echo 'rows="' . esc_attr( $field['max'] ) . '" ';
7 }
8 do_action('frm_field_input_html', $field);
9 ?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea>
10 <?php
11
12 } else if ( $field['type'] == 'radio' ) {
13 $read_only = false;
14 if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
15 $read_only = true;
16 ?>
17 <input type="hidden" value="<?php echo esc_attr( $field['value'] ) ?>" name="<?php echo esc_attr( $field_name ) ?>" />
18 <?php
19 }
20
21 if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) {
22 do_action( 'frm_after_checkbox', array(
23 'field' => $field,
24 'field_name' => $field_name,
25 'type' => $field['type'],
26 ) );
27 } else if ( is_array($field['options']) ) {
28 foreach ( $field['options'] as $opt_key => $opt ) {
29 if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] !== $opt_key ) ) {
30 continue;
31 }
32
33 $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field );
34 $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field );
35 ?>
36 <div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>">
37 <?php if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { ?>
38 <label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>">
39 <?php
40 }
41 $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' ';
42
43 $other_opt = false;
44 $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked );
45 ?>
46 <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ); ?>" <?php echo $checked; ?><?php do_action( 'frm_field_input_html', $field ); ?> />
47 <?php
48
49 if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
50 echo ' ' . $opt . '</label>';
51 }
52
53 FrmFieldsHelper::include_other_input( array(
54 'other_opt' => $other_opt,
55 'read_only' => $read_only,
56 'checked' => $checked,
57 'name' => $other_args['name'],
58 'value' => $other_args['value'],
59 'field' => $field,
60 'html_id' => $html_id,
61 'opt_key' => $opt_key,
62 ) );
63
64 unset( $other_opt, $other_args );
65 ?>
66 </div>
67 <?php
68 }
69 }
70 } else if ( $field['type'] == 'select' ) {
71 include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/dropdown-field.php' );
72 } else if ( $field['type'] == 'checkbox' ) {
73 $checked_values = $field['value'];
74 $read_only = false;
75
76 if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) {
77 $read_only = true;
78 if ( $checked_values ) {
79 foreach ( (array) $checked_values as $checked_value ) {
80 ?>
81 <input type="hidden" value="<?php echo esc_attr( $checked_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" />
82 <?php
83 }
84 } else {
85 ?>
86 <input type="hidden" value="" name="<?php echo esc_attr( $field_name ) ?>[]" />
87 <?php
88 }
89 }
90
91 if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) {
92 do_action( 'frm_after_checkbox', array(
93 'field' => $field,
94 'field_name' => $field_name,
95 'type' => $field['type'],
96 ) );
97 } elseif ( $field['options'] ) {
98 foreach ( $field['options'] as $opt_key => $opt ) {
99 if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] !== $opt_key ) ) {
100 continue;
101 }
102
103 $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field);
104 $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field);
105 $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : '';
106
107 // Check if other opt, and get values for other field if needed
108 $other_opt = false;
109 $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked );
110
111 ?>
112 <div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="<?php echo esc_attr( FrmFieldsHelper::get_checkbox_id( $field, $opt_key ) ) ?>">
113 <?php if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { ?>
114 <label for="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>">
115 <?php } ?>
116 <input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> />
117 <?php
118
119 if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) {
120 echo ' ' . $opt . '</label>';
121 }
122
123 FrmFieldsHelper::include_other_input( array(
124 'other_opt' => $other_opt,
125 'read_only' => $read_only,
126 'checked' => $checked,
127 'name' => $other_args['name'],
128 'value' => $other_args['value'],
129 'field' => $field,
130 'html_id' => $html_id,
131 'opt_key' => $opt_key,
132 ) );
133
134 unset( $other_opt, $other_args, $checked );
135
136 ?>
137 </div>
138 <?php
139 }
140 }
141 } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) {
142 $frm_settings = FrmAppHelper::get_settings();
143 if ( ! empty($frm_settings->pubkey) ) {
144 FrmFieldsHelper::display_recaptcha($field);
145 }
146 } else {
147 do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) );
148 do_action( 'frm_form_field_' . $field['type'], $field, $field_name, compact( 'errors', 'html_id' ) );
149 }
150