|
@@ -17,34 +17,8 @@ |
|
17
|
17
|
* @author GeoDirectory Team <info@wpgeodirectory.com> |
|
18
|
18
|
*/ |
|
19
|
19
|
class UsersWP_Form_Builder { |
|
20
|
20
|
|
|
21
|
|
- public static function get_form_id() { |
|
22
|
|
- $register_forms = (array) uwp_get_option( 'multiple_registration_forms', array() ); |
|
23
|
|
- |
|
24
|
|
- if ( isset( $_GET['form'] ) && ! empty( $_GET['form'] ) ) { |
|
25
|
|
- $current_form_id = absint( $_GET['form'] ); |
|
26
|
|
- } elseif ( ! empty( $register_forms ) ) { |
|
27
|
|
- $default_form = array_filter( |
|
28
|
|
- $register_forms, |
|
29
|
|
- function ( $form ) { |
|
30
|
|
- return (int) $form['id'] === 1; |
|
31
|
|
- } |
|
32
|
|
- ); |
|
33
|
|
- |
|
34
|
|
- $default_form = array_shift( $default_form ); |
|
35
|
|
- |
|
36
|
|
- if ( isset( $default_form['id'] ) ) { |
|
37
|
|
- $current_form_id = (int) $default_form['id']; |
|
38
|
|
- } else { |
|
39
|
|
- $current_form = reset( $register_forms ); |
|
40
|
|
- $current_form_id = isset( $current_form['id'] ) ? absint( $current_form['id'] ) : 1; |
|
41
|
|
- } |
|
42
|
|
- } |
|
43
|
|
- |
|
44
|
|
- return $current_form_id; |
|
45
|
|
- } |
|
46
|
|
- |
|
47
|
21
|
public static function output( $tab = '' ) { |
|
48
|
22
|
|
|
49
|
23
|
global $current_tab; |
|
50
|
24
|
|
|
@@ -57,20 +31,17 @@ |
|
57
|
31
|
$current_tab = empty( $_GET['tab'] ) ? 'account' : sanitize_title( $_GET['tab'] ); |
|
58
|
32
|
} |
|
59
|
33
|
|
|
60
|
34
|
$form = ''; |
|
61
|
|
- if ( isset( $_GET['form'] ) && ! empty( $_GET['form'] ) ) { |
|
62
|
|
- $form = '&form=' . (int) $_GET['form']; |
|
35
|
+ if(isset($_GET['form']) && !empty($_GET['form'])){ |
|
36
|
+ $form = '&form='.(int) $_GET['form']; |
|
63
|
37
|
} |
|
64
|
38
|
|
|
65
|
39
|
// Get tabs for the form builder page |
|
66
|
|
- $tabs = apply_filters( |
|
67
|
|
- 'uwp_form_builder_tabs_array', |
|
68
|
|
- array( |
|
69
|
|
- 'account' => __( 'Account', 'userswp' ), |
|
70
|
|
- 'register' => __( 'Register', 'userswp' ), |
|
71
|
|
- ) |
|
72
|
|
- ); |
|
40
|
+ $tabs = apply_filters( 'uwp_form_builder_tabs_array', array( |
|
41
|
+ 'account' => __( 'Account', 'userswp' ), |
|
42
|
+ 'register' => __( 'Register', 'userswp' ), |
|
43
|
+ ) ); |
|
73
|
44
|
|
|
74
|
45
|
?> |
|
75
|
46
|
<div class="wrap"> |
|
76
|
47
|
<nav class="nav-tab-wrapper uwp-nav-tab-wrapper"> |
|
@@ -90,150 +61,115 @@ |
|
90
|
61
|
</div> |
|
91
|
62
|
<?php |
|
92
|
63
|
} |
|
93
|
64
|
|
|
94
|
|
- public function uwp_form_builder( $default_tab = 'account' ) { |
|
95
|
|
- ob_start(); |
|
96
|
|
- $form_type = ( isset( $_GET['tab'] ) && $_GET['tab'] != '' ) ? sanitize_text_field( $_GET['tab'] ) : $default_tab; |
|
97
|
|
- ?> |
|
98
|
|
- <div class="uwp-settings-wrap bsui"> |
|
65
|
+ public function uwp_form_builder( $default_tab = 'account' ) { |
|
66
|
+ ob_start(); |
|
67
|
+ $form_type = ( isset( $_GET['tab'] ) && $_GET['tab'] != '' ) ? sanitize_text_field( $_GET['tab'] ) : $default_tab; |
|
68
|
+ ?> |
|
69
|
+ <div class="uwp-panel-heading"> |
|
70
|
+ <h3><?php echo apply_filters( 'uwp_form_builder_panel_head', '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></h3> |
|
71
|
+ </div> |
|
99
|
72
|
|
|
100
|
|
- <div class="container-fluid p-0 mt-3"> |
|
101
|
|
- <?php do_action( 'uwp_before_form_builder_content', $default_tab ); ?> |
|
73
|
+ <div class="uwp-before-form-builder-container"> |
|
74
|
+ <?php do_action( 'uwp_before_form_builder_content', $default_tab ); ?> |
|
75
|
+ </div> |
|
102
|
76
|
|
|
103
|
|
- <div id="uwp_form_builder_container" class="row"> |
|
104
|
|
- <div class="col-md-6"> |
|
77
|
+ <div id="uwp_form_builder_container" class="clearfix"> |
|
78
|
+ <div class="uwp-form-builder-frame"> |
|
105
|
79
|
|
|
106
|
|
- <!-- required for tabs to work --> |
|
107
|
|
- <ul class="nav nav-tabs d-none " role="tablist"> |
|
108
|
|
- <li class="nav-item" role="presentation"> |
|
109
|
|
- <a class="nav-link active" id="uwp-fields-tab" data-toggle="tab" href="#uwp-available-fields" role="tab" aria-controls="home" aria-selected="true">1</a> |
|
110
|
|
- </li> |
|
111
|
|
- <li class="nav-item" role="presentation"> |
|
112
|
|
- <a class="nav-link" id="uwp-field-settings-tab" data-toggle="tab" href="#uwp-field-settings" role="tab" aria-controls="profile" aria-selected="false">2</a> |
|
113
|
|
- </li> |
|
114
|
|
- </ul> |
|
115
|
|
- <!-- required for tabs to work --> |
|
80
|
+ <div class="uwp-side-sortables" id="uwp-available-fields"> |
|
81
|
+ <h3> |
|
82
|
+ <span><?php echo apply_filters( 'uwp_form_builder_available_fields_head', __( 'Add new form field', 'userswp' ), $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> |
|
83
|
+ </h3> |
|
116
|
84
|
|
|
117
|
|
- <div class="tab-content sticky-top" style="top: 40px;"> |
|
85
|
+ <p> |
|
86
|
+ <?php |
|
87
|
+ $note = sprintf( __( 'Click on any box below to add a field of that type on %s form. You must use a fieldset to group your fields.', 'userswp' ), $form_type ); |
|
88
|
+ echo apply_filters( 'uwp_form_builder_available_fields_note', $note, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
89
|
+ ?> |
|
90
|
+ </p> |
|
118
|
91
|
|
|
119
|
|
- <div class="side-sortables side-sortables tab-pane fade show active card p-0 mw-100 w-100 border-0 shadow-sm" id="uwp-available-fields" role="tabpanel"> |
|
120
|
|
- <div class="card border-0 shadow-sm mb-4 px-0 mw-100"> |
|
121
|
|
- <div class="card-header bg-white"> |
|
122
|
|
- <h3 class="h5 mb-0 text-dark py-0"> |
|
123
|
|
- <span><?php echo apply_filters( 'uwp_form_builder_available_fields_head', __( 'Add new form field', 'userswp' ), $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> |
|
124
|
|
- </h3> |
|
125
|
|
- </div> |
|
126
|
|
- <div class="card-body"> |
|
127
|
|
- <p> |
|
128
|
|
- <?php |
|
129
|
|
- $note = sprintf( __( 'Click on any box below to add a field of that type on %s form. You must use a fieldset to group your fields.', 'userswp' ), $form_type ); |
|
130
|
|
- echo apply_filters( 'uwp_form_builder_available_fields_note', $note, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
131
|
|
- ?> |
|
132
|
|
- </p> |
|
133
|
|
- <?php do_action( 'uwp_before_available_fields', $default_tab ); ?> |
|
92
|
+ <?php do_action( 'uwp_before_available_fields', $default_tab ); ?> |
|
134
|
93
|
|
|
135
|
|
- <h4 class="h6 text-muted"><?php esc_html_e( 'Standard Fields', 'userswp' ); ?></h4> |
|
136
|
|
- <div id="uwp-form-builder-tab" class="uwp-tabs-panel mb-4"> |
|
137
|
|
- <?php do_action( 'uwp_manage_available_fields', $form_type ); ?> |
|
138
|
|
- </div> |
|
94
|
+ <h3> |
|
95
|
+ <?php esc_html_e( 'Standard Fields', 'userswp' ); ?> |
|
96
|
+ </h3> |
|
139
|
97
|
|
|
140
|
|
- <?php |
|
141
|
|
- $predefined_fields = apply_filters( 'uwp_predefined_fields_tabs', array( 'account', 'profile-tabs' ) ); |
|
142
|
|
- if ( in_array( $form_type, $predefined_fields ) ) { |
|
143
|
|
- ?> |
|
144
|
|
- <h4 class="h6 text-muted"><?php esc_html_e( 'Predefined Fields', 'userswp' ); ?></h4> |
|
145
|
|
- <div id="uwp-form-builder-tab-predefined" class="uwp-tabs-panel mb-4"> |
|
146
|
|
- <?php do_action( 'uwp_manage_available_fields_predefined', $form_type ); ?> |
|
147
|
|
- </div> |
|
148
|
|
- <?php |
|
149
|
|
- } |
|
98
|
+ <div class="inside"> |
|
99
|
+ <div id="uwp-form-builder-tab" class="uwp-tabs-panel"> |
|
100
|
+ <?php do_action( 'uwp_manage_available_fields', $form_type ); ?> |
|
101
|
+ </div> |
|
102
|
+ </div> |
|
103
|
+ <?php |
|
150
|
104
|
|
|
151
|
|
- $custom_fields = apply_filters( 'uwp_custom_fields_tabs', array( 'account', 'profile-tabs' ) ); |
|
152
|
|
- if ( in_array( $form_type, $custom_fields ) ) { |
|
153
|
|
- ?> |
|
154
|
|
- <h4 class="h6 text-muted"><?php esc_html_e( 'Custom Fields', 'userswp' ); ?></h4> |
|
155
|
|
- <div id="uwp-form-builder-tab-custom" class="uwp-tabs-panel"> |
|
156
|
|
- <?php do_action( 'uwp_manage_available_fields_custom', $form_type ); ?> |
|
157
|
|
- </div> |
|
158
|
|
- <?php |
|
159
|
|
- } |
|
105
|
+ $predefined_fields = apply_filters( 'uwp_predefined_fields_tabs', array( |
|
106
|
+ 'account', |
|
107
|
+ 'profile-tabs' |
|
108
|
+ ) ); |
|
109
|
+ if ( in_array( $form_type, $predefined_fields ) ) { |
|
110
|
+ ?> |
|
111
|
+ <h3> |
|
112
|
+ <?php esc_html_e( 'Predefined Fields', 'userswp' ); ?> |
|
113
|
+ </h3> |
|
160
|
114
|
|
|
161
|
|
- do_action( 'uwp_after_available_fields', $default_tab ); |
|
162
|
|
- ?> |
|
115
|
+ <div class="inside"> |
|
116
|
+ <div id="uwp-form-builder-tab-predefined" class="uwp-tabs-panel"> |
|
117
|
+ <?php do_action( 'uwp_manage_available_fields_predefined', $form_type ); ?> |
|
163
|
118
|
</div> |
|
164
|
119
|
</div> |
|
120
|
+ <?php } |
|
121
|
+ |
|
122
|
+ $custom_fields = apply_filters( 'uwp_custom_fields_tabs', array( 'account', 'profile-tabs' ) ); |
|
123
|
+ if ( in_array( $form_type, $custom_fields ) ) { ?> |
|
124
|
+ <h3> |
|
125
|
+ <?php esc_html_e( 'Custom Fields', 'userswp' ); ?> |
|
126
|
+ </h3> |
|
127
|
+ |
|
128
|
+ <div class="inside"> |
|
129
|
+ <div id="uwp-form-builder-tab-custom" class="uwp-tabs-panel"> |
|
130
|
+ <?php do_action( 'uwp_manage_available_fields_custom', $form_type ); ?> |
|
165
|
131
|
</div> |
|
132
|
+ </div> |
|
133
|
+ <?php } |
|
134
|
+ do_action( 'uwp_after_available_fields', $default_tab ); |
|
135
|
+ ?> |
|
136
|
+ </div> |
|
166
|
137
|
|
|
167
|
138
|
|
|
168
|
|
- <div class="side-sortables side-sortables tab-pane fade card p-0 mw-100 w-100 border-0 shadow-sm" id="uwp-field-settings" role="tabpanel"> |
|
169
|
|
- <div class="card border-0 shadow-sm mb-4 px-0 mw-100"> |
|
170
|
|
- <div class="card-header bg-white d-flex justify-content-between"> |
|
171
|
|
- <h3 class="h5 mb-0 text-dark py-0"> |
|
172
|
|
- <span><?php echo apply_filters( 'uwp_form_builder_available_fields_settings_head', __( 'Field Settings', 'userswp' ), $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> |
|
173
|
|
- </h3> |
|
174
|
|
- <?php |
|
175
|
|
- global $aui_bs5; |
|
176
|
|
- if ( $aui_bs5 ) { |
|
177
|
|
- ?> |
|
178
|
|
- <button type="button" class="btn-close align-self-center" aria-label="Close" onclick="uwp_tabs_close_settings(this);"></button> |
|
179
|
|
- <?php } else { ?> |
|
180
|
|
- <button type="button" class="close" aria-label="Close" onclick="uwp_tabs_close_settings(this);"> |
|
181
|
|
- <span aria-hidden="true">×</span> |
|
182
|
|
- </button> |
|
183
|
|
- <?php } ?> |
|
184
|
|
- </div> |
|
139
|
+ <div class="uwp-side-sortables" id="uwp-selected-fields"> |
|
185
|
140
|
|
|
186
|
|
- <form></form> <!-- required as chrome removes first empty form --> |
|
187
|
|
- <form class="uwp-form-settings-form"> |
|
188
|
|
- <div class="card-body scrollbars-ios" style="max-height: 70vh; overflow-y:auto;"> |
|
189
|
|
- </div> |
|
190
|
|
- </form> |
|
141
|
+ <h3> |
|
142
|
+ <span> |
|
143
|
+ <?php |
|
144
|
+ $title = __( 'List of fields that will appear in the account form.', 'userswp' ); |
|
145
|
+ echo apply_filters( 'uwp_form_builder_selected_fields_head', $title, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
|
146
|
+ </span> |
|
147
|
+ </h3> |
|
191
|
148
|
|
|
192
|
|
- <div class="card-footer text-right text-end"> |
|
149
|
+ <p> |
|
150
|
+ <?php |
|
151
|
+ $note = sprintf( __( 'Click to expand and view field related settings. You may drag and drop to arrange fields order on %s form too.', 'userswp' ), $form_type ); |
|
152
|
+ echo apply_filters( 'uwp_form_builder_selected_fields_note', $note, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
|
153
|
+ </p> |
|
193
|
154
|
|
|
194
|
|
- </div> |
|
195
|
|
- </div> |
|
155
|
+ <div class="inside"> |
|
156
|
+ <div id="uwp-form-builder-tab-selected" class="uwp-tabs-panel"> |
|
157
|
+ <div class="field_row_main"> |
|
158
|
+ <?php do_action( 'uwp_manage_selected_fields', $form_type ); ?> |
|
196
|
159
|
</div> |
|
197
|
160
|
</div> |
|
198
|
161
|
</div> |
|
199
|
162
|
|
|
200
|
|
- <div class="col-md-6 uwp-side-sortables" id="uwp-selected-fields"> |
|
201
|
|
- <div class="card border-0 shadow-sm mb-4 px-0 mw-100"> |
|
202
|
|
- <div class="card-header bg-white"> |
|
203
|
|
- <h3 class="h5 mb-0 text-dark py-0"> |
|
204
|
|
- <span> |
|
205
|
|
- <?php |
|
206
|
|
- $title = __( 'List of fields that will appear in the account form.', 'userswp' ); |
|
207
|
|
- echo apply_filters( 'uwp_form_builder_selected_fields_head', $title, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
208
|
|
- ?> |
|
209
|
|
- </span> |
|
210
|
|
- </h3> |
|
211
|
|
- </div> |
|
212
|
|
- <div class="card-body"> |
|
213
|
|
- <p> |
|
214
|
|
- <?php |
|
215
|
|
- $note = sprintf( __( 'Click to expand and view field related settings. You may drag and drop to arrange fields order on %s form too.', 'userswp' ), $form_type ); |
|
216
|
|
- echo apply_filters( 'uwp_form_builder_selected_fields_note', $note, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
217
|
|
- ?> |
|
218
|
|
- </p> |
|
219
|
|
- <div id="uwp-form-builder-tab-selected" class="uwp-tabs-panel"> |
|
220
|
|
- <div class="field_row_main"> |
|
221
|
|
- <?php do_action( 'uwp_manage_selected_fields', $form_type ); ?> |
|
222
|
|
- </div> |
|
223
|
|
- </div> |
|
224
|
|
- </div> |
|
225
|
|
- </div> |
|
226
|
|
- </div> |
|
227
|
|
- |
|
228
|
163
|
</div> |
|
229
|
164
|
|
|
230
|
165
|
</div> |
|
231
|
166
|
</div> |
|
232
|
|
- <?php |
|
233
|
|
- echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
234
|
|
- } |
|
235
|
167
|
|
|
168
|
+ <?php |
|
169
|
+ echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
170
|
+ } |
|
171
|
+ |
|
236
|
172
|
public function display_before_available_fields( $tab = '' ) { |
|
237
|
173
|
global $wpdb; |
|
238
|
174
|
|
|
239
|
175
|
if ( empty( $tab ) || $tab == 'account' ) { |
|
@@ -239,29 +175,30 @@ |
|
239
|
175
|
if ( empty( $tab ) || $tab == 'account' ) { |
|
240
|
176
|
$form_type = 'account'; |
|
241
|
177
|
$type = 'predefined'; |
|
242
|
178
|
?> |
|
243
|
|
- <h3 class="h6 text-muted"> |
|
179
|
+ <h3> |
|
244
|
180
|
<span> |
|
245
|
|
- <?php |
|
246
|
|
- echo apply_filters( 'uwp_form_builder_available_fields_head', __( 'Existing Fields', 'userswp' ), $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
247
|
|
- |
|
248
|
|
- $note = sprintf( __( 'Click on field to add it to the form. Existing fields are most used fields in all other forms.', 'userswp' ), $form_type ); |
|
249
|
|
- $note_text = apply_filters( 'uwp_form_builder_existing_fields_note', $note, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
250
|
|
- echo uwp_help_tip( $note_text ); |
|
251
|
|
- ?> |
|
181
|
+ <?php echo apply_filters( 'uwp_form_builder_available_fields_head', __( 'Existing Fields', 'userswp' ), $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
|
252
|
182
|
</span> |
|
253
|
183
|
</h3> |
|
254
|
184
|
|
|
255
|
|
- <div class="inside mb-4"> |
|
185
|
+ <p> |
|
186
|
+ <?php |
|
187
|
+ $note = sprintf( __( 'Click on field to add it to the form. Existing fields are most used fields in all other forms.', 'userswp' ), $form_type ); |
|
188
|
+ echo apply_filters( 'uwp_form_builder_existing_fields_note', $note, $form_type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
189
|
+ ?> |
|
190
|
+ </p> |
|
191
|
+ |
|
192
|
+ <div class="inside"> |
|
256
|
193
|
<div id="uwp-form-builder-tab-existing" class="uwp-tabs-panel"> |
|
257
|
|
- <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr( $form_type ); ?>"/> |
|
194
|
+ <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr($form_type); ?>"/> |
|
258
|
195
|
<input type="hidden" name="manage_field_type" class="manage_field_type" value="custom_fields"> |
|
259
|
|
- <ul class="corex uwp-tabs-selected uwp_form_extras row row-cols-2 px-2"> |
|
196
|
+ <ul class="core uwp-tabs-selected uwp_form_extras"> |
|
260
|
197
|
<?php |
|
261
|
|
- $form_id = self::get_form_id(); |
|
198
|
+ $form_id = ! empty( $_GET['form'] ) ? absint($_GET['form']) : 1; |
|
262
|
199
|
$table_name = uwp_get_table_prefix() . 'uwp_form_fields'; |
|
263
|
|
- $existing_fields = $wpdb->get_results( 'select htmlvar_name from ' . $table_name . " where form_type ='" . $form_type . "' AND form_id = " . $form_id ); |
|
200
|
+ $existing_fields = $wpdb->get_results( "select htmlvar_name from " . $table_name . " where form_type ='" . $form_type . "' AND form_id = " . $form_id ); |
|
264
|
201
|
|
|
265
|
202
|
$existing_field_ids = array(); |
|
266
|
203
|
if ( ! empty( $existing_fields ) ) { |
|
267
|
204
|
foreach ( $existing_fields as $existing_field ) { |
|
@@ -279,31 +216,29 @@ |
|
279
|
216
|
} |
|
280
|
217
|
|
|
281
|
218
|
$style = 'style="' . $display . '"'; |
|
282
|
219
|
?> |
|
283
|
|
- <li class="uwp-tooltip-wrap col px-1"<?php echo ( $display ? ' style="' . esc_attr( $display ) . '"' : '' ); ?>> |
|
284
|
|
- <a id="uwp-<?php echo esc_attr( $field['htmlvar_name'] ); ?>" |
|
285
|
|
- data-field-custom-type="<?php echo esc_attr( $type ); ?>" |
|
286
|
|
- data-field-type-key="<?php echo esc_attr( $field['htmlvar_name'] ); ?>" |
|
287
|
|
- data-field-type="<?php echo esc_attr( $field['field_type'] ); ?>" |
|
288
|
|
- class="uwp-draggable-form-itemsx btn btn-sm d-block m-0 btn-outline-gray text-dark text-start" |
|
289
|
|
- href="javascript:void(0);"> |
|
220
|
+ <li class="uwp-tooltip-wrap" <?php echo esc_attr($style); ?>> |
|
221
|
+ <a id="uwp-<?php echo esc_attr($field['htmlvar_name']); ?>" |
|
222
|
+ data-field-custom-type="<?php echo esc_attr($type); ?>" |
|
223
|
+ data-field-type-key="<?php echo esc_attr($field['htmlvar_name']); ?>" |
|
224
|
+ data-field-type="<?php echo esc_attr($field['field_type']); ?>" |
|
225
|
+ class="uwp-draggable-form-items" |
|
226
|
+ href="javascript:void(0);"> |
|
290
|
227
|
|
|
291
|
|
- <?php |
|
292
|
|
- if ( isset( $field['field_icon'] ) && strpos( $field['field_icon'], ' fa-' ) !== false ) { |
|
293
|
|
- echo '<i class="' . esc_attr( $field['field_icon'] ) . '" aria-hidden="true"></i>'; |
|
228
|
+ <?php if ( isset( $field['field_icon'] ) && strpos( $field['field_icon'], ' fa-' ) !== false ) { |
|
229
|
+ echo '<i class="' . esc_attr($field['field_icon']) . '" aria-hidden="true"></i>'; |
|
294
|
230
|
} elseif ( isset( $field['field_icon'] ) && $field['field_icon'] ) { |
|
295
|
|
- echo '<b style="background-image: url("' . esc_url( $field['field_icon'] ) . '")"></b>'; |
|
231
|
+ echo '<b style="background-image: url("' . esc_url($field['field_icon']) . '")"></b>'; |
|
296
|
232
|
} else { |
|
297
|
233
|
echo '<i class="fas fa-cog" aria-hidden="true"></i>'; |
|
298
|
234
|
} |
|
299
|
235
|
|
|
300
|
|
- echo ' ' . esc_attr( $field['site_title'] ); |
|
236
|
+ echo ' ' . esc_attr($field['site_title']); |
|
301
|
237
|
|
|
302
|
238
|
if ( isset( $field['help_text'] ) && $field['help_text'] ) { |
|
303
|
239
|
echo uwp_help_tip( $field['help_text'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
304
|
|
- } |
|
305
|
|
- ?> |
|
240
|
+ } ?> |
|
306
|
241
|
</a> |
|
307
|
242
|
</li> |
|
308
|
243
|
<?php |
|
309
|
244
|
} |
|
@@ -331,16 +266,12 @@ |
|
331
|
266
|
foreach ( $register_forms as $key => $register_form ) { |
|
332
|
267
|
$form_ids[] = (int) $register_form['id']; |
|
333
|
268
|
} |
|
334
|
269
|
|
|
335
|
|
- if ( in_array( 1, $form_ids ) ) { |
|
336
|
|
- $form_ids[] = 0; |
|
337
|
|
- } |
|
338
|
|
- |
|
339
|
270
|
if ( isset( $form_ids ) && count( $form_ids ) > 0 ) { |
|
340
|
271
|
$form_ids_placeholder = array_fill( 0, count( $form_ids ), '%s' ); |
|
341
|
272
|
$form_ids_placeholder = implode( ', ', $form_ids_placeholder ); |
|
342
|
|
- $query = 'SELECT * FROM ' . $table_name . " WHERE form_type = 'account' AND form_id IN (" . $form_ids_placeholder . ') ORDER BY sort_order ASC'; |
|
273
|
+ $query = "SELECT * FROM " . $table_name . " WHERE form_type = 'account' AND form_id IN (" . $form_ids_placeholder . ") ORDER BY sort_order ASC"; |
|
343
|
274
|
$custom_fields = $wpdb->get_results( $wpdb->prepare( $query, $form_ids ), $output ); |
|
344
|
275
|
} |
|
345
|
276
|
} |
|
346
|
277
|
|
|
@@ -348,101 +279,287 @@ |
|
348
|
279
|
|
|
349
|
280
|
return apply_filters( 'uwp_form_existing_fields', $custom_fields, $type ); |
|
350
|
281
|
} |
|
351
|
282
|
|
|
352
|
|
- /** |
|
353
|
|
- * Render the multiple registration form. |
|
354
|
|
- * |
|
355
|
|
- * @param string $tab Current tab. |
|
356
|
|
- */ |
|
357
|
283
|
public function multiple_registration_form( $tab = '' ) { |
|
358
|
|
- $default_tabs = array( 'account', 'register', 'profile-tabs' ); |
|
359
|
284
|
|
|
360
|
|
- /** |
|
361
|
|
- * Filter the tabs that should show the multiple registration form. |
|
362
|
|
- * |
|
363
|
|
- * @param array $default_tabs Default tabs. |
|
364
|
|
- */ |
|
365
|
|
- $tabs = apply_filters( 'uwp_multiple_registration_form_tabs', $default_tabs ); |
|
285
|
+ if ( empty( $tab ) || $tab == 'account' ) { |
|
286
|
+ $current_form = ! empty( $_GET['form'] ) ? (int) $_GET['form'] : 1; |
|
287
|
+ $register_tab = admin_url( 'admin.php?page=uwp_form_builder&tab=account' ); |
|
288
|
+ $register_forms = uwp_get_option( 'multiple_registration_forms' ); |
|
289
|
+ $user_roles = uwp_get_user_roles(); |
|
290
|
+ $current_role = get_option( 'default_role' ); |
|
291
|
+ $actions = uwp_get_registration_form_actions(); |
|
292
|
+ $current_action = uwp_get_option( 'uwp_registration_action', false ); |
|
293
|
+ $current_title = __( 'Form', 'userswp' ); |
|
294
|
+ $current_redirect_to = $current_custom_url = ''; |
|
295
|
+ $current_gdpr_page = $current_tos_page = - 1; |
|
296
|
+ if ( ! empty( $_GET['form_type'] ) && $_GET['form_type'] === 'new' ) { |
|
297
|
+ $new_added = ! empty( $register_forms ) ? end( $register_forms ) : array(); |
|
298
|
+ $current_form = ! empty( $new_added['id'] ) ? $new_added['id'] : 1; |
|
299
|
+ } |
|
300
|
+ ?> |
|
301
|
+ <div class="multiple-registration-form"> |
|
302
|
+ <form class="uwp_user_type_form" id="uwp_user_type_form" method="POST"> |
|
303
|
+ <input type="hidden" name="manage_field_form_id" class="manage_field_form_id" |
|
304
|
+ id="manage_field_form_id" |
|
305
|
+ value="<?php echo esc_attr( $current_form ); ?>"> |
|
306
|
+ <?php do_action( 'uwp_user_type_form_before', $current_form, $tab ); ?> |
|
307
|
+ <?php |
|
308
|
+ if ( ! empty( $register_forms ) && is_array( $register_forms ) ) { ?> |
|
309
|
+ <table class="form-table bsui userswp" id="uwp-forms-main"> |
|
310
|
+ <tr> |
|
311
|
+ <th><?php esc_html_e( 'Select Form:', 'userswp' ); ?></th> |
|
312
|
+ <td> |
|
313
|
+ <div class="d-inline-block align-top"> |
|
314
|
+ <select onChange="window.location.replace(jQuery(this).val());" |
|
315
|
+ name="form_select" id="multiple_registration_select" |
|
316
|
+ class="small-text aui-select2"> |
|
317
|
+ <?php |
|
318
|
+ foreach ( $register_forms as $key => $forms ) { |
|
319
|
+ $form_id = ! empty( $forms['id'] ) ? $forms['id'] : ''; |
|
320
|
+ $form_title = ! empty( $forms['title'] ) ? sanitize_title_with_dashes($forms['title']) : ''; |
|
321
|
+ $user_role = ! empty( $forms['user_role'] ) ? $forms['user_role'] : ''; |
|
322
|
+ $action = ! empty( $forms['reg_action'] ) ? $forms['reg_action'] : $current_action; |
|
323
|
+ $redirect_to = isset( $forms['redirect_to'] ) ? $forms['redirect_to'] : ''; |
|
324
|
+ $custom_url = ! empty( $forms['custom_url'] ) ? $forms['custom_url'] : ''; |
|
325
|
+ $gdpr_page = ! empty( $forms['gdpr_page'] ) ? (int) $forms['gdpr_page'] : - 1; |
|
326
|
+ $tos_page = ! empty( $forms['tos_page'] ) ? (int) $forms['tos_page'] : - 1; |
|
327
|
+ if ( $current_form == $form_id ) { |
|
328
|
+ $current_title = $form_title; |
|
329
|
+ $current_action = $action; |
|
330
|
+ $current_redirect_to = $redirect_to; |
|
331
|
+ $current_custom_url = $custom_url; |
|
332
|
+ $current_gdpr_page = $gdpr_page; |
|
333
|
+ $current_tos_page = $tos_page; |
|
334
|
+ if ( ! empty( $user_role ) && in_array( $user_role, array_keys( $user_roles ) ) ) { |
|
335
|
+ $current_role = $user_role; |
|
336
|
+ } |
|
337
|
+ } |
|
338
|
+ ?> |
|
339
|
+ <option <?php selected( $current_form, $form_id ); ?> |
|
340
|
+ value="<?php echo esc_attr( $register_tab . '&form=' . $form_id ); ?>"><?php echo esc_html( wp_sprintf( __( '%s - #%s', 'userswp' ), $form_title, $form_id ) ); ?></option> |
|
341
|
+ <?php } |
|
342
|
+ ?> |
|
343
|
+ </select> |
|
344
|
+ </div> |
|
345
|
+ <div class="d-inline-block align-top"> |
|
346
|
+ <button class="btn btn-sm btn-info register-show-options" type="button" |
|
347
|
+ id="show_options"><?php esc_html_e( 'Form Options', 'userswp' ); ?></button> |
|
348
|
+ <?php if ( ! empty( $current_form ) && $current_form > 1 ) { ?> |
|
349
|
+ <button data-id="<?php echo esc_attr($current_form); ?>" |
|
350
|
+ data-nonce="<?php echo esc_attr( wp_create_nonce( 'uwp-delete-register-form-nonce' ) ); ?>" |
|
351
|
+ class="btn btn-sm btn-danger register-form-remove" type="button" |
|
352
|
+ name="form_remove"><?php esc_html_e( 'Delete Form', 'userswp' ); ?></button> |
|
353
|
+ <?php } ?> |
|
354
|
+ <button data-nonce="<?php echo esc_attr( wp_create_nonce( 'uwp-create-register-form-nonce' ) ); ?>" |
|
355
|
+ class="btn btn-sm btn-primary register-form-create" type="button" |
|
356
|
+ name="register_form_create" |
|
357
|
+ id="form_create"><?php esc_html_e( 'Create Form', 'userswp' ); ?></button> |
|
358
|
+ </div> |
|
359
|
+ </td> |
|
360
|
+ </tr> |
|
361
|
+ </table> |
|
362
|
+ <?php } ?> |
|
366
|
363
|
|
|
367
|
|
- if ( ! in_array( $tab, $tabs, true ) ) { |
|
368
|
|
- return; |
|
369
|
|
- } |
|
364
|
+ <table class="form-table bsui userswp" id="uwp-form-more-options" style="display:none;"> |
|
365
|
+ <tr> |
|
366
|
+ <th><?php esc_html_e( 'Title:', 'userswp' ); echo uwp_help_tip(__('Title of the form', 'userswp')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th> |
|
367
|
+ <td> |
|
368
|
+ <input type="text" name="form_title" value="<?php echo esc_attr($current_title); ?>" |
|
369
|
+ class="regular-text"> |
|
370
|
+ </td> |
|
371
|
+ <?php if ( ! empty( $user_roles ) && is_array( $user_roles ) ) { ?> |
|
372
|
+ <th><?php esc_html_e( 'User Role to Assign:', 'userswp' ); echo uwp_help_tip(__('Role to assign when user register via this form.', 'userswp')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th> |
|
373
|
+ <td> |
|
374
|
+ <select name="user_role" id="multiple_registration_user_role" |
|
375
|
+ class="small-text aui-select2"> |
|
376
|
+ <?php |
|
377
|
+ foreach ( $user_roles as $key => $user_role ) { |
|
378
|
+ ?> |
|
379
|
+ <option <?php selected( $current_role, $key ); ?> |
|
380
|
+ value="<?php echo esc_attr($key); ?>"><?php echo esc_html( wp_sprintf( __( '%s', 'userswp' ), $user_role ) ); ?></option> |
|
381
|
+ <?php } |
|
382
|
+ ?> |
|
383
|
+ </select> |
|
384
|
+ </td> |
|
385
|
+ <?php } ?> |
|
386
|
+ </tr> |
|
387
|
+ <tr> |
|
388
|
+ <th><?php esc_html_e( 'Registration Action:', 'userswp' ); echo uwp_help_tip(__('Select how registration should be handled.', 'userswp')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th> |
|
389
|
+ <td> |
|
390
|
+ <select name="reg_action" id="uwp_registration_action" |
|
391
|
+ class="small-text aui-select2"> |
|
392
|
+ <?php |
|
393
|
+ foreach ( $actions as $key => $action ) { |
|
394
|
+ ?> |
|
395
|
+ <option <?php selected( $current_action, $key ); ?> |
|
396
|
+ value="<?php echo esc_attr($key); ?>"><?php echo esc_html( wp_sprintf( __( '%s', 'userswp' ), $action ) ); ?></option> |
|
397
|
+ <?php } ?> |
|
398
|
+ </select> |
|
399
|
+ </td> |
|
400
|
+ </tr> |
|
401
|
+ <tr style="display:none;"> |
|
402
|
+ <th><?php esc_html_e( 'Redirect Page:', 'userswp' ); echo uwp_help_tip(__('Set the page to redirect the user to after signing up.', 'userswp')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th> |
|
403
|
+ <td> |
|
404
|
+ <select name="redirect_to" id="register_redirect_to" |
|
405
|
+ class="small-text aui-select2"> |
|
406
|
+ <?php |
|
407
|
+ $pages = get_pages(); |
|
408
|
+ $pages_options = array( |
|
409
|
+ '-1' => __( 'Last User Page', 'userswp' ), |
|
410
|
+ '0' => __( 'Default Redirect', 'userswp' ), |
|
411
|
+ '-2' => __( 'Custom Redirect', 'userswp' ), |
|
412
|
+ ); |
|
413
|
+ if ( $pages ) { |
|
414
|
+ foreach ( $pages as $page ) { |
|
415
|
+ $pages_options[ $page->ID ] = $page->post_title; |
|
416
|
+ } |
|
417
|
+ } |
|
418
|
+ foreach ( $pages_options as $key => $option ) { |
|
419
|
+ ?> |
|
420
|
+ <option <?php selected( $current_redirect_to, $key ); ?> |
|
421
|
+ value="<?php echo esc_attr($key); ?>"><?php echo esc_html( wp_sprintf( __( '%s', 'userswp' ), $option ) ); ?></option> |
|
422
|
+ <?php } ?> |
|
423
|
+ </select> |
|
424
|
+ </td> |
|
425
|
+ <th><?php esc_html_e( 'Custom Redirect URL:', 'userswp' ); echo uwp_help_tip(__( 'Set the page to redirect the user to after signing up. If default redirect has been set then WordPress default will be used.', 'userswp' )); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th> |
|
426
|
+ <td> |
|
427
|
+ <input type="text" name="custom_url" id="register_redirect_custom_url" |
|
428
|
+ class="regular-text" value="<?php echo esc_attr($current_custom_url); ?>"> |
|
429
|
+ </td> |
|
430
|
+ </tr> |
|
431
|
+ <tr> |
|
432
|
+ <th><?php esc_html_e( 'GDPR Policy Page:', 'userswp' ); echo uwp_help_tip(__('Page to link when GDPR policy page custom field added to form. If not set then default setting will be used.', 'userswp')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th> |
|
433
|
+ <td> |
|
434
|
+ <?php |
|
435
|
+ $args = array( |
|
436
|
+ 'name' => 'gdpr_page', |
|
437
|
+ 'id' => 'multiple_registration_gdpr_page', |
|
438
|
+ 'sort_column' => 'menu_order', |
|
439
|
+ 'sort_order' => 'ASC', |
|
440
|
+ 'show_option_none' => ' ', |
|
441
|
+ 'class' => ' regular-text aui-select2 ', |
|
442
|
+ 'echo' => false, |
|
443
|
+ 'selected' => (int) $current_gdpr_page > 0 ? (int) $current_gdpr_page : - 1, |
|
444
|
+ ); |
|
445
|
+ echo str_replace( ' id=', " data-placeholder='" . esc_attr__( 'Select a page…', 'userswp' ) . "' id=", wp_dropdown_pages( $args ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
446
|
+ ?> |
|
447
|
+ </td> |
|
448
|
+ <th><?php esc_html_e( 'TOS Page:', 'userswp' ); echo uwp_help_tip(__('Page to link when Terms and Conditions custom field added to form. If not set then default setting will be used.', 'userswp')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?></th> |
|
449
|
+ <td> |
|
450
|
+ <?php |
|
451
|
+ $args = array( |
|
452
|
+ 'name' => 'tos_page', |
|
453
|
+ 'id' => 'multiple_registration_tos_page', |
|
454
|
+ 'sort_column' => 'menu_order', |
|
455
|
+ 'sort_order' => 'ASC', |
|
456
|
+ 'show_option_none' => ' ', |
|
457
|
+ 'class' => ' regular-text aui-select2 ', |
|
458
|
+ 'echo' => false, |
|
459
|
+ 'selected' => (int) $current_tos_page > 0 ? (int) $current_tos_page : - 1, |
|
460
|
+ ); |
|
461
|
+ echo str_replace( ' id=', " data-placeholder='" . esc_attr__( 'Select a page…', 'userswp' ) . "' id=", wp_dropdown_pages( $args ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
462
|
+ ?> |
|
463
|
+ </td> |
|
464
|
+ </tr> |
|
465
|
+ <?php do_action( 'uwp_user_type_form_before_submit', $current_form, $tab ); ?> |
|
466
|
+ <tr> |
|
467
|
+ <td></td> |
|
468
|
+ <td> |
|
469
|
+ <button class="btn btn-sm btn-secondary" id="form_update" type="submit" |
|
470
|
+ name="form_update"><?php esc_html_e( 'Update', 'userswp' ); ?></button> |
|
471
|
+ </td> |
|
472
|
+ </tr> |
|
473
|
+ </table> |
|
474
|
+ <input type="hidden" name="uwp_update_register_form_nonce" value="<?php echo esc_attr( wp_create_nonce( 'uwp-update-register-form-nonce' ) ); ?>" /> |
|
475
|
+ <?php do_action( 'uwp_user_type_form_after', $current_form, $tab ); ?> |
|
476
|
+ </form> |
|
477
|
+ </div> |
|
478
|
+ <?php |
|
479
|
+ } |
|
370
|
480
|
|
|
371
|
|
- $register_forms = (array) uwp_get_option( 'multiple_registration_forms', array() ); |
|
372
|
|
- $current_form_id = self::get_form_id(); |
|
373
|
|
- ?> |
|
374
|
|
- <div class="row"> |
|
375
|
|
- <div class="col-12"> |
|
376
|
|
- <div class="card border-0 shadow-sm mb-3 px-0 mw-100"> |
|
377
|
|
- <div class="card-body"> |
|
378
|
|
- <input type="hidden" name="manage_field_form_id" class="manage_field_form_id" id="manage_field_form_id" value="<?php echo absint( $current_form_id ); ?>"> |
|
379
|
|
- <?php |
|
380
|
|
- if ( ! empty( $register_forms ) && is_array( $register_forms ) && count( $register_forms ) > 1 ) { |
|
381
|
|
- $register_tab = admin_url( "admin.php?page=uwp_form_builder&tab={$tab}" ); |
|
481
|
+ if ( ! empty( $tab ) && $tab == 'register' ) { |
|
482
|
+ $current_form = ! empty( $_GET['form'] ) ? absint($_GET['form']) : 1; |
|
382
|
483
|
|
|
383
|
|
- ?> |
|
384
|
|
- <div class="d-flex align-items-center"> |
|
385
|
|
- <label class="form-label h1"> |
|
386
|
|
- <i class="fas fa-user me-3 iconbox border-0 fill rounded-circle transition-all btn-translucent-info iconsmallmedium"></i> |
|
387
|
|
- <?php esc_html_e( 'Select user type', 'userswp' ); ?> |
|
388
|
|
- </label> |
|
389
|
|
- <div class="ms-3 col-6"> |
|
390
|
|
- <select onChange="window.location.replace(jQuery(this).val());" name="form_select" id="multiple_registration_select" class="form-select form-select-lgx"> |
|
391
|
|
- <?php |
|
392
|
|
- foreach ( $register_forms as $form ) : |
|
393
|
|
- $form_id = ! empty( $form['id'] ) ? $form['id'] : ''; |
|
394
|
|
- $form_title = ! empty( $form['title'] ) ? sanitize_title_with_dashes( $form['title'] ) : ''; |
|
395
|
|
- $option_text = sprintf( |
|
396
|
|
- /* translators: %1$s: Form title, %2$s: Form ID */ |
|
397
|
|
- esc_html__( '%1$s - #%2$s', 'userswp' ), |
|
398
|
|
- $form_title, |
|
399
|
|
- $form_id |
|
400
|
|
- ); |
|
401
|
|
- $option_value = esc_url( add_query_arg( 'form', $form_id, $register_tab ) ); |
|
402
|
|
- ?> |
|
403
|
|
- <option <?php selected( $current_form_id, $form_id ); ?> value="<?php echo esc_attr( $option_value ); ?>"> |
|
404
|
|
- <?php echo esc_html( $option_text ); ?> |
|
405
|
|
- </option> |
|
406
|
|
- <?php endforeach; ?> |
|
484
|
+ $register_tab = admin_url( 'admin.php?page=uwp_form_builder&tab=register' ); |
|
485
|
+ $register_forms = uwp_get_option( 'multiple_registration_forms' ); |
|
486
|
+ ?> |
|
487
|
+ <div class="multiple-registration-form"> |
|
488
|
+ <input type="hidden" name="manage_field_form_id" class="manage_field_form_id" id="manage_field_form_id" |
|
489
|
+ value="<?php echo esc_attr( $current_form ); ?>"> |
|
490
|
+ <table class="form-table bsui userswp"> |
|
491
|
+ <?php |
|
492
|
+ if ( ! empty( $register_forms ) && is_array( $register_forms ) ) { ?> |
|
493
|
+ <tr> |
|
494
|
+ <th><?php esc_html_e( 'Select Form:', 'userswp' ); ?></th> |
|
495
|
+ <td> |
|
496
|
+ <div class="d-inline-block align-top"> |
|
497
|
+ <select onChange="window.location.replace(jQuery(this).val());" |
|
498
|
+ name="multiple-registration-select" id="multiple_registration_select" |
|
499
|
+ class="small-text aui-select2"> |
|
500
|
+ <?php |
|
501
|
+ foreach ( $register_forms as $key => $forms ) { |
|
502
|
+ $form_id = ! empty( $forms['id'] ) ? $forms['id'] : ''; |
|
503
|
+ $form_title = ! empty( $forms['title'] ) ? sanitize_title_with_dashes($forms['title']) : ''; |
|
504
|
+ ?> |
|
505
|
+ <option <?php selected( $current_form, $form_id ); ?> |
|
506
|
+ value="<?php echo esc_attr( $register_tab . '&form=' . $form_id ); ?>"><?php echo esc_html( wp_sprintf( __( '%s - #%s', 'userswp' ), $form_title, $form_id ) ); ?></option> |
|
507
|
+ <?php } ?> |
|
407
|
508
|
</select> |
|
408
|
509
|
</div> |
|
409
|
|
- </div> |
|
410
|
|
- <?php |
|
411
|
|
- } else { |
|
412
|
|
- $alert_content = wp_kses( |
|
413
|
|
- sprintf( |
|
414
|
|
- /* translators: %1$s: Alert message, %2$s: URL to add user type, %3$s: Add User Type button text */ |
|
415
|
|
- '%1$s <a href="%2$s" class="btn btn-primary btn-sm text-decoration-none ms-auto" role="button">%3$s</a>', |
|
416
|
|
- esc_html__( 'Add different user types to create custom registration forms with unique roles and redirects.', 'userswp' ), |
|
417
|
|
- esc_url( admin_url( 'admin.php?page=uwp_user_types&form=add' ) ), |
|
418
|
|
- esc_html__( 'Add User Type', 'userswp' ) |
|
419
|
|
- ), |
|
420
|
|
- array( |
|
421
|
|
- 'a' => array( |
|
422
|
|
- 'href' => array(), |
|
423
|
|
- 'class' => array(), |
|
424
|
|
- 'role' => array(), |
|
425
|
|
- ), |
|
426
|
|
- ) |
|
427
|
|
- ); |
|
510
|
+ </td> |
|
511
|
+ </tr> |
|
512
|
+ <?php } |
|
513
|
+ if ( ! empty( $current_form ) && $current_form > 0 ) { ?> |
|
514
|
+ <tr> |
|
515
|
+ <th><?php esc_html_e( 'Register Form Shortcode:', 'userswp' ); ?></th> |
|
516
|
+ <td> |
|
517
|
+ <span class="uwp-custom-desc"><code><strong>[uwp_register id="<?php echo esc_attr( $current_form ); ?>" title="<?php echo esc_attr( uwp_get_register_form_by( $current_form ) ); ?>"]</strong></code></span> |
|
518
|
+ </td> |
|
519
|
+ </tr> |
|
520
|
+ <?php } ?> |
|
521
|
+ </table> |
|
522
|
+ </div> |
|
523
|
+ <?php |
|
524
|
+ } |
|
428
|
525
|
|
|
429
|
|
- aui()->alert( |
|
430
|
|
- array( |
|
431
|
|
- 'type' => 'dark', |
|
432
|
|
- 'class' => 'd-flex align-items-center mb-0', |
|
433
|
|
- 'content' => $alert_content, |
|
434
|
|
- 'dismissible' => false, |
|
435
|
|
- ), |
|
436
|
|
- true |
|
437
|
|
- ); |
|
438
|
|
- } |
|
439
|
|
- ?> |
|
440
|
|
- </div> |
|
441
|
|
- </div> |
|
526
|
+ if ( ! empty( $tab ) && $tab == 'profile-tabs' ) { |
|
527
|
+ $current_form = ! empty( $_GET['form'] ) ? absint($_GET['form']) : 1; |
|
528
|
+ |
|
529
|
+ $register_tab = admin_url( 'admin.php?page=uwp_form_builder&tab=profile-tabs' ); |
|
530
|
+ $register_forms = uwp_get_option( 'multiple_registration_forms' ); |
|
531
|
+ ?> |
|
532
|
+ <div class="multiple-registration-form"> |
|
533
|
+ <input type="hidden" name="manage_field_form_id" class="manage_field_form_id" id="manage_field_form_id" |
|
534
|
+ value="<?php echo esc_attr( $current_form ); ?>"> |
|
535
|
+ <table class="form-table bsui userswp"> |
|
536
|
+ <?php |
|
537
|
+ if ( ! empty( $register_forms ) && is_array( $register_forms ) ) { ?> |
|
538
|
+ <tr> |
|
539
|
+ <th><?php esc_html_e( 'Select Form:', 'userswp' ); ?></th> |
|
540
|
+ <td> |
|
541
|
+ <div class="d-inline-block align-top"> |
|
542
|
+ <select onChange="window.location.replace(jQuery(this).val());" |
|
543
|
+ name="multiple-registration-select" id="multiple_registration_select" |
|
544
|
+ class="small-text aui-select2"> |
|
545
|
+ <?php |
|
546
|
+ foreach ( $register_forms as $key => $forms ) { |
|
547
|
+ $form_id = ! empty( $forms['id'] ) ? $forms['id'] : ''; |
|
548
|
+ $form_title = ! empty( $forms['title'] ) ? $forms['title'] : ''; |
|
549
|
+ ?> |
|
550
|
+ <option <?php selected( $current_form, $form_id ); ?> |
|
551
|
+ value="<?php echo esc_attr( $register_tab . '&form=' . $form_id ); ?>"><?php echo esc_html( wp_sprintf( __( '%s - #%s', 'userswp' ), $form_title, $form_id ) ); ?></option> |
|
552
|
+ <?php } ?> |
|
553
|
+ </select> |
|
554
|
+ </div> |
|
555
|
+ </td> |
|
556
|
+ </tr> |
|
557
|
+ <?php } ?> |
|
558
|
+ </table> |
|
442
|
559
|
</div> |
|
443
|
|
- </div> |
|
444
|
|
- <?php |
|
560
|
+ <?php |
|
561
|
+ } |
|
445
|
562
|
} |
|
446
|
563
|
|
|
447
|
564
|
public function manage_available_fields_predefined( $form_type ) { |
|
448
|
565
|
switch ( $form_type ) { |
|
@@ -453,9 +570,9 @@ |
|
453
|
570
|
} |
|
454
|
571
|
|
|
455
|
572
|
public function custom_available_fields( $type, $form_type ) { |
|
456
|
573
|
?> |
|
457
|
|
- <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr( $form_type ); ?>"/> |
|
574
|
+ <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr($form_type); ?>"/> |
|
458
|
575
|
<input type="hidden" name="manage_field_type" class="manage_field_type" value="custom_fields"> |
|
459
|
576
|
<?php |
|
460
|
577
|
if ( $type == 'predefined' ) { |
|
461
|
578
|
$fields = $this->form_fields_predefined( $form_type ); |
|
@@ -463,20 +580,19 @@ |
|
463
|
580
|
$fields = $this->form_fields_custom( $form_type ); |
|
464
|
581
|
} else { |
|
465
|
582
|
$fields = $this->form_fields( $form_type ); |
|
466
|
583
|
?> |
|
467
|
|
- <ul class="row row-cols-1 px-2 mb-0"> |
|
468
|
|
- <li class="uwp-tooltip-wrapx col px-1"> |
|
584
|
+ <ul class="full"> |
|
585
|
+ <li class="uwp-tooltip-wrap"> |
|
469
|
586
|
<a id="uwp-fieldset" |
|
470
|
|
- class="uwp-draggable-form-itemsx uwp-fieldset btn btn-sm d-block m-0 btn-outline-gray text-dark text-start" |
|
471
|
|
- href="javascript:void(0);" |
|
472
|
|
- data-field-custom-type="" |
|
473
|
|
- data-field-type="fieldset" |
|
474
|
|
- data-field-type-key="fieldset"> |
|
587
|
+ class="uwp-draggable-form-items uwp-fieldset" |
|
588
|
+ href="javascript:void(0);" |
|
589
|
+ data-field-custom-type="" |
|
590
|
+ data-field-type="fieldset" |
|
591
|
+ data-field-type-key="fieldset"> |
|
475
|
592
|
<i class="fas fa-long-arrow-alt-left " aria-hidden="true"></i> |
|
476
|
593
|
<i class="fas fa-long-arrow-alt-right " aria-hidden="true"></i> |
|
477
|
|
- <?php |
|
478
|
|
- esc_html_e( 'Fieldset (section separator)', 'userswp' ); |
|
594
|
+ <?php esc_html_e( 'Fieldset (section separator)', 'userswp' ); |
|
479
|
595
|
echo uwp_help_tip( __( 'This adds a section separator with a title.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
480
|
596
|
?> |
|
481
|
597
|
</a> |
|
482
|
598
|
</li> |
|
@@ -486,35 +602,33 @@ |
|
486
|
602
|
} |
|
487
|
603
|
|
|
488
|
604
|
if ( ! empty( $fields ) ) { |
|
489
|
605
|
?> |
|
490
|
|
- <ul class="row row-cols-2 px-2 mb-0"> |
|
606
|
+ <ul> |
|
491
|
607
|
<?php |
|
492
|
608
|
foreach ( $fields as $id => $field ) { |
|
493
|
609
|
?> |
|
494
|
|
- <li class="uwp-tooltip-wrapx col px-1"> |
|
610
|
+ <li class="uwp-tooltip-wrap"> |
|
495
|
611
|
<a id="uwp-<?php echo esc_attr( $id ); ?>" |
|
496
|
|
- data-field-custom-type="<?php echo esc_attr( $type ); ?>" |
|
497
|
|
- data-field-type-key="<?php echo esc_attr( $id ); ?>" |
|
498
|
|
- data-field-type="<?php echo esc_attr( $field['field_type'] ); ?>" |
|
499
|
|
- class="uwp-draggable-form-itemsx btn btn-sm d-block m-0 btn-outline-gray text-dark text-start" |
|
500
|
|
- href="javascript:void(0);"> |
|
612
|
+ data-field-custom-type="<?php echo esc_attr($type); ?>" |
|
613
|
+ data-field-type-key="<?php echo esc_attr($id); ?>" |
|
614
|
+ data-field-type="<?php echo esc_attr($field['field_type']); ?>" |
|
615
|
+ class="uwp-draggable-form-items" |
|
616
|
+ href="javascript:void(0);"> |
|
501
|
617
|
|
|
502
|
|
- <?php |
|
503
|
|
- if ( isset( $field['field_icon'] ) && strpos( $field['field_icon'], ' fa-' ) !== false ) { |
|
504
|
|
- echo '<i class="' . esc_attr( $field['field_icon'] ) . '" aria-hidden="true"></i>'; |
|
618
|
+ <?php if ( isset( $field['field_icon'] ) && strpos( $field['field_icon'], ' fa-' ) !== false ) { |
|
619
|
+ echo '<i class="' . esc_attr($field['field_icon']) . '" aria-hidden="true"></i>'; |
|
505
|
620
|
} elseif ( isset( $field['field_icon'] ) && $field['field_icon'] ) { |
|
506
|
|
- echo '<b style="background-image: url("' . esc_url( $field['field_icon'] ) . '")"></b>'; |
|
621
|
+ echo '<b style="background-image: url("' . esc_url($field['field_icon']) . '")"></b>'; |
|
507
|
622
|
} else { |
|
508
|
623
|
echo '<i class="fas fa-cog" aria-hidden="true"></i>'; |
|
509
|
624
|
} |
|
510
|
625
|
|
|
511
|
|
- echo ' ' . esc_attr( $field['site_title'] ); |
|
626
|
+ echo ' ' . esc_attr($field['site_title']); |
|
512
|
627
|
|
|
513
|
628
|
if ( isset( $field['help_text'] ) && $field['help_text'] ) { |
|
514
|
629
|
echo uwp_help_tip( $field['help_text'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
515
|
|
- } |
|
516
|
|
- ?> |
|
630
|
+ } ?> |
|
517
|
631
|
</a> |
|
518
|
632
|
</li> |
|
519
|
633
|
<?php |
|
520
|
634
|
} |
|
@@ -524,8 +638,9 @@ |
|
524
|
638
|
?> |
|
525
|
639
|
</ul> |
|
526
|
640
|
|
|
527
|
641
|
<?php |
|
642
|
+ |
|
528
|
643
|
} |
|
529
|
644
|
|
|
530
|
645
|
public function form_fields_predefined( $type = '' ) { |
|
531
|
646
|
$custom_fields = array(); |
|
@@ -546,10 +661,10 @@ |
|
546
|
661
|
'is_required' => 0, |
|
547
|
662
|
'option_values' => '', |
|
548
|
663
|
'required_msg' => '', |
|
549
|
664
|
'field_icon' => 'fas fa-map-marker-alt', |
|
550
|
|
- 'css_class' => '', |
|
551
|
|
- ), |
|
665
|
+ 'css_class' => '' |
|
666
|
+ ) |
|
552
|
667
|
); |
|
553
|
668
|
|
|
554
|
669
|
// Gender |
|
555
|
670
|
$custom_fields['gender'] = array( |
|
@@ -567,10 +682,10 @@ |
|
567
|
682
|
'is_required' => 0, |
|
568
|
683
|
'option_values' => __( 'Male,Female,Other', 'userswp' ), |
|
569
|
684
|
'required_msg' => '', |
|
570
|
685
|
'field_icon' => 'fas fa-user', |
|
571
|
|
- 'css_class' => '', |
|
572
|
|
- ), |
|
686
|
+ 'css_class' => '' |
|
687
|
+ ) |
|
573
|
688
|
); |
|
574
|
689
|
|
|
575
|
690
|
$custom_fields['dob'] = array( |
|
576
|
691
|
'field_type' => 'datepicker', |
|
@@ -593,11 +708,11 @@ |
|
593
|
708
|
'required_msg' => '', |
|
594
|
709
|
'field_icon' => 'fas fa-birthday-cake', |
|
595
|
710
|
'css_class' => '', |
|
596
|
711
|
'extra_fields' => array( |
|
597
|
|
- 'date_range' => 'c-100:c+0', |
|
598
|
|
- ), |
|
599
|
|
- ), |
|
712
|
+ 'date_range' => 'c-100:c+0' |
|
713
|
+ ) |
|
714
|
+ ) |
|
600
|
715
|
); |
|
601
|
716
|
|
|
602
|
717
|
// Mobile |
|
603
|
718
|
$custom_fields['mobile'] = array( |
|
@@ -614,10 +729,10 @@ |
|
614
|
729
|
'default_value' => '', |
|
615
|
730
|
'is_required' => 0, |
|
616
|
731
|
'required_msg' => '', |
|
617
|
732
|
'field_icon' => 'fas fa-mobile-alt', |
|
618
|
|
- 'css_class' => '', |
|
619
|
|
- ), |
|
733
|
+ 'css_class' => '' |
|
734
|
+ ) |
|
620
|
735
|
); |
|
621
|
736
|
|
|
622
|
737
|
$custom_fields['register_gdpr'] = array( |
|
623
|
738
|
'field_type' => 'checkbox', |
|
@@ -634,20 +749,20 @@ |
|
634
|
749
|
'default_value' => '', |
|
635
|
750
|
'is_required' => 1, |
|
636
|
751
|
'required_msg' => '', |
|
637
|
752
|
'field_icon' => 'fas fa-file', |
|
638
|
|
- 'css_class' => 'btn-register-gdpr', |
|
639
|
|
- ), |
|
753
|
+ 'css_class' => 'btn-register-gdpr' |
|
754
|
+ ) |
|
640
|
755
|
); |
|
641
|
756
|
|
|
642
|
757
|
$custom_fields['register_tos'] = array( |
|
643
|
|
- 'field_type' => 'checkbox', |
|
644
|
|
- 'class' => 'uwp-register-tos', |
|
645
|
|
- 'field_icon' => 'fas fa-file', |
|
646
|
|
- 'site_title' => __( 'Terms & Conditions', 'userswp' ), |
|
647
|
|
- 'help_text' => __( 'Adds Register TOS page.', 'userswp' ), |
|
648
|
|
- 'help_text_tip' => __( 'This will show next to the checkbox, to add a link to the TOS page, use format: %%link_start%% View TOS %%link_end%%', 'userswp' ), |
|
649
|
|
- 'defaults' => array( |
|
758
|
+ 'field_type' => 'checkbox', |
|
759
|
+ 'class' => 'uwp-register-tos', |
|
760
|
+ 'field_icon' => 'fas fa-file', |
|
761
|
+ 'site_title' => __( 'Terms & Conditions', 'userswp' ), |
|
762
|
+ 'help_text' => __( 'Adds Register TOS page.', 'userswp' ), |
|
763
|
+ 'help_text_tip' => __( 'This will show next to the checkbox, to add a link to the TOS page, use format: %%link_start%% View TOS %%link_end%%', 'userswp' ), |
|
764
|
+ 'defaults' => array( |
|
650
|
765
|
'admin_title' => 'Terms & Conditions', |
|
651
|
766
|
'site_title' => 'Terms & Conditions', |
|
652
|
767
|
'form_label' => __( 'Terms & Conditions', 'userswp' ), |
|
653
|
768
|
'htmlvar_name' => 'register_tos', |
|
@@ -656,9 +771,9 @@ |
|
656
|
771
|
'is_required' => 1, |
|
657
|
772
|
'required_msg' => '', |
|
658
|
773
|
'field_icon' => 'fas fa-file', |
|
659
|
774
|
'css_class' => 'btn-register-tos', |
|
660
|
|
- ), |
|
775
|
+ ) |
|
661
|
776
|
); |
|
662
|
777
|
|
|
663
|
778
|
// Website |
|
664
|
779
|
$custom_fields['user_url'] = array( |
|
@@ -676,10 +791,10 @@ |
|
676
|
791
|
'default_value' => '', |
|
677
|
792
|
'is_required' => 0, |
|
678
|
793
|
'required_msg' => '', |
|
679
|
794
|
'field_icon' => 'fas fa-link', |
|
680
|
|
- 'css_class' => 'btn-website', |
|
681
|
|
- ), |
|
795
|
+ 'css_class' => 'btn-website' |
|
796
|
+ ) |
|
682
|
797
|
); |
|
683
|
798
|
|
|
684
|
799
|
// Facebook |
|
685
|
800
|
$custom_fields['facebook'] = array( |
|
@@ -697,10 +812,10 @@ |
|
697
|
812
|
'default_value' => '', |
|
698
|
813
|
'is_required' => 0, |
|
699
|
814
|
'required_msg' => '', |
|
700
|
815
|
'field_icon' => 'fab fa-facebook-f', |
|
701
|
|
- 'css_class' => 'btn-facebook', |
|
702
|
|
- ), |
|
816
|
+ 'css_class' => 'btn-facebook' |
|
817
|
+ ) |
|
703
|
818
|
); |
|
704
|
819
|
|
|
705
|
820
|
// Twitter |
|
706
|
821
|
$custom_fields['twitter'] = array( |
|
@@ -718,10 +833,10 @@ |
|
718
|
833
|
'default_value' => '', |
|
719
|
834
|
'is_required' => 0, |
|
720
|
835
|
'required_msg' => '', |
|
721
|
836
|
'field_icon' => 'fab fa-twitter', |
|
722
|
|
- 'css_class' => 'btn-twitter', |
|
723
|
|
- ), |
|
837
|
+ 'css_class' => 'btn-twitter' |
|
838
|
+ ) |
|
724
|
839
|
); |
|
725
|
840
|
|
|
726
|
841
|
// Instagram |
|
727
|
842
|
$custom_fields['instagram'] = array( |
|
@@ -739,10 +854,10 @@ |
|
739
|
854
|
'default_value' => '', |
|
740
|
855
|
'is_required' => 0, |
|
741
|
856
|
'required_msg' => '', |
|
742
|
857
|
'field_icon' => 'fab fa-instagram', |
|
743
|
|
- 'css_class' => 'btn-instagram', |
|
744
|
|
- ), |
|
858
|
+ 'css_class' => 'btn-instagram' |
|
859
|
+ ) |
|
745
|
860
|
); |
|
746
|
861
|
|
|
747
|
862
|
// Linkedin |
|
748
|
863
|
$custom_fields['linkedin'] = array( |
|
@@ -760,12 +875,13 @@ |
|
760
|
875
|
'default_value' => '', |
|
761
|
876
|
'is_required' => 0, |
|
762
|
877
|
'required_msg' => '', |
|
763
|
878
|
'field_icon' => 'fab fa-linkedin-in', |
|
764
|
|
- 'css_class' => 'btn-linkedin', |
|
765
|
|
- ), |
|
879
|
+ 'css_class' => 'btn-linkedin' |
|
880
|
+ ) |
|
766
|
881
|
); |
|
767
|
882
|
|
|
883
|
+ |
|
768
|
884
|
// Flickr |
|
769
|
885
|
$custom_fields['flickr'] = array( |
|
770
|
886
|
'field_type' => 'url', |
|
771
|
887
|
'class' => 'uwp-flickr', |
|
@@ -781,10 +897,10 @@ |
|
781
|
897
|
'default_value' => '', |
|
782
|
898
|
'is_required' => 0, |
|
783
|
899
|
'required_msg' => '', |
|
784
|
900
|
'field_icon' => 'fab fa-flickr', |
|
785
|
|
- 'css_class' => 'btn-flickr', |
|
786
|
|
- ), |
|
901
|
+ 'css_class' => 'btn-flickr' |
|
902
|
+ ) |
|
787
|
903
|
); |
|
788
|
904
|
|
|
789
|
905
|
// GitHub |
|
790
|
906
|
$custom_fields['github'] = array( |
|
@@ -802,10 +918,10 @@ |
|
802
|
918
|
'default_value' => '', |
|
803
|
919
|
'is_required' => 0, |
|
804
|
920
|
'required_msg' => '', |
|
805
|
921
|
'field_icon' => 'fab fa-github-alt', |
|
806
|
|
- 'css_class' => 'btn-github', |
|
807
|
|
- ), |
|
922
|
+ 'css_class' => 'btn-github' |
|
923
|
+ ) |
|
808
|
924
|
); |
|
809
|
925
|
|
|
810
|
926
|
// YouTube |
|
811
|
927
|
$custom_fields['youtube'] = array( |
|
@@ -823,10 +939,10 @@ |
|
823
|
939
|
'default_value' => '', |
|
824
|
940
|
'is_required' => 0, |
|
825
|
941
|
'required_msg' => '', |
|
826
|
942
|
'field_icon' => 'fab fa-youtube', |
|
827
|
|
- 'css_class' => 'btn-youtube', |
|
828
|
|
- ), |
|
943
|
+ 'css_class' => 'btn-youtube' |
|
944
|
+ ) |
|
829
|
945
|
); |
|
830
|
946
|
|
|
831
|
947
|
// WordPress |
|
832
|
948
|
$custom_fields['wordpress'] = array( |
|
@@ -844,10 +960,10 @@ |
|
844
|
960
|
'default_value' => '', |
|
845
|
961
|
'is_required' => 0, |
|
846
|
962
|
'required_msg' => '', |
|
847
|
963
|
'field_icon' => 'fab fa-wordpress-simple', |
|
848
|
|
- 'css_class' => 'btn-wordpress', |
|
849
|
|
- ), |
|
964
|
+ 'css_class' => 'btn-wordpress' |
|
965
|
+ ) |
|
850
|
966
|
); |
|
851
|
967
|
|
|
852
|
968
|
// Language |
|
853
|
969
|
$custom_fields['uwp_language'] = array( |
|
@@ -866,12 +982,13 @@ |
|
866
|
982
|
'is_required' => 0, |
|
867
|
983
|
'option_values' => '', |
|
868
|
984
|
'required_msg' => '', |
|
869
|
985
|
'field_icon' => 'fas fa-language', |
|
870
|
|
- 'css_class' => '', |
|
871
|
|
- ), |
|
986
|
+ 'css_class' => '' |
|
987
|
+ ) |
|
872
|
988
|
); |
|
873
|
989
|
|
|
990
|
+ |
|
874
|
991
|
return apply_filters( 'uwp_form_fields_predefined', $custom_fields, $type ); |
|
875
|
992
|
} |
|
876
|
993
|
|
|
877
|
994
|
public function form_fields_custom( $type = '' ) { |
|
@@ -887,9 +1004,9 @@ |
|
887
|
1004
|
'field_type' => 'text', |
|
888
|
1005
|
'class' => 'uwp-text', |
|
889
|
1006
|
'field_icon' => 'fas fa-minus', |
|
890
|
1007
|
'site_title' => __( 'Text', 'userswp' ), |
|
891
|
|
- 'help_text' => __( 'Add any sort of text field, text or numbers', 'userswp' ), |
|
1008
|
+ 'help_text' => __( 'Add any sort of text field, text or numbers', 'userswp' ) |
|
892
|
1009
|
), |
|
893
|
1010
|
'datepicker' => array( |
|
894
|
1011
|
'field_type' => 'datepicker', |
|
895
|
1012
|
'class' => 'uwp-datepicker', |
|
@@ -894,9 +1011,9 @@ |
|
894
|
1011
|
'field_type' => 'datepicker', |
|
895
|
1012
|
'class' => 'uwp-datepicker', |
|
896
|
1013
|
'field_icon' => 'fas fa-calendar-alt', |
|
897
|
1014
|
'site_title' => __( 'Date', 'userswp' ), |
|
898
|
|
- 'help_text' => __( 'Adds a date picker.', 'userswp' ), |
|
1015
|
+ 'help_text' => __( 'Adds a date picker.', 'userswp' ) |
|
899
|
1016
|
), |
|
900
|
1017
|
'textarea' => array( |
|
901
|
1018
|
'field_type' => 'textarea', |
|
902
|
1019
|
'class' => 'uwp-textarea', |
|
@@ -901,9 +1018,9 @@ |
|
901
|
1018
|
'field_type' => 'textarea', |
|
902
|
1019
|
'class' => 'uwp-textarea', |
|
903
|
1020
|
'field_icon' => 'fas fa-bars', |
|
904
|
1021
|
'site_title' => __( 'Textarea', 'userswp' ), |
|
905
|
|
- 'help_text' => __( 'Adds a textarea', 'userswp' ), |
|
1022
|
+ 'help_text' => __( 'Adds a textarea', 'userswp' ) |
|
906
|
1023
|
), |
|
907
|
1024
|
'time' => array( |
|
908
|
1025
|
'field_type' => 'time', |
|
909
|
1026
|
'class' => 'uwp-time', |
|
@@ -908,9 +1025,9 @@ |
|
908
|
1025
|
'field_type' => 'time', |
|
909
|
1026
|
'class' => 'uwp-time', |
|
910
|
1027
|
'field_icon' => 'far fa-clock', |
|
911
|
1028
|
'site_title' => __( 'Time', 'userswp' ), |
|
912
|
|
- 'help_text' => __( 'Adds a time picker', 'userswp' ), |
|
1029
|
+ 'help_text' => __( 'Adds a time picker', 'userswp' ) |
|
913
|
1030
|
), |
|
914
|
1031
|
'checkbox' => array( |
|
915
|
1032
|
'field_type' => 'checkbox', |
|
916
|
1033
|
'class' => 'uwp-checkbox', |
|
@@ -915,9 +1032,9 @@ |
|
915
|
1032
|
'field_type' => 'checkbox', |
|
916
|
1033
|
'class' => 'uwp-checkbox', |
|
917
|
1034
|
'field_icon' => 'far fa-check-square', |
|
918
|
1035
|
'site_title' => __( 'Checkbox', 'userswp' ), |
|
919
|
|
- 'help_text' => __( 'Adds a checkbox', 'userswp' ), |
|
1036
|
+ 'help_text' => __( 'Adds a checkbox', 'userswp' ) |
|
920
|
1037
|
), |
|
921
|
1038
|
'phone' => array( |
|
922
|
1039
|
'field_type' => 'phone', |
|
923
|
1040
|
'class' => 'uwp-phone', |
|
@@ -922,9 +1039,9 @@ |
|
922
|
1039
|
'field_type' => 'phone', |
|
923
|
1040
|
'class' => 'uwp-phone', |
|
924
|
1041
|
'field_icon' => 'fas fa-phone', |
|
925
|
1042
|
'site_title' => __( 'Phone', 'userswp' ), |
|
926
|
|
- 'help_text' => __( 'Adds a phone input', 'userswp' ), |
|
1043
|
+ 'help_text' => __( 'Adds a phone input', 'userswp' ) |
|
927
|
1044
|
), |
|
928
|
1045
|
'radio' => array( |
|
929
|
1046
|
'field_type' => 'radio', |
|
930
|
1047
|
'class' => 'uwp-radio', |
|
@@ -929,9 +1046,9 @@ |
|
929
|
1046
|
'field_type' => 'radio', |
|
930
|
1047
|
'class' => 'uwp-radio', |
|
931
|
1048
|
'field_icon' => 'far fa-dot-circle', |
|
932
|
1049
|
'site_title' => __( 'Radio', 'userswp' ), |
|
933
|
|
- 'help_text' => __( 'Adds a radio input', 'userswp' ), |
|
1050
|
+ 'help_text' => __( 'Adds a radio input', 'userswp' ) |
|
934
|
1051
|
), |
|
935
|
1052
|
'email' => array( |
|
936
|
1053
|
'field_type' => 'email', |
|
937
|
1054
|
'class' => 'uwp-email', |
|
@@ -936,15 +1053,15 @@ |
|
936
|
1053
|
'field_type' => 'email', |
|
937
|
1054
|
'class' => 'uwp-email', |
|
938
|
1055
|
'field_icon' => 'far fa-envelope', |
|
939
|
1056
|
'site_title' => __( 'Email', 'userswp' ), |
|
940
|
|
- 'help_text' => __( 'Adds a email input', 'userswp' ), |
|
1057
|
+ 'help_text' => __( 'Adds a email input', 'userswp' ) |
|
941
|
1058
|
), |
|
942
|
1059
|
'select' => array( |
|
943
|
1060
|
'field_type' => 'select', |
|
944
|
1061
|
'field_icon' => 'far fa-caret-square-down', |
|
945
|
1062
|
'site_title' => __( 'Select', 'userswp' ), |
|
946
|
|
- 'help_text' => __( 'Adds a select input', 'userswp' ), |
|
1063
|
+ 'help_text' => __( 'Adds a select input', 'userswp' ) |
|
947
|
1064
|
), |
|
948
|
1065
|
'multiselect' => array( |
|
949
|
1066
|
'field_type' => 'multiselect', |
|
950
|
1067
|
'class' => 'uwp-multiselect', |
|
@@ -949,9 +1066,9 @@ |
|
949
|
1066
|
'field_type' => 'multiselect', |
|
950
|
1067
|
'class' => 'uwp-multiselect', |
|
951
|
1068
|
'field_icon' => 'far fa-caret-square-down', |
|
952
|
1069
|
'site_title' => __( 'Multi Select', 'userswp' ), |
|
953
|
|
- 'help_text' => __( 'Adds a multiselect input', 'userswp' ), |
|
1070
|
+ 'help_text' => __( 'Adds a multiselect input', 'userswp' ) |
|
954
|
1071
|
), |
|
955
|
1072
|
'url' => array( |
|
956
|
1073
|
'field_type' => 'url', |
|
957
|
1074
|
'class' => 'uwp-url', |
|
@@ -956,9 +1073,9 @@ |
|
956
|
1073
|
'field_type' => 'url', |
|
957
|
1074
|
'class' => 'uwp-url', |
|
958
|
1075
|
'field_icon' => 'fas fa-link', |
|
959
|
1076
|
'site_title' => __( 'URL', 'userswp' ), |
|
960
|
|
- 'help_text' => __( 'Adds a url input', 'userswp' ), |
|
1077
|
+ 'help_text' => __( 'Adds a url input', 'userswp' ) |
|
961
|
1078
|
), |
|
962
|
1079
|
'editor' => array( |
|
963
|
1080
|
'field_type' => 'editor', |
|
964
|
1081
|
'class' => 'uwp-html', |
|
@@ -963,9 +1080,9 @@ |
|
963
|
1080
|
'field_type' => 'editor', |
|
964
|
1081
|
'class' => 'uwp-html', |
|
965
|
1082
|
'field_icon' => 'fas fa-code', |
|
966
|
1083
|
'site_title' => __( 'HTML', 'userswp' ), |
|
967
|
|
- 'help_text' => __( 'Adds a wysiwyg editor input', 'userswp' ), |
|
1084
|
+ 'help_text' => __( 'Adds a wysiwyg editor input', 'userswp' ) |
|
968
|
1085
|
), |
|
969
|
1086
|
'file' => array( |
|
970
|
1087
|
'field_type' => 'file', |
|
971
|
1088
|
'class' => 'uwp-file', |
|
@@ -970,10 +1087,10 @@ |
|
970
|
1087
|
'field_type' => 'file', |
|
971
|
1088
|
'class' => 'uwp-file', |
|
972
|
1089
|
'field_icon' => 'fas fa-file', |
|
973
|
1090
|
'site_title' => __( 'File Upload', 'userswp' ), |
|
974
|
|
- 'help_text' => __( 'Adds a file input', 'userswp' ), |
|
975
|
|
- ), |
|
1091
|
+ 'help_text' => __( 'Adds a file input', 'userswp' ) |
|
1092
|
+ ) |
|
976
|
1093
|
); |
|
977
|
1094
|
|
|
978
|
1095
|
return apply_filters( 'uwp_form_fields', $custom_fields, $type ); |
|
979
|
1096
|
} |
|
@@ -999,21 +1116,14 @@ |
|
999
|
1116
|
|
|
1000
|
1117
|
public function register_available_fields( $form_type ) { |
|
1001
|
1118
|
global $wpdb; |
|
1002
|
1119
|
|
|
1003
|
|
- $form_id = self::get_form_id(); |
|
1120
|
+ $form_id = ! empty( $_GET['form'] ) ? absint($_GET['form']) : 1; |
|
1004
|
1121
|
|
|
1005
|
1122
|
$extras_table_name = uwp_get_table_prefix() . 'uwp_form_extras'; |
|
1006
|
1123
|
|
|
1007
|
|
- // Retrieve fields saved with form id 0. |
|
1008
|
|
- if ( $form_id === 1 ) { |
|
1009
|
|
- $where = 'AND ( form_id = 1 OR form_id = 0 )'; |
|
1010
|
|
- } else { |
|
1011
|
|
- $where = $wpdb->prepare( 'AND form_id = %d', $form_id ); |
|
1012
|
|
- } |
|
1124
|
+ $existing_fields = $wpdb->get_results( "select site_htmlvar_name from " . $extras_table_name . " where form_type ='" . $form_type . "' AND form_id = " . $form_id ); |
|
1013
|
1125
|
|
|
1014
|
|
- $existing_fields = $wpdb->get_results( $wpdb->prepare( 'SELECT site_htmlvar_name FROM `' . $extras_table_name . "` WHERE form_type = %s {$where}", $form_type ) ); |
|
1015
|
|
- |
|
1016
|
1126
|
$existing_field_ids = array(); |
|
1017
|
1127
|
if ( ! empty( $existing_fields ) ) { |
|
1018
|
1128
|
foreach ( $existing_fields as $existing_field ) { |
|
1019
|
1129
|
$existing_field_ids[] = $existing_field->site_htmlvar_name; |
|
@@ -1019,11 +1129,11 @@ |
|
1019
|
1129
|
$existing_field_ids[] = $existing_field->site_htmlvar_name; |
|
1020
|
1130
|
} |
|
1021
|
1131
|
} |
|
1022
|
1132
|
?> |
|
1023
|
|
- <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr( $form_type ); ?>"/> |
|
1133
|
+ <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr($form_type); ?>"/> |
|
1024
|
1134
|
<input type="hidden" name="manage_field_type" class="manage_field_type" value="register"> |
|
1025
|
|
- <ul class="row row-cols-1 px-2 mb-0"> |
|
1135
|
+ <ul> |
|
1026
|
1136
|
<?php |
|
1027
|
1137
|
|
|
1028
|
1138
|
$fields = $this->register_fields( $form_type, $form_id ); |
|
1029
|
1139
|
|
|
@@ -1030,8 +1140,9 @@ |
|
1030
|
1140
|
if ( ! empty( $fields ) ) { |
|
1031
|
1141
|
foreach ( $fields as $field ) { |
|
1032
|
1142
|
$field = stripslashes_deep( $field ); // strip slashes |
|
1033
|
1143
|
|
|
1144
|
+ |
|
1034
|
1145
|
$fieldset_width = ''; |
|
1035
|
1146
|
if ( $field['field_type'] == 'fieldset' ) { |
|
1036
|
1147
|
$fieldset_width = 'width:100%;'; |
|
1037
|
1148
|
} |
|
@@ -1042,23 +1153,21 @@ |
|
1042
|
1153
|
} |
|
1043
|
1154
|
|
|
1044
|
1155
|
$style = 'style="' . $display . $fieldset_width . '"'; |
|
1045
|
1156
|
?> |
|
1046
|
|
- <li <?php echo $style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> class="col px-1" > |
|
1157
|
+ <li <?php echo $style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> > |
|
1047
|
1158
|
|
|
1048
|
|
- <a id="uwp-<?php echo esc_attr( $field['htmlvar_name'] ); ?>" |
|
1049
|
|
- class="uwp-draggable-form-itemsx uwp-<?php echo esc_attr( $field['field_type'] ); ?> btn btn-sm d-block m-0 btn-outline-gray text-dark text-start" |
|
1050
|
|
- href="javascript:void(0);" data-field-type="<?php echo esc_attr( $field['field_type'] ); ?>"> |
|
1159
|
+ <a id="uwp-<?php echo esc_attr($field['htmlvar_name']); ?>" |
|
1160
|
+ class="uwp-draggable-form-items uwp-<?php echo esc_attr($field['field_type']); ?>" |
|
1161
|
+ href="javascript:void(0);" data-field-type="<?php echo esc_attr($field['field_type']); ?>"> |
|
1051
|
1162
|
|
|
1052
|
|
- <?php |
|
1053
|
|
- if ( $icon = uwp_get_field_icon( $field['field_icon'] ) ) { |
|
1163
|
+ <?php if ( $icon = uwp_get_field_icon( $field['field_icon'] ) ) { |
|
1054
|
1164
|
echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1055
|
1165
|
} else { |
|
1056
|
1166
|
echo '<i class="fas fa-cog" aria-hidden="true"></i>'; |
|
1057
|
|
- } |
|
1058
|
|
- ?> |
|
1167
|
+ } ?> |
|
1059
|
1168
|
|
|
1060
|
|
- <?php echo esc_attr( $field['site_title'] ); ?> |
|
1169
|
+ <?php echo esc_attr($field['site_title']); ?> |
|
1061
|
1170
|
|
|
1062
|
1171
|
</a> |
|
1063
|
1172
|
</li> |
|
1064
|
1173
|
|
|
@@ -1071,21 +1180,18 @@ |
|
1071
|
1180
|
<?php |
|
1072
|
1181
|
} |
|
1073
|
1182
|
|
|
1074
|
1183
|
public function register_fields( $form_type, $form_id = 1 ) { |
|
1184
|
+ |
|
1075
|
1185
|
global $wpdb; |
|
1076
|
1186
|
|
|
1077
|
1187
|
$table_name = uwp_get_table_prefix() . 'uwp_form_fields'; |
|
1188
|
+ $fields = $wpdb->get_results( $wpdb->prepare( "select field_type, site_title, htmlvar_name, field_icon from " . $table_name . " where form_type = %s and is_register_field = %s and form_id = %d order by sort_order asc", array( |
|
1189
|
+ 'account', |
|
1190
|
+ '1', |
|
1191
|
+ $form_id |
|
1192
|
+ ) ), ARRAY_A ); |
|
1078
|
1193
|
|
|
1079
|
|
- // Retrieve fields saved with form id 0. |
|
1080
|
|
- if ( $form_id === 1 ) { |
|
1081
|
|
- $where = 'AND ( form_id = 1 OR form_id = 0 )'; |
|
1082
|
|
- } else { |
|
1083
|
|
- $where = $wpdb->prepare( 'AND form_id = %d', $form_id ); |
|
1084
|
|
- } |
|
1085
|
|
- |
|
1086
|
|
- $fields = $wpdb->get_results( $wpdb->prepare( 'SELECT field_type, site_title, htmlvar_name, field_icon FROM `' . $table_name . "` WHERE form_type = %s AND is_register_field = %s {$where} ORDER BY sort_order ASC", array( 'account', '1' ) ), ARRAY_A ); |
|
1087
|
|
- |
|
1088
|
1194
|
return apply_filters( 'uwp_register_fields', $fields, $form_type ); |
|
1089
|
1195
|
} |
|
1090
|
1196
|
|
|
1091
|
1197
|
public function manage_selected_fields( $form_type ) { |
|
@@ -1102,24 +1208,19 @@ |
|
1102
|
1208
|
public function custom_selected_fields( $form_type ) { |
|
1103
|
1209
|
|
|
1104
|
1210
|
global $wpdb; |
|
1105
|
1211
|
$table_name = uwp_get_table_prefix() . 'uwp_form_fields'; |
|
1106
|
|
- $form_id = self::get_form_id(); |
|
1212
|
+ $form_id = ! empty( $_GET['form'] ) ? absint($_GET['form']) : 1; |
|
1107
|
1213
|
?> |
|
1108
|
|
- <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr( $form_type ); ?>"/> |
|
1214
|
+ <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr($form_type); ?>"/> |
|
1109
|
1215
|
<input type="hidden" name="manage_field_type" class="manage_field_type" value="custom_fields"> |
|
1110
|
|
- <input type="hidden" name="uwp_create_field_nonce" class="uwp_create_field_nonce" value="<?php echo wp_create_nonce( 'uwp_create_field_nonce' ); ?>"/> |
|
1111
|
|
- <ul class="core uwp-tabs-selected uwp_form_extras ps-0 list-group"> |
|
1216
|
+ <ul class="core uwp-tabs-selected uwp_form_extras"> |
|
1112
|
1217
|
<?php |
|
1113
|
|
- // Retrieve fields saved with form id 0. |
|
1114
|
|
- if ( $form_id === 1 ) { |
|
1115
|
|
- $where = 'AND ( form_id = 1 OR form_id = 0 )'; |
|
1116
|
|
- } else { |
|
1117
|
|
- $where = $wpdb->prepare( 'AND form_id = %d', $form_id ); |
|
1118
|
|
- } |
|
1218
|
+ $fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . $table_name . " WHERE form_type = %s AND form_id = %s ORDER BY sort_order ASC", array( |
|
1219
|
+ $form_type, |
|
1220
|
+ $form_id |
|
1221
|
+ ) ) ); |
|
1119
|
1222
|
|
|
1120
|
|
- $fields = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM `' . $table_name . "` WHERE form_type = %s {$where} ORDER BY sort_order ASC", $form_type ) ); |
|
1121
|
|
- |
|
1122
|
1223
|
if ( ! empty( $fields ) ) { |
|
1123
|
1224
|
foreach ( $fields as $field ) { |
|
1124
|
1225
|
$result_str = $field; |
|
1125
|
1226
|
$field_type = $field->field_type; |
|
@@ -1128,11 +1229,11 @@ |
|
1128
|
1229
|
|
|
1129
|
1230
|
$this->form_field_adminhtml( $field_type, $result_str, $field_ins_upd, $field_type_key ); |
|
1130
|
1231
|
} |
|
1131
|
1232
|
} |
|
1132
|
|
- ?> |
|
1133
|
|
- </ul> |
|
1233
|
+ ?></ul> |
|
1134
|
1234
|
<?php |
|
1235
|
+ |
|
1135
|
1236
|
} |
|
1136
|
1237
|
|
|
1137
|
1238
|
public function form_field_adminhtml( $field_type, $result_str, $field_ins_upd = '', $field_type_key = '', $form_type = false ) { |
|
1138
|
1239
|
global $wpdb; |
|
@@ -1141,9 +1242,9 @@ |
|
1141
|
1242
|
$cf_arr = $this->get_form_existing_fields( $form_type ); |
|
1142
|
1243
|
|
|
1143
|
1244
|
if ( ! is_object( $cf ) ) { |
|
1144
|
1245
|
|
|
1145
|
|
- $field_info = $wpdb->get_row( $wpdb->prepare( 'select * from ' . $table_name . ' where id= %d', array( $cf ) ) ); |
|
1246
|
+ $field_info = $wpdb->get_row( $wpdb->prepare( "select * from " . $table_name . " where id= %d", array( $cf ) ) ); |
|
1146
|
1247
|
|
|
1147
|
1248
|
} else { |
|
1148
|
1249
|
$field_info = $cf; |
|
1149
|
1250
|
$result_str = $cf->id; |
|
@@ -1153,8 +1254,9 @@ |
|
1153
|
1254
|
$field_info = ( isset( $cf_arr[ $field_type_key ] ) ) ? $cf_arr[ $field_type_key ] : null; |
|
1154
|
1255
|
} |
|
1155
|
1256
|
|
|
1156
|
1257
|
$this->admin_form_field_html( $field_info, $field_type, $field_type_key, $field_ins_upd, $result_str, $form_type ); |
|
1258
|
+ |
|
1157
|
1259
|
} |
|
1158
|
1260
|
|
|
1159
|
1261
|
/** |
|
1160
|
1262
|
* @param $field_info |
|
@@ -1191,11 +1293,11 @@ |
|
1191
|
1293
|
|
|
1192
|
1294
|
$field_display = $field_type == 'address' && $field_info->htmlvar_name == 'post' ? 'style="display:none"' : ''; |
|
1193
|
1295
|
|
|
1194
|
1296
|
if ( isset( $cf['field_icon'] ) && strpos( $cf['field_icon'], ' fa-' ) !== false ) { |
|
1195
|
|
- $field_icon = '<i class="' . esc_attr( $cf['field_icon'] ) . '" aria-hidden="true"></i>'; |
|
1297
|
+ $field_icon = '<i class="' . esc_attr($cf['field_icon']) . '" aria-hidden="true"></i>'; |
|
1196
|
1298
|
} elseif ( isset( $cf['field_icon'] ) && $cf['field_icon'] ) { |
|
1197
|
|
- $field_icon = '<b style="background-image: url("' . esc_url( $cf['field_icon'] ) . '")"></b>'; |
|
1299
|
+ $field_icon = '<b style="background-image: url("' . esc_url($cf['field_icon']) . '")"></b>'; |
|
1198
|
1300
|
} else { |
|
1199
|
1301
|
$field_icon = '<i class="fas fa-cog" aria-hidden="true"></i>'; |
|
1200
|
1302
|
} |
|
1201
|
1303
|
|
|
@@ -1204,588 +1306,603 @@ |
|
1204
|
1306
|
} else { |
|
1205
|
1307
|
$field_type_name = $field_type; |
|
1206
|
1308
|
} |
|
1207
|
1309
|
|
|
1208
|
|
- $htmlvar_name = isset( $field_info->htmlvar_name ) ? sanitize_text_field( $field_info->htmlvar_name ) : ''; |
|
1209
|
|
- $can_delete = apply_filters( 'uwp_cfa_can_delete_field', true, $field_info, $form_type ); |
|
1210
|
|
- $nonce = wp_create_nonce( 'custom_fields_' . $result_str ); |
|
1310
|
+ $htmlvar_name = isset($field_info->htmlvar_name) ? sanitize_text_field($field_info->htmlvar_name) : ''; |
|
1211
|
1311
|
|
|
1212
|
1312
|
?> |
|
1213
|
1313
|
<li class="text li-settings" id="licontainer_<?php echo esc_attr( $result_str ); ?>"> |
|
1214
|
|
- <div class="title title<?php echo esc_attr( $result_str ); ?> uwp-fieldset hover-shadow dd-form d-flex justify-content-between rounded c-pointer list-group-item border rounded-smx text-start bg-light " onclick="uwp_tabs_item_settings(this);"> |
|
1215
|
|
- <div class="flex-fill font-weight-bold fw-bold"> |
|
1216
|
|
- <?php if ( $field_type == 'fieldset' ) { ?> |
|
1217
|
|
- <i class="fas fa-long-arrow-alt-left " aria-hidden="true"></i> |
|
1218
|
|
- <i class="fas fa-long-arrow-alt-right " aria-hidden="true"></i> |
|
1219
|
|
- <b><?php echo esc_html( __( 'Fieldset:', 'userswp' ) ); ?></b> |
|
1220
|
|
- <span class="field-type float-end text-end small"><?php echo ' (' . esc_html( $field_site_title ) . ')'; ?></span> |
|
1221
|
|
- <?php } else { ?> |
|
1222
|
|
- <?php echo $field_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
|
1223
|
|
- <b><?php echo esc_html( ' ' . $field_site_title ); ?></b> |
|
1224
|
|
- <span class="field-type float-end text-end small"><?php echo ' (' . esc_html( ucfirst( $field_type_name ) ) . ')'; ?></span> |
|
1225
|
|
- <?php } ?> |
|
1226
|
|
- </div> |
|
1227
|
|
- <div class="dd-handle ui-sortable-handle"> |
|
1228
|
|
- <?php if ( $can_delete ) { ?> |
|
1229
|
|
- <i class="far fa-trash-alt text-danger ml-2 ms-2" |
|
1230
|
|
- id="delete-<?php echo esc_attr( $result_str ); ?>" |
|
1231
|
|
- onclick="delete_field('<?php echo esc_attr( $result_str ); ?>', '<?php echo esc_attr( wp_create_nonce( 'custom_fields_delete_' . $result_str ) ); ?>', '<?php echo esc_attr( $htmlvar_name ); ?>');event.stopPropagation();return false;"></i> |
|
1232
|
|
- <?php } ?> |
|
1233
|
|
- <i class="fas fa-grip-vertical text-muted ml-2 ms-2" style="cursor: move" aria-hidden="true"></i> |
|
1234
|
|
- </div> |
|
1314
|
+ <i class="fas fa-caret-down toggle-arrow" aria-hidden="true" onclick="uwp_show_hide(this);"></i> |
|
1315
|
+ <div class="title title<?php echo esc_attr( $result_str ); ?> uwp-fieldset"> |
|
1316
|
+ <?php |
|
1317
|
+ $nonce = wp_create_nonce( 'custom_fields_' . $result_str ); |
|
1318
|
+ if ( $field_type == 'fieldset' ) { |
|
1319
|
+ ?> |
|
1320
|
+ <i class="fas fa-long-arrow-alt-left " aria-hidden="true"></i> |
|
1321
|
+ <i class="fas fa-long-arrow-alt-right " aria-hidden="true"></i> |
|
1322
|
+ <b><?php echo esc_html( uwp_ucwords( __( 'Fieldset:', 'userswp' ) ) ); ?></b> |
|
1323
|
+ <span class="field-type"><?php echo ' (' . esc_html( uwp_ucwords( $field_site_title ) ) . ')'; ?></span> |
|
1324
|
+ <?php |
|
1325
|
+ } else { |
|
1326
|
+ echo $field_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1327
|
+ ?> |
|
1328
|
+ <b><?php echo esc_html( uwp_ucwords( ' ' . $field_site_title ) ); ?></b> |
|
1329
|
+ <span class="field-type"><?php echo ' (' . esc_html( uwp_ucwords( $field_type_name ) ) . ')'; ?></span> |
|
1330
|
+ <?php |
|
1331
|
+ } |
|
1332
|
+ ?> |
|
1333
|
+ </div> |
|
1235
|
1334
|
|
|
1236
|
|
- <?php // store the form as a template. This saves a load of memory on page load. ?> |
|
1237
|
|
- <script type="text/template" class="dd-setting <?php echo 'dd-type-' . esc_attr( $field_type ); ?>"> |
|
1335
|
+ <form> |
|
1336
|
+ <div id="field_frm<?php echo esc_attr( $result_str ); ?>" class="field_frm" |
|
1337
|
+ style="display:<?php if ( $field_ins_upd == 'submit' ) { |
|
1338
|
+ echo 'block;'; |
|
1339
|
+ } else { |
|
1340
|
+ echo 'none;'; |
|
1341
|
+ } ?>"> |
|
1238
|
1342
|
<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( $nonce ); ?>"/> |
|
1239
|
|
- <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr( $form_type ); ?>"/> |
|
1240
|
|
- <input type="hidden" name="field_type" id="field_type" value="<?php echo esc_attr( $field_type ); ?>"/> |
|
1241
|
|
- <input type="hidden" name="field_type_key" id="field_type_key" value="<?php echo esc_attr( $field_type_key ); ?>"/> |
|
1343
|
+ <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr($form_type); ?>"/> |
|
1344
|
+ <input type="hidden" name="field_type" id="field_type" value="<?php echo esc_attr($field_type); ?>"/> |
|
1345
|
+ <input type="hidden" name="field_type_key" id="field_type_key" |
|
1346
|
+ value="<?php echo esc_attr($field_type_key); ?>"/> |
|
1242
|
1347
|
<input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr( $result_str ); ?>"/> |
|
1243
|
|
- <input type="hidden" name="is_default" value="<?php echo isset( $field_info->is_default ) ? esc_attr( $field_info->is_default ) : ''; ?>"/><?php // show in sidebar value ?> |
|
1348
|
+ <input type="hidden" name="is_active" id="is_active" value="1"/> |
|
1244
|
1349
|
|
|
1245
|
|
- <?php |
|
1246
|
|
- // data_type |
|
1247
|
|
- if ( has_filter( "uwp_builder_data_type_{$field_type}" ) ) { |
|
1350
|
+ <input type="hidden" name="is_default" |
|
1351
|
+ value="<?php echo isset( $field_info->is_default ) ? esc_attr($field_info->is_default) : ''; ?>"/><?php // show in sidebar value?> |
|
1248
|
1352
|
|
|
1249
|
|
- echo apply_filters( "uwp_builder_data_type_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1353
|
+ <ul class="widefat post fixed" style="width:100%;"> |
|
1250
|
1354
|
|
|
1251
|
|
- } else { |
|
1252
|
|
- $value = ''; |
|
1253
|
|
- if ( isset( $field_info->data_type ) ) { |
|
1254
|
|
- $value = esc_attr( $field_info->data_type ); |
|
1255
|
|
- } elseif ( isset( $cf['defaults']['data_type'] ) && $cf['defaults']['data_type'] ) { |
|
1256
|
|
- $value = $cf['defaults']['data_type']; |
|
1257
|
|
- } |
|
1258
|
|
- ?> |
|
1259
|
|
- <input type="hidden" name="data_type" id="data_type" value="<?php echo esc_attr( $value ); ?>"/> |
|
1260
|
|
- <?php |
|
1261
|
|
- } |
|
1355
|
+ <?php |
|
1356
|
+ // data_type |
|
1357
|
+ if ( has_filter( "uwp_builder_data_type_{$field_type}" ) ) { |
|
1262
|
1358
|
|
|
1263
|
|
- // site_title |
|
1264
|
|
- if ( has_filter( "uwp_builder_site_title_{$field_type}" ) ) { |
|
1359
|
+ echo apply_filters( "uwp_builder_data_type_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1265
|
1360
|
|
|
1266
|
|
- echo apply_filters( "uwp_builder_site_title_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1361
|
+ } else { |
|
1362
|
+ $value = ''; |
|
1363
|
+ if ( isset( $field_info->data_type ) ) { |
|
1364
|
+ $value = esc_attr( $field_info->data_type ); |
|
1365
|
+ } elseif ( isset( $cf['defaults']['data_type'] ) && $cf['defaults']['data_type'] ) { |
|
1366
|
+ $value = $cf['defaults']['data_type']; |
|
1367
|
+ } |
|
1368
|
+ ?> |
|
1369
|
+ <input type="hidden" name="data_type" id="data_type" value="<?php echo esc_attr($value); ?>"/> |
|
1370
|
+ <?php |
|
1371
|
+ } |
|
1267
|
1372
|
|
|
1268
|
|
- } else { |
|
1269
|
|
- $value = ''; |
|
1270
|
|
- if ( isset( $field_info->site_title ) ) { |
|
1271
|
|
- $value = esc_attr( $field_info->site_title ); |
|
1272
|
|
- } elseif ( isset( $cf['defaults']['site_title'] ) && $cf['defaults']['site_title'] ) { |
|
1273
|
|
- $value = $cf['defaults']['site_title']; |
|
1274
|
|
- } |
|
1373
|
+ // site_title |
|
1374
|
+ if ( has_filter( "uwp_builder_site_title_{$field_type}" ) ) { |
|
1275
|
1375
|
|
|
1276
|
|
- echo aui()->input( |
|
1277
|
|
- array( |
|
1278
|
|
- 'id' => 'site_title', |
|
1279
|
|
- 'name' => 'site_title', |
|
1280
|
|
- 'label_type' => 'top', |
|
1281
|
|
- 'label' => esc_html__( 'Label', 'userswp' ) . uwp_help_tip( __( 'This will be the label for the field.', 'userswp' ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1282
|
|
- 'type' => 'text', |
|
1283
|
|
- // 'wrap_class' => geodir_advanced_toggle_class(), |
|
1284
|
|
- 'value' => $value, |
|
1285
|
|
- ) |
|
1286
|
|
- ); |
|
1287
|
|
- } |
|
1376
|
+ echo apply_filters( "uwp_builder_site_title_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1288
|
1377
|
|
|
1289
|
|
- // Input Label |
|
1290
|
|
- if ( has_filter( "uwp_builder_form_label_{$field_type}" ) ) { |
|
1378
|
+ } else { |
|
1379
|
+ $value = ''; |
|
1380
|
+ if ( isset( $field_info->site_title ) ) { |
|
1381
|
+ $value = esc_attr( $field_info->site_title ); |
|
1382
|
+ } elseif ( isset( $cf['defaults']['site_title'] ) && $cf['defaults']['site_title'] ) { |
|
1383
|
+ $value = $cf['defaults']['site_title']; |
|
1384
|
+ } |
|
1385
|
+ ?> |
|
1386
|
+ <li class="uwp-setting-name"> |
|
1387
|
+ <label for="site_title" class="uwp-tooltip-wrap"> |
|
1388
|
+ <?php |
|
1389
|
+ echo uwp_help_tip( __( 'This will be the label for the field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1390
|
+ esc_html_e( 'Field Label:', 'userswp' ); ?> |
|
1391
|
+ </label> |
|
1392
|
+ <div class="uwp-input-wrap"> |
|
1393
|
+ <input type="text" name="site_title" id="site_title" |
|
1394
|
+ value="<?php echo esc_attr($value); ?>"/> |
|
1395
|
+ </div> |
|
1396
|
+ </li> |
|
1397
|
+ <?php |
|
1398
|
+ } |
|
1291
|
1399
|
|
|
1292
|
|
- echo apply_filters( "uwp_builder_form_label_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1400
|
+ // Input Label |
|
1401
|
+ if ( has_filter( "uwp_builder_form_label_{$field_type}" ) ) { |
|
1293
|
1402
|
|
|
1294
|
|
- } else { |
|
1295
|
|
- $value = ''; |
|
1296
|
|
- if ( isset( $field_info->form_label ) ) { |
|
1297
|
|
- $value = esc_attr( $field_info->form_label ); |
|
1298
|
|
- } elseif ( isset( $cf['defaults']['form_label'] ) && $cf['defaults']['form_label'] ) { |
|
1299
|
|
- $value = $cf['defaults']['form_label']; |
|
1300
|
|
- } |
|
1403
|
+ echo apply_filters( "uwp_builder_form_label_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1301
|
1404
|
|
|
1302
|
|
- echo aui()->input( |
|
1303
|
|
- array( |
|
1304
|
|
- 'id' => 'form_label', |
|
1305
|
|
- 'name' => 'form_label', |
|
1306
|
|
- 'label_type' => 'top', |
|
1307
|
|
- 'label' => esc_html__( 'Form Label: (Optional)', 'userswp' ) . uwp_help_tip( __( 'If your form label is different, then you can fill this field. Ex: You would like to display "What is your age?" in Form Field but would like to display "DOB" in site. In such cases "What is your age?" should be entered here and "DOB" should be entered in previous field. Note: If this field not filled, then the previous field will be used in Form.', 'userswp' ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1308
|
|
- 'type' => 'text', |
|
1309
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1310
|
|
- 'value' => $value, |
|
1311
|
|
- ) |
|
1312
|
|
- ); |
|
1313
|
|
- } |
|
1405
|
+ } else { |
|
1406
|
+ $value = ''; |
|
1407
|
+ if ( isset( $field_info->form_label ) ) { |
|
1408
|
+ $value = esc_attr( $field_info->form_label ); |
|
1409
|
+ } elseif ( isset( $cf['defaults']['form_label'] ) && $cf['defaults']['form_label'] ) { |
|
1410
|
+ $value = $cf['defaults']['form_label']; |
|
1411
|
+ } |
|
1412
|
+ ?> |
|
1413
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
1414
|
+ <label for="form_label" class="uwp-tooltip-wrap"> |
|
1415
|
+ <?php |
|
1416
|
+ echo uwp_help_tip( __( 'If your form label is different, then you can fill this field. Ex: You would like to display "What is your age?" in Form Field but would like to display "DOB" in site. In such cases "What is your age?" should be entered here and "DOB" should be entered in previous field. Note: If this field not filled, then the previous field will be used in Form.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1417
|
+ esc_html_e( 'Form Label: (Optional)', 'userswp' ); ?> |
|
1418
|
+ </label> |
|
1419
|
+ <div class="uwp-input-wrap"> |
|
1420
|
+ <input type="text" name="form_label" id="form_label" |
|
1421
|
+ value="<?php echo esc_attr($value); ?>"/> |
|
1422
|
+ </div> |
|
1423
|
+ </li> |
|
1424
|
+ <?php |
|
1425
|
+ } |
|
1314
|
1426
|
|
|
1315
|
|
- // Input Description |
|
1316
|
|
- if ( has_filter( "uwp_builder_field_description_{$field_type}" ) ) { |
|
1427
|
+ // Input Description |
|
1428
|
+ if ( has_filter( "uwp_builder_field_description_{$field_type}" ) ) { |
|
1317
|
1429
|
|
|
1318
|
|
- echo apply_filters( "uwp_builder_field_description_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1430
|
+ echo apply_filters( "uwp_builder_field_description_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1319
|
1431
|
|
|
1320
|
|
- } else { |
|
1321
|
|
- $value = ''; |
|
1322
|
|
- if ( isset( $field_info->help_text ) ) { |
|
1323
|
|
- $value = esc_attr( $field_info->help_text ); |
|
1324
|
|
- } elseif ( isset( $cf['defaults']['help_text'] ) && $cf['defaults']['help_text'] ) { |
|
1325
|
|
- $value = $cf['defaults']['help_text']; |
|
1326
|
|
- } |
|
1327
|
|
- $tip_text = ! empty( $cf['help_text_tip'] ) ? esc_attr( $cf['help_text_tip'] ) : __( 'This will be displayed below the field in the form.', 'userswp' ); |
|
1328
|
|
- echo aui()->input( |
|
1329
|
|
- array( |
|
1330
|
|
- 'id' => 'help_text', |
|
1331
|
|
- 'name' => 'help_text', |
|
1332
|
|
- 'label_type' => 'top', |
|
1333
|
|
- 'label' => esc_html__( 'Field Description', 'userswp' ) . uwp_help_tip( $tip_text ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1334
|
|
- 'type' => 'text', |
|
1335
|
|
- //'wrap_class' => uwp_advanced_toggle_class(), |
|
1336
|
|
- 'value' => $value, |
|
1337
|
|
- ) |
|
1338
|
|
- ); |
|
1432
|
+ } else { |
|
1433
|
+ $value = ''; |
|
1434
|
+ if ( isset( $field_info->help_text ) ) { |
|
1435
|
+ $value = esc_attr( $field_info->help_text ); |
|
1436
|
+ } elseif ( isset( $cf['defaults']['help_text'] ) && $cf['defaults']['help_text'] ) { |
|
1437
|
+ $value = $cf['defaults']['help_text']; |
|
1438
|
+ } |
|
1439
|
+ ?> |
|
1440
|
+ <li class="uwp-setting-name"> |
|
1441
|
+ <label for="help_text" class="uwp-tooltip-wrap"> |
|
1442
|
+ <?php |
|
1443
|
+ $tip_text = !empty($cf['help_text_tip']) ? esc_attr($cf['help_text_tip']) : __( 'This will be displayed below the field in the form.', 'userswp' ); |
|
1444
|
+ echo uwp_help_tip( $tip_text ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1445
|
+ esc_html_e( 'Field Description:', 'userswp' ); ?> |
|
1446
|
+ </label> |
|
1447
|
+ <div class="uwp-input-wrap"> |
|
1448
|
+ <input type="text" name="help_text" id="help_text" |
|
1449
|
+ value="<?php echo esc_attr($value); ?>"/> |
|
1450
|
+ </div> |
|
1451
|
+ </li> |
|
1452
|
+ <?php |
|
1453
|
+ } |
|
1339
|
1454
|
|
|
1340
|
|
- } |
|
1341
|
1455
|
|
|
1342
|
|
- // htmlvar_name |
|
1343
|
|
- if ( has_filter( "uwp_builder_htmlvar_name_{$field_type}" ) ) { |
|
1456
|
+ // htmlvar_name |
|
1457
|
+ if ( has_filter( "uwp_builder_htmlvar_name_{$field_type}" ) ) { |
|
1344
|
1458
|
|
|
1345
|
|
- echo apply_filters( "uwp_builder_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1459
|
+ echo apply_filters( "uwp_builder_htmlvar_name_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1346
|
1460
|
|
|
1347
|
|
- } else { |
|
1348
|
|
- $value = ''; |
|
1349
|
|
- if ( isset( $field_info->htmlvar_name ) ) { |
|
1350
|
|
- $value = esc_attr( $field_info->htmlvar_name ); |
|
1351
|
|
- } elseif ( isset( $cf['defaults']['htmlvar_name'] ) && $cf['defaults']['htmlvar_name'] ) { |
|
1352
|
|
- $value = $cf['defaults']['htmlvar_name']; |
|
1353
|
|
- } |
|
1461
|
+ } else { |
|
1462
|
+ $value = ''; |
|
1463
|
+ if ( isset( $field_info->htmlvar_name ) ) { |
|
1464
|
+ $value = esc_attr( $field_info->htmlvar_name ); |
|
1465
|
+ } elseif ( isset( $cf['defaults']['htmlvar_name'] ) && $cf['defaults']['htmlvar_name'] ) { |
|
1466
|
+ $value = $cf['defaults']['htmlvar_name']; |
|
1467
|
+ } |
|
1468
|
+ ?> |
|
1469
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
1470
|
+ <label for="htmlvar_name" class="uwp-tooltip-wrap"> |
|
1471
|
+ <?php |
|
1472
|
+ echo uwp_help_tip( __( 'This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1473
|
+ esc_html_e( 'Field Key :', 'userswp' ); ?> |
|
1474
|
+ </label> |
|
1475
|
+ <div class="uwp-input-wrap"> |
|
1476
|
+ <input type="text" name="htmlvar_name" id="htmlvar_name" pattern="[a-zA-Z0-9]+" |
|
1477
|
+ title="<?php esc_attr_e( 'Must not contain spaces or special characters', 'userswp' ); ?>" |
|
1478
|
+ value="<?php if ( $value ) { |
|
1479
|
+ echo esc_attr( preg_replace( '/uwp_' . $form_type . '_/', '', $value, 1 ) ); |
|
1480
|
+ } ?>" <?php if ( ! empty( $value ) && $value != '' ) { |
|
1481
|
+ echo 'readonly="readonly"'; |
|
1482
|
+ } ?> /> |
|
1483
|
+ </div> |
|
1484
|
+ </li> |
|
1485
|
+ <?php |
|
1486
|
+ } |
|
1354
|
1487
|
|
|
1355
|
|
- $extra_attributes = array(); |
|
1356
|
|
- $class = ''; |
|
1357
|
|
- if ( isset( $field_info->id ) && substr( $field_info->id, 0, 4 ) === 'new-' && empty( $field_info->single_use ) ) { |
|
1358
|
|
-} // New non single use predefined fields should have ability to change html_var |
|
1359
|
|
- elseif ( ! empty( $value ) && $value != 'uwp_' ) { |
|
1360
|
|
-$extra_attributes['readonly'] = 'readonly'; $class = 'bg-opacity-50 bg-gray'; } |
|
1488
|
+ // Placeholder text |
|
1489
|
+ if ( has_filter( "uwp_builder_placeholder_value_{$field_type}" ) ) { |
|
1361
|
1490
|
|
|
1362
|
|
- $extra_attributes['maxlength'] = 50; |
|
1363
|
|
- $extra_attributes['pattern'] = '[a-zA-Z0-9]+'; |
|
1491
|
+ echo apply_filters( "uwp_builder_placeholder_value_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1364
|
1492
|
|
|
1365
|
|
- echo aui()->input( |
|
1366
|
|
- array( |
|
1367
|
|
- 'id' => 'htmlvar_name', |
|
1368
|
|
- 'name' => 'htmlvar_name', |
|
1369
|
|
- 'title' => __( 'Must not contain spaces or special characters', 'userswp' ), |
|
1370
|
|
- 'label_type' => 'top', |
|
1371
|
|
- 'label' => __( 'Key', 'userswp' ) . uwp_help_tip( __( 'This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.', 'userswp' ) ), |
|
1372
|
|
- 'type' => 'text', |
|
1373
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1374
|
|
- 'value' => $value ? preg_replace( '/uwp_/', '', $value, 1 ) : '', |
|
1375
|
|
- 'extra_attributes' => $extra_attributes, |
|
1376
|
|
- 'class' => $class, |
|
1377
|
|
- ) |
|
1378
|
|
- ); |
|
1493
|
+ } else { |
|
1494
|
+ $value = ''; |
|
1495
|
+ if ( isset( $field_info->placeholder_value ) ) { |
|
1496
|
+ $value = esc_attr( $field_info->placeholder_value ); |
|
1497
|
+ } elseif ( isset( $cf['defaults']['placeholder_value'] ) && $cf['defaults']['placeholder_value'] ) { |
|
1498
|
+ $value = $cf['defaults']['placeholder_value']; |
|
1499
|
+ } |
|
1500
|
+ ?> |
|
1501
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
1502
|
+ <label for="placeholder_value" class="uwp-tooltip-wrap"> |
|
1503
|
+ <?php |
|
1504
|
+ echo uwp_help_tip( __( 'Display placeholder text for this field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1505
|
+ esc_html_e( 'Placeholder :', 'userswp' ); ?> |
|
1506
|
+ </label> |
|
1507
|
+ <div class="uwp-input-wrap"> |
|
1508
|
+ <input type="text" name="placeholder_value" |
|
1509
|
+ id="placeholder_value_<?php echo esc_attr($result_str); ?>" |
|
1510
|
+ title="<?php esc_attr_e( 'Enter placeholder text for this field.', 'userswp' ); ?>" |
|
1511
|
+ value="<?php echo esc_attr($value); ?>"/> |
|
1512
|
+ </div> |
|
1513
|
+ </li> |
|
1514
|
+ <?php |
|
1515
|
+ } |
|
1379
|
1516
|
|
|
1380
|
|
- } |
|
1517
|
+ // is_active |
|
1518
|
+ if ( has_filter( "uwp_builder_is_active_{$field_type}" ) ) { |
|
1381
|
1519
|
|
|
1382
|
|
- // Placeholder text |
|
1383
|
|
- if ( has_filter( "uwp_builder_placeholder_value_{$field_type}" ) ) { |
|
1520
|
+ echo apply_filters( "uwp_builder_is_active_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1384
|
1521
|
|
|
1385
|
|
- echo apply_filters( "uwp_builder_placeholder_value_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1522
|
+ } else { |
|
1523
|
+ $value = ''; |
|
1524
|
+ if ( isset( $field_info->is_active ) ) { |
|
1525
|
+ $value = esc_attr( $field_info->is_active ); |
|
1526
|
+ } elseif ( isset( $cf['defaults']['is_active'] ) && $cf['defaults']['is_active'] ) { |
|
1527
|
+ $value = $cf['defaults']['is_active']; |
|
1528
|
+ } |
|
1529
|
+ ?> |
|
1530
|
+ <li <?php echo esc_attr($field_display); ?> class="uwp-setting-name"> |
|
1531
|
+ <label for="is_active" class="uwp-tooltip-wrap"> |
|
1532
|
+ <?php |
|
1533
|
+ echo uwp_help_tip( __( 'If no is selected then the field will not be displayed anywhere.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1534
|
+ esc_html_e( 'Is active :', 'userswp' ); ?> |
|
1535
|
+ </label> |
|
1536
|
+ <div class="uwp-input-wrap"> |
|
1537
|
+ <input type="hidden" name="is_active" value="0"/> |
|
1538
|
+ <input type="checkbox" name="is_active" |
|
1539
|
+ value="1" <?php checked( $value, 1, true ); ?> /> |
|
1540
|
+ </div> |
|
1541
|
+ </li> |
|
1542
|
+ <?php |
|
1543
|
+ } |
|
1386
|
1544
|
|
|
1387
|
|
- } else { |
|
1388
|
|
- $value = ''; |
|
1389
|
|
- if ( isset( $field_info->placeholder_value ) ) { |
|
1390
|
|
- $value = esc_attr( $field_info->placeholder_value ); |
|
1391
|
|
- } elseif ( isset( $cf['defaults']['placeholder_value'] ) && $cf['defaults']['placeholder_value'] ) { |
|
1392
|
|
- $value = $cf['defaults']['placeholder_value']; |
|
1393
|
|
- } |
|
1545
|
+ // for_admin_use |
|
1546
|
+ if ( has_filter( "uwp_builder_for_admin_use_{$field_type}" ) ) { |
|
1394
|
1547
|
|
|
1395
|
|
- echo aui()->input( |
|
1396
|
|
- array( |
|
1397
|
|
- 'id' => 'placeholder_value_' . esc_attr( $result_str ), |
|
1398
|
|
- 'name' => 'placeholder_value', |
|
1399
|
|
- 'title' => __( 'Enter placeholder text for this field.', 'userswp' ), |
|
1400
|
|
- 'label_type' => 'top', |
|
1401
|
|
- 'label' => esc_html__( 'Placeholder', 'userswp' ) . uwp_help_tip( __( 'Display placeholder text for this field.', 'userswp' ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1402
|
|
- 'type' => 'text', |
|
1403
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1404
|
|
- 'value' => $value, |
|
1405
|
|
- ) |
|
1406
|
|
- ); |
|
1548
|
+ echo apply_filters( "uwp_builder_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1407
|
1549
|
|
|
1408
|
|
- } |
|
1550
|
+ } else { |
|
1551
|
+ $value = ''; |
|
1552
|
+ if ( isset( $field_info->for_admin_use ) ) { |
|
1553
|
+ $value = esc_attr( $field_info->for_admin_use ); |
|
1554
|
+ } elseif ( isset( $cf['defaults']['for_admin_use'] ) && $cf['defaults']['for_admin_use'] ) { |
|
1555
|
+ $value = $cf['defaults']['for_admin_use']; |
|
1556
|
+ } |
|
1557
|
+ ?> |
|
1558
|
+ <li <?php echo esc_attr($field_display); ?> class="uwp-setting-name uwp-advanced-setting"> |
|
1559
|
+ <label for="for_admin_use" class="uwp-tooltip-wrap"> |
|
1560
|
+ <?php |
|
1561
|
+ echo uwp_help_tip( __( 'If yes is selected then only site admin can see and edit this field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1562
|
+ esc_html_e( 'For admin use only? :', 'userswp' ); ?> |
|
1563
|
+ </label> |
|
1564
|
+ <div class="uwp-input-wrap"> |
|
1565
|
+ <input type="hidden" name="for_admin_use" value="0"/> |
|
1566
|
+ <input type="checkbox" name="for_admin_use" |
|
1567
|
+ value="1" <?php checked( $value, 1, true ); ?> /> |
|
1568
|
+ </div> |
|
1569
|
+ </li> |
|
1570
|
+ <?php |
|
1571
|
+ } |
|
1409
|
1572
|
|
|
1410
|
|
- // is_active |
|
1411
|
|
- if ( has_filter( "uwp_builder_is_active_{$field_type}" ) ) { |
|
1573
|
+ // is_public |
|
1574
|
+ if ( has_filter( "uwp_builder_is_public_{$field_type}" ) ) { |
|
1412
|
1575
|
|
|
1413
|
|
- echo apply_filters( "uwp_builder_is_active_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1576
|
+ echo apply_filters( "uwp_builder_is_public_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1414
|
1577
|
|
|
1415
|
|
- } else { |
|
1416
|
|
- $value = ''; |
|
1417
|
|
- if ( isset( $field_info->is_active ) ) { |
|
1418
|
|
- $value = esc_attr( $field_info->is_active ); |
|
1419
|
|
- } elseif ( isset( $cf['defaults']['is_active'] ) && $cf['defaults']['is_active'] ) { |
|
1420
|
|
- $value = $cf['defaults']['is_active']; |
|
1421
|
|
- } |
|
1578
|
+ } else { |
|
1579
|
+ $value = ''; |
|
1580
|
+ if ( isset( $field_info->is_public ) ) { |
|
1581
|
+ $value = esc_attr( $field_info->is_public ); |
|
1582
|
+ } elseif ( isset( $cf['defaults']['is_public'] ) && $cf['defaults']['is_public'] ) { |
|
1583
|
+ $value = $cf['defaults']['is_public']; |
|
1584
|
+ } |
|
1585
|
+ ?> |
|
1586
|
+ <li <?php echo esc_attr($field_display); ?> class="uwp-setting-name uwp-advanced-setting"> |
|
1587
|
+ <label for="is_public" class="uwp-tooltip-wrap"> |
|
1588
|
+ <?php |
|
1589
|
+ echo uwp_help_tip( __( 'If no is selected then the field will not be visible to other users.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1590
|
+ esc_html_e( 'Is Public :', 'userswp' ); ?> |
|
1591
|
+ </label> |
|
1592
|
+ <div class="uwp-input-wrap"> |
|
1593
|
+ <?php |
|
1594
|
+ if ( ! isset($value) ) { |
|
1595
|
+ $value = "1"; |
|
1596
|
+ } |
|
1597
|
+ ?> |
|
1598
|
+ <select name="is_public" class="aui-select2"> |
|
1599
|
+ <option value="1" <?php selected( $value, "1" ); ?>><?php echo esc_html__( "Yes", "userswp" ) ?></option> |
|
1600
|
+ <option value="0" <?php selected( $value, "0" ); ?>><?php echo esc_html__( "No", "userswp" ) ?></option> |
|
1601
|
+ <option value="2" <?php selected( $value, "2" ); ?>><?php echo esc_html__( "Let User Decide", "userswp" ) ?></option> |
|
1602
|
+ </select> |
|
1422
|
1603
|
|
|
1423
|
|
- echo aui()->input( |
|
1424
|
|
- array( |
|
1425
|
|
- 'id' => 'is_active', |
|
1426
|
|
- 'name' => 'is_active', |
|
1427
|
|
- 'type' => 'checkbox', |
|
1428
|
|
- 'label_type' => 'horizontal', |
|
1429
|
|
- 'label_col' => '4', |
|
1430
|
|
- 'label' => __( 'Is active', 'userswp' ), |
|
1431
|
|
- 'checked' => $value, |
|
1432
|
|
- 'value' => '1', |
|
1433
|
|
- 'with_hidden' => '', |
|
1434
|
|
- 'switch' => 'md', |
|
1435
|
|
- 'label_force_left' => true, |
|
1436
|
|
- 'help_text' => uwp_help_tip( __( 'If no is selected then the field will not be displayed anywhere.', 'userswp' ) ), |
|
1437
|
|
- ) |
|
1438
|
|
- ); |
|
1604
|
+ </div> |
|
1605
|
+ </li> |
|
1606
|
+ <?php |
|
1607
|
+ } |
|
1439
|
1608
|
|
|
1440
|
|
- } |
|
1609
|
+ // default_value |
|
1610
|
+ if ( has_filter( "uwp_builder_default_value_{$field_type}" ) ) { |
|
1441
|
1611
|
|
|
1442
|
|
- // for_admin_use |
|
1443
|
|
- if ( has_filter( "uwp_builder_for_admin_use_{$field_type}" ) ) { |
|
1612
|
+ echo apply_filters( "uwp_builder_default_value_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1444
|
1613
|
|
|
1445
|
|
- echo apply_filters( "uwp_builder_for_admin_use_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1614
|
+ } else { |
|
1615
|
+ $value = ''; |
|
1616
|
+ if ( isset( $field_info->default_value ) ) { |
|
1617
|
+ $value = esc_attr( $field_info->default_value ); |
|
1618
|
+ } elseif ( isset( $cf['defaults']['default_value'] ) && $cf['defaults']['default_value'] ) { |
|
1619
|
+ $value = $cf['defaults']['default_value']; |
|
1620
|
+ } |
|
1621
|
+ ?> |
|
1622
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
1623
|
+ <label for="default_value" class="uwp-tooltip-wrap"> |
|
1624
|
+ <?php |
|
1625
|
+ if ( $field_type == 'checkbox' ) { |
|
1626
|
+ $tip = __( 'Should the checkbox be checked by default?', 'userswp' ); |
|
1627
|
+ } else if ( $field_type == 'email' ) { |
|
1628
|
+ $tip = __( 'A default value for the field, usually blank. Ex: info@mysite.com', 'userswp' ); |
|
1629
|
+ } else { |
|
1630
|
+ $tip = __( 'A default value for the field, usually blank. (for links this will be used as the link text)', 'userswp' ); |
|
1631
|
+ } |
|
1632
|
+ ?> |
|
1633
|
+ <?php |
|
1634
|
+ echo uwp_help_tip( $tip ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1635
|
+ esc_html_e( 'Default value :', 'userswp' ); ?> |
|
1636
|
+ </label> |
|
1637
|
+ <div class="uwp-input-wrap"> |
|
1638
|
+ <?php if ( $field_type == 'checkbox' ) { ?> |
|
1639
|
+ <select name="default_value" id="default_value" class="aui-select2"> |
|
1640
|
+ <option value=""><?php esc_html_e( 'Unchecked', 'userswp' ); ?></option> |
|
1641
|
+ <option value="1" <?php selected( true, (int) $value === 1 ); ?>><?php esc_html_e( 'Checked', 'userswp' ); ?></option> |
|
1642
|
+ </select> |
|
1643
|
+ <?php } else if ( $field_type == 'email' ) { ?> |
|
1644
|
+ <input type="email" name="default_value" |
|
1645
|
+ placeholder="<?php esc_attr_e( 'info@mysite.com', 'userswp' ); ?>" |
|
1646
|
+ id="default_value" value="<?php echo esc_attr( $value ); ?>"/><br/> |
|
1647
|
+ <?php } else { ?> |
|
1648
|
+ <input type="text" name="default_value" id="default_value" |
|
1649
|
+ value="<?php echo esc_attr( $value ); ?>"/><br/> |
|
1650
|
+ <?php } ?> |
|
1651
|
+ </div> |
|
1652
|
+ </li> |
|
1653
|
+ <?php |
|
1654
|
+ } |
|
1446
|
1655
|
|
|
1447
|
|
- } else { |
|
1448
|
|
- $value = ''; |
|
1449
|
|
- if ( isset( $field_info->for_admin_use ) ) { |
|
1450
|
|
- $value = esc_attr( $field_info->for_admin_use ); |
|
1451
|
|
- } elseif ( isset( $cf['defaults']['for_admin_use'] ) && $cf['defaults']['for_admin_use'] ) { |
|
1452
|
|
- $value = $cf['defaults']['for_admin_use']; |
|
1453
|
|
- } |
|
1656
|
+ // advanced_editor |
|
1657
|
+ if ( has_filter( "uwp_builder_advanced_editor_{$field_type}" ) ) { |
|
1454
|
1658
|
|
|
1455
|
|
- echo aui()->input( |
|
1456
|
|
- array( |
|
1457
|
|
- 'id' => 'for_admin_use', |
|
1458
|
|
- 'name' => 'for_admin_use', |
|
1459
|
|
- 'type' => 'checkbox', |
|
1460
|
|
- 'label_type' => 'horizontal', |
|
1461
|
|
- 'label_col' => '4', |
|
1462
|
|
- 'label' => __( 'For admin use only?', 'userswp' ), |
|
1463
|
|
- 'checked' => $value, |
|
1464
|
|
- 'value' => '1', |
|
1465
|
|
- 'switch' => 'md', |
|
1466
|
|
- 'label_force_left' => true, |
|
1467
|
|
- 'help_text' => uwp_help_tip( __( 'If yes is selected then only site admin can see and edit this field.', 'userswp' ) ), |
|
1468
|
|
- // 'wrap_class' => uwp_advanced_toggle_class(), |
|
1469
|
|
- ) |
|
1470
|
|
- ); |
|
1659
|
+ echo apply_filters( "uwp_builder_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1471
|
1660
|
|
|
1472
|
|
- } |
|
1661
|
+ } |
|
1662
|
+ ?> |
|
1663
|
+ <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" |
|
1664
|
+ value="<?php if ( isset( $field_info->sort_order ) ) { |
|
1665
|
+ echo esc_attr( $field_info->sort_order ); |
|
1666
|
+ } ?>"/> |
|
1667
|
+ <?php |
|
1473
|
1668
|
|
|
1474
|
|
- // is_public |
|
1475
|
|
- if ( has_filter( "uwp_builder_is_public_{$field_type}" ) ) { |
|
1476
|
|
- echo apply_filters( "uwp_builder_is_public_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1477
|
|
- } else { |
|
1478
|
|
- $value = ''; |
|
1669
|
+ // is_required |
|
1670
|
+ if ( has_filter( "uwp_builder_is_required_{$field_type}" ) ) { |
|
1479
|
1671
|
|
|
1480
|
|
- if ( isset( $field_info->is_public ) ) { |
|
1481
|
|
- $value = (int) $field_info->is_public; |
|
1482
|
|
- } elseif ( isset( $cf['defaults']['is_public'] ) && ( $cf['defaults']['is_public'] || $cf['defaults']['is_public'] === '0' || $cf['defaults']['is_public'] === 0 ) ) { |
|
1483
|
|
- $value = (int) $cf['defaults']['is_public']; |
|
1484
|
|
- } |
|
1672
|
+ echo apply_filters( "uwp_builder_is_required_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1485
|
1673
|
|
|
1486
|
|
- aui()->select( |
|
1487
|
|
- array( |
|
1488
|
|
- 'id' => 'is_public', |
|
1489
|
|
- 'name' => 'is_public', |
|
1490
|
|
- 'label_type' => 'top', |
|
1491
|
|
- 'multiple' => false, |
|
1492
|
|
- 'class' => ' mw-100', |
|
1493
|
|
- 'options' => array( |
|
1494
|
|
- '1' => __( 'Yes', 'userswp' ), |
|
1495
|
|
- '0' => __( 'No', 'userswp' ), |
|
1496
|
|
- '2' => __( 'Let User Decide', 'userswp' ) |
|
1497
|
|
- ), |
|
1498
|
|
- 'label' => __( 'Is Public', 'userswp' ) . uwp_help_tip( __( 'If no is selected then the field will not be visible to other users.', 'userswp' ) ), |
|
1499
|
|
- 'value' => $value, |
|
1500
|
|
- 'wrap_class' => uwp_advanced_toggle_class() |
|
1501
|
|
- ), |
|
1502
|
|
- true |
|
1503
|
|
- ); |
|
1504
|
|
- } |
|
1674
|
+ } else { |
|
1675
|
+ $value = ''; |
|
1676
|
+ if ( isset( $field_info->is_required ) ) { |
|
1677
|
+ $value = esc_attr( $field_info->is_required ); |
|
1678
|
+ } elseif ( isset( $cf['defaults']['is_required'] ) && $cf['defaults']['is_required'] ) { |
|
1679
|
+ $value = $cf['defaults']['is_required']; |
|
1680
|
+ } |
|
1681
|
+ ?> |
|
1682
|
+ <li class="uwp-setting-name"> |
|
1683
|
+ <label for="is_required" class="uwp-tooltip-wrap"> |
|
1684
|
+ <?php |
|
1685
|
+ echo uwp_help_tip( __( 'Select yes to set field as required', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1686
|
+ esc_html_e( 'Is required :', 'userswp' ); ?> |
|
1687
|
+ </label> |
|
1505
|
1688
|
|
|
1506
|
|
- // default_value |
|
1507
|
|
- if ( has_filter( "uwp_builder_default_value_{$field_type}" ) ) { |
|
1689
|
+ <div class="uwp-input-wrap"> |
|
1690
|
+ <input type="hidden" name="is_required" value="0"/> |
|
1691
|
+ <input type="checkbox" name="is_required" |
|
1692
|
+ value="1" <?php checked( $value, 1, true ); ?> /> |
|
1693
|
+ </div> |
|
1508
|
1694
|
|
|
1509
|
|
- echo apply_filters( "uwp_builder_default_value_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1695
|
+ </li> |
|
1510
|
1696
|
|
|
1511
|
|
- } else { |
|
1512
|
|
- $value = ''; |
|
1513
|
|
- if ( isset( $field_info->default_value ) ) { |
|
1514
|
|
- $value = esc_attr( $field_info->default_value ); |
|
1515
|
|
- } elseif ( isset( $cf['defaults']['default_value'] ) && $cf['defaults']['default_value'] ) { |
|
1516
|
|
- $value = $cf['defaults']['default_value']; |
|
1517
|
|
- } |
|
1697
|
+ <?php |
|
1698
|
+ } |
|
1518
|
1699
|
|
|
1519
|
|
- // tip text |
|
1520
|
|
- if ( $field_type == 'checkbox' ) { |
|
1521
|
|
- $tip = __( 'Should the checkbox be checked by default?', 'userswp' ); |
|
1522
|
|
- } elseif ( $field_type == 'email' ) { |
|
1523
|
|
- $tip = __( 'A default value for the field, usually blank. Ex: info@mysite.com', 'userswp' ); |
|
1524
|
|
- } else { |
|
1525
|
|
- $tip = __( 'A default value for the field, usually blank. (for links this will be used as the link text)', 'userswp' ); |
|
1526
|
|
- } |
|
1700
|
+ // required_msg |
|
1701
|
+ if ( has_filter( "uwp_builder_required_msg_{$field_type}" ) ) { |
|
1527
|
1702
|
|
|
1528
|
|
- if ( $field_type == 'checkbox' ) { |
|
1529
|
|
- echo aui()->select( |
|
1530
|
|
- array( |
|
1531
|
|
- 'id' => 'default_value', |
|
1532
|
|
- 'name' => 'default_value', |
|
1533
|
|
- 'label_type' => 'top', |
|
1534
|
|
- 'multiple' => false, |
|
1535
|
|
- 'class' => ' mw-100', |
|
1536
|
|
- 'options' => array( |
|
1537
|
|
- '' => __( 'Unchecked', 'userswp' ), |
|
1538
|
|
- '1' => __( 'Checked', 'userswp' ), |
|
1539
|
|
- ), |
|
1540
|
|
- 'label' => __( 'Default value', 'userswp' ) . uwp_help_tip( $tip ), |
|
1541
|
|
- 'value' => $value, |
|
1542
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1543
|
|
- ) |
|
1544
|
|
- ); |
|
1545
|
|
- } else { |
|
1546
|
|
- echo aui()->input( |
|
1547
|
|
- array( |
|
1548
|
|
- 'id' => 'default_value', |
|
1549
|
|
- 'name' => 'default_value', |
|
1550
|
|
- 'label_type' => 'top', |
|
1551
|
|
- 'label' => __( 'Default value', 'userswp' ) . uwp_help_tip( $tip ), |
|
1552
|
|
- 'type' => 'text', |
|
1553
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1554
|
|
- 'value' => $value, |
|
1555
|
|
- 'placeholder' => $field_type == 'email' ? __( 'info@mysite.com', 'userswp' ) : '', |
|
1556
|
|
- ) |
|
1557
|
|
- ); |
|
1558
|
|
- } |
|
1559
|
|
-} |
|
1703
|
+ echo apply_filters( "uwp_builder_required_msg_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1560
|
1704
|
|
|
1561
|
|
- // advanced_editor |
|
1562
|
|
- if ( has_filter( "uwp_builder_advanced_editor_{$field_type}" ) ) { |
|
1705
|
+ } else { |
|
1706
|
+ $value = ''; |
|
1707
|
+ if ( isset( $field_info->required_msg ) ) { |
|
1708
|
+ $value = esc_attr( $field_info->required_msg ); |
|
1709
|
+ } elseif ( isset( $cf['defaults']['required_msg'] ) && $cf['defaults']['required_msg'] ) { |
|
1710
|
+ $value = $cf['defaults']['required_msg']; |
|
1711
|
+ } |
|
1712
|
+ ?> |
|
1713
|
+ <li class="cf-is-required-msg uwp-setting-name uwp-advanced-setting" <?php if ( ( isset( $field_info->is_required ) && $field_info->is_required == '0' ) || ! isset( $field_info->is_required ) ) { |
|
1714
|
+ echo "style='display:none;'"; |
|
1715
|
+ } ?>> |
|
1716
|
+ <label for="required_msg" class="uwp-tooltip-wrap"> |
|
1717
|
+ <?php |
|
1718
|
+ echo uwp_help_tip( __( 'Enter text for the error message if the field is required and has not fulfilled the requirements.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1719
|
+ esc_html_e( 'Required message:', 'userswp' ); ?> |
|
1720
|
+ </label> |
|
1721
|
+ <div class="uwp-input-wrap"> |
|
1722
|
+ <input type="text" name="required_msg" id="required_msg" |
|
1723
|
+ value="<?php echo esc_attr( $value ); ?>"/> |
|
1724
|
+ </div> |
|
1725
|
+ </li> |
|
1726
|
+ <?php |
|
1727
|
+ } |
|
1563
|
1728
|
|
|
1564
|
|
- echo apply_filters( "uwp_builder_advanced_editor_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1729
|
+ // validation pattern |
|
1730
|
+ if ( has_filter( "uwp_builder_validation_pattern_{$field_type}" ) ) { |
|
1565
|
1731
|
|
|
1566
|
|
- } |
|
1567
|
|
- ?> |
|
1568
|
|
- <input type="hidden" readonly="readonly" name="sort_order" id="sort_order" value="<?php echo isset( $field_info->sort_order ) ? esc_attr( $field_info->sort_order ) : ''; ?>"/> |
|
1569
|
|
- <?php |
|
1732
|
+ echo apply_filters( "uwp_builder_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1570
|
1733
|
|
|
1571
|
|
- // is_required |
|
1572
|
|
- if ( has_filter( "uwp_builder_is_required_{$field_type}" ) ) { |
|
1734
|
+ } |
|
1573
|
1735
|
|
|
1574
|
|
- echo apply_filters( "uwp_builder_is_required_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1736
|
+ // extra_fields |
|
1737
|
+ if ( has_filter( "uwp_builder_extra_fields_{$field_type}" ) ) { |
|
1575
|
1738
|
|
|
1576
|
|
- } else { |
|
1577
|
|
- $value = ''; |
|
1578
|
|
- if ( isset( $field_info->is_required ) ) { |
|
1579
|
|
- $value = esc_attr( $field_info->is_required ); |
|
1580
|
|
- } elseif ( isset( $cf['defaults']['is_required'] ) && $cf['defaults']['is_required'] ) { |
|
1581
|
|
- $value = $cf['defaults']['is_required']; |
|
1582
|
|
- } |
|
1739
|
+ echo apply_filters( "uwp_builder_extra_fields_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1583
|
1740
|
|
|
1584
|
|
- echo aui()->input( |
|
1585
|
|
- array( |
|
1586
|
|
- 'id' => 'is_required', |
|
1587
|
|
- 'name' => 'is_required', |
|
1588
|
|
- 'type' => 'checkbox', |
|
1589
|
|
- 'label_type' => 'horizontal', |
|
1590
|
|
- 'label_col' => '4', |
|
1591
|
|
- 'label' => __( 'Is required', 'userswp' ), |
|
1592
|
|
- 'checked' => $value, |
|
1593
|
|
- 'value' => '1', |
|
1594
|
|
- 'switch' => 'md', |
|
1595
|
|
- 'label_force_left' => true, |
|
1596
|
|
- 'help_text' => uwp_help_tip( __( 'Select yes to set field as required', 'userswp' ) ), |
|
1597
|
|
- // 'wrap_class' => uwp_advanced_toggle_class(), |
|
1598
|
|
- ) |
|
1599
|
|
- ); |
|
1741
|
+ } |
|
1600
|
1742
|
|
|
1601
|
|
- } |
|
1743
|
+ // field_icon |
|
1744
|
+ if ( has_filter( "uwp_builder_field_icon_{$field_type}" ) ) { |
|
1602
|
1745
|
|
|
1603
|
|
- // required_msg |
|
1604
|
|
- if ( has_filter( "uwp_builder_required_msg_{$field_type}" ) ) { |
|
1746
|
+ echo apply_filters( "uwp_builder_field_icon_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1605
|
1747
|
|
|
1606
|
|
- echo apply_filters( "uwp_builder_required_msg_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1748
|
+ } else { |
|
1749
|
+ $value = ''; |
|
1750
|
+ if ( isset( $field_info->field_icon ) ) { |
|
1751
|
+ $value = esc_attr( $field_info->field_icon ); |
|
1752
|
+ } elseif ( isset( $cf['defaults']['field_icon'] ) && $cf['defaults']['field_icon'] ) { |
|
1753
|
+ $value = $cf['defaults']['field_icon']; |
|
1754
|
+ } |
|
1755
|
+ ?> |
|
1756
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
1607
|
1757
|
|
|
1608
|
|
- } else { |
|
1609
|
|
- $value = ''; |
|
1610
|
|
- if ( isset( $field_info->required_msg ) ) { |
|
1611
|
|
- $value = esc_attr( $field_info->required_msg ); |
|
1612
|
|
- } elseif ( isset( $cf['defaults']['required_msg'] ) && $cf['defaults']['required_msg'] ) { |
|
1613
|
|
- $value = $cf['defaults']['required_msg']; |
|
1614
|
|
- } |
|
1758
|
+ <label for="field_icon" class="uwp-tooltip-wrap"> |
|
1759
|
+ <?php |
|
1760
|
+ echo uwp_help_tip( sprintf( __( 'Upload icon using media and enter its url path, or enter %sfont awesome%s class eg:"fas fa-home"', 'userswp' ), '<a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >', '</a>' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1761
|
+ esc_html_e( 'Upload icon :', 'userswp' ); ?> |
|
1762
|
+ </label> |
|
1763
|
+ <div class="uwp-input-wrap"> |
|
1764
|
+ <input type="text" name="field_icon" id="field_icon" |
|
1765
|
+ value="<?php echo esc_attr($value); ?>"/> |
|
1766
|
+ </div> |
|
1615
|
1767
|
|
|
1616
|
|
- echo aui()->input( |
|
1617
|
|
- array( |
|
1618
|
|
- 'id' => 'required_msg', |
|
1619
|
|
- 'name' => 'required_msg', |
|
1620
|
|
- 'label_type' => 'top', |
|
1621
|
|
- 'label' => __( 'Required message', 'userswp' ) . uwp_help_tip( __( 'Enter text for the error message if the field is required and has not fulfilled the requirements.', 'userswp' ) ), |
|
1622
|
|
- 'type' => 'text', |
|
1623
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1624
|
|
- 'value' => $value, |
|
1625
|
|
- 'element_require' => '[%is_required%:checked]', |
|
1626
|
|
- ) |
|
1627
|
|
- ); |
|
1768
|
+ </li> |
|
1769
|
+ <?php |
|
1770
|
+ } |
|
1628
|
1771
|
|
|
1629
|
|
- } |
|
1772
|
+ // css_class |
|
1773
|
+ if ( has_filter( "uwp_builder_css_class_{$field_type}" ) ) { |
|
1630
|
1774
|
|
|
1631
|
|
- // validation pattern |
|
1632
|
|
- if ( has_filter( "uwp_builder_validation_pattern_{$field_type}" ) ) { |
|
1775
|
+ echo apply_filters( "uwp_builder_css_class_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1633
|
1776
|
|
|
1634
|
|
- echo apply_filters( "uwp_builder_validation_pattern_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1777
|
+ } else { |
|
1778
|
+ ?> |
|
1779
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
1635
|
1780
|
|
|
1636
|
|
- } |
|
1781
|
+ <?php |
|
1782
|
+ $value = ''; |
|
1783
|
+ if ( isset( $field_info->css_class ) ) { |
|
1784
|
+ $value = esc_attr( $field_info->css_class ); |
|
1785
|
+ } elseif ( isset( $cf['defaults']['css_class'] ) && $cf['defaults']['css_class'] ) { |
|
1786
|
+ $value = $cf['defaults']['css_class']; |
|
1787
|
+ } |
|
1788
|
+ $tip = __( 'Enter custom css class for field custom style.', 'userswp' ); |
|
1789
|
+ if ( $field_type == 'multiselect' ) { |
|
1790
|
+ $tip .= __( '(Enter class `uwp-comma-list` to show list as comma separated)', 'userswp' ); |
|
1791
|
+ } |
|
1792
|
+ ?> |
|
1637
|
1793
|
|
|
1638
|
|
- // extra_fields |
|
1639
|
|
- if ( has_filter( "uwp_builder_extra_fields_{$field_type}" ) ) { |
|
1794
|
+ <label for="css_class" class="uwp-tooltip-wrap"> |
|
1795
|
+ <?php |
|
1796
|
+ echo uwp_help_tip( $tip ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1797
|
+ esc_html_e( 'CSS class :', 'userswp' ); ?> |
|
1798
|
+ </label> |
|
1799
|
+ <div class="uwp-input-wrap"> |
|
1800
|
+ <input type="text" name="css_class" id="css_class" |
|
1801
|
+ value="<?php echo esc_attr($value); ?>"/> |
|
1802
|
+ </div> |
|
1640
|
1803
|
|
|
1641
|
|
- echo apply_filters( "uwp_builder_extra_fields_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1804
|
+ </li> |
|
1805
|
+ <?php |
|
1806
|
+ } |
|
1642
|
1807
|
|
|
1643
|
|
- } |
|
1808
|
+ // show_in |
|
1809
|
+ if ( has_filter( "uwp_builder_show_in_{$field_type}" ) ) { |
|
1644
|
1810
|
|
|
1645
|
|
- // field_icon |
|
1646
|
|
- if ( has_filter( "uwp_builder_field_icon_{$field_type}" ) ) { |
|
1811
|
+ echo apply_filters( "uwp_builder_show_in_$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1647
|
1812
|
|
|
1648
|
|
- echo apply_filters( "uwp_builder_field_icon_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1813
|
+ } else { |
|
1814
|
+ $value = ''; |
|
1815
|
+ if ( isset( $field_info->show_in ) ) { |
|
1816
|
+ $value = esc_attr( $field_info->show_in ); |
|
1817
|
+ } elseif ( isset( $cf['defaults']['show_in'] ) && $cf['defaults']['show_in'] ) { |
|
1818
|
+ $value = esc_attr( $cf['defaults']['show_in'] ); |
|
1819
|
+ } |
|
1820
|
+ ?> |
|
1821
|
+ <li class="uwp-setting-name"> |
|
1822
|
+ <label for="show_in" class="uwp-tooltip-wrap"> |
|
1823
|
+ <?php |
|
1824
|
+ echo uwp_help_tip( __( 'Select in what locations you want to display this field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1825
|
+ esc_html_e( 'Show in what locations?:', 'userswp' ); ?> |
|
1826
|
+ </label> |
|
1827
|
+ <div class="uwp-input-wrap"> |
|
1649
|
1828
|
|
|
1650
|
|
- } else { |
|
1651
|
|
- $value = ''; |
|
1652
|
|
- if ( isset( $field_info->field_icon ) ) { |
|
1653
|
|
- $value = esc_attr( $field_info->field_icon ); |
|
1654
|
|
- } elseif ( isset( $cf['defaults']['field_icon'] ) && $cf['defaults']['field_icon'] ) { |
|
1655
|
|
- $value = $cf['defaults']['field_icon']; |
|
1656
|
|
- } |
|
1829
|
+ <?php |
|
1657
|
1830
|
|
|
1658
|
|
- echo aui()->input( |
|
1659
|
|
- array( |
|
1660
|
|
- 'id' => 'field_icon', |
|
1661
|
|
- 'name' => 'field_icon', |
|
1662
|
|
- 'label_type' => 'top', |
|
1663
|
|
- 'label' => __( 'Icon', 'userswp' ) . uwp_help_tip( sprintf( __( 'Upload icon using media and enter its url path, or enter %1$sfont awesome%2$s class eg:"fas fa-home"', 'userswp' ), '<a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >', '</a>' ) ), |
|
1664
|
|
- 'type' => 'iconpicker', |
|
1665
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1666
|
|
- 'value' => $value, |
|
1667
|
|
- 'extra_attributes' => defined( 'FAS_PRO' ) && FAS_PRO ? array( |
|
1668
|
|
- 'data-fa-icons' => true, |
|
1669
|
|
- 'data-bs-toggle' => 'tooltip', |
|
1670
|
|
- 'data-bs-trigger' => 'focus', |
|
1671
|
|
- 'title' => __( 'For pro icon variants (light, thin, duotone), paste the class here', 'userswp' ), |
|
1672
|
|
- ) : array(), |
|
1673
|
|
- ) |
|
1674
|
|
- ); |
|
1831
|
+ $show_in_locations = uwp_get_show_in_locations(); |
|
1675
|
1832
|
|
|
1676
|
|
- } |
|
1833
|
+ if ( $field_type == 'fieldset' ) { |
|
1834
|
+ unset( $show_in_locations['[fieldset]'] ); |
|
1835
|
+ } |
|
1677
|
1836
|
|
|
1678
|
|
- // css_class |
|
1679
|
|
- if ( has_filter( "uwp_builder_css_class_{$field_type}" ) ) { |
|
1837
|
+ if ( ! in_array( $field_type, array( |
|
1838
|
+ 'text', |
|
1839
|
+ 'datepicker', |
|
1840
|
+ 'textarea', |
|
1841
|
+ 'time', |
|
1842
|
+ 'phone', |
|
1843
|
+ 'email', |
|
1844
|
+ 'select', |
|
1845
|
+ 'multiselect', |
|
1846
|
+ 'url', |
|
1847
|
+ 'html', |
|
1848
|
+ 'fieldset', |
|
1849
|
+ 'radio', |
|
1850
|
+ 'checkbox', |
|
1851
|
+ 'file' |
|
1852
|
+ ) ) ) { |
|
1853
|
+ unset( $show_in_locations['[own_tab]'] ); |
|
1854
|
+ } |
|
1855
|
+ ?> |
|
1680
|
1856
|
|
|
1681
|
|
- echo apply_filters( "uwp_builder_css_class_{$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1857
|
+ <select multiple="multiple" name="show_in[]" |
|
1858
|
+ style="min-width:300px;" |
|
1859
|
+ class="aui-select2 form-control" |
|
1860
|
+ data-placeholder="<?php esc_attr_e( 'Select locations', 'userswp' ); ?>"> |
|
1861
|
+ <?php |
|
1682
|
1862
|
|
|
1683
|
|
- } else { |
|
1863
|
+ $show_in_values = explode( ',', $value ); |
|
1684
|
1864
|
|
|
1685
|
|
- $value = ''; |
|
1686
|
|
- if ( isset( $field_info->css_class ) ) { |
|
1687
|
|
- $value = esc_attr( $field_info->css_class ); |
|
1688
|
|
- } elseif ( isset( $cf['defaults']['css_class'] ) && $cf['defaults']['css_class'] ) { |
|
1689
|
|
- $value = $cf['defaults']['css_class']; |
|
1690
|
|
- } |
|
1691
|
|
- $tip = __( 'Enter custom css class for field custom style.', 'userswp' ); |
|
1692
|
|
- if ( $field_type == 'multiselect' ) { |
|
1693
|
|
- $tip .= __( '(Enter class `uwp-comma-list` to show list as comma separated)', 'userswp' ); |
|
1694
|
|
- } |
|
1865
|
+ foreach ( $show_in_locations as $key => $val ) { |
|
1866
|
+ $selected = false; |
|
1695
|
1867
|
|
|
1696
|
|
- echo aui()->input( |
|
1697
|
|
- array( |
|
1698
|
|
- 'id' => 'css_class', |
|
1699
|
|
- 'name' => 'css_class', |
|
1700
|
|
- 'label_type' => 'top', |
|
1701
|
|
- 'label' => __( 'CSS class', 'userswp' ) . uwp_help_tip( $tip ), |
|
1702
|
|
- 'type' => 'text', |
|
1703
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1704
|
|
- 'value' => $value, |
|
1705
|
|
- ) |
|
1706
|
|
- ); |
|
1868
|
+ if ( is_array( $show_in_values ) && in_array( $key, $show_in_values ) ) { |
|
1869
|
+ $selected = true; |
|
1870
|
+ } |
|
1707
|
1871
|
|
|
1708
|
|
- } |
|
1872
|
+ ?> |
|
1873
|
+ <option value="<?php echo esc_attr($key); ?>" <?php selected( $selected, true ); ?>><?php echo esc_html( $val ); ?></option> |
|
1874
|
+ <?php |
|
1875
|
+ } |
|
1876
|
+ ?> |
|
1877
|
+ </select> |
|
1878
|
+ </div> |
|
1879
|
+ </li> |
|
1880
|
+ <?php |
|
1881
|
+ } |
|
1709
|
1882
|
|
|
1710
|
|
- // show_in |
|
1711
|
|
- if ( has_filter( "uwp_builder_show_in_{$field_type}" ) ) { |
|
1712
|
|
- echo apply_filters( "uwp_builder_show_in_$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1713
|
|
- echo apply_filters( "uwp_builder_show_in_$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1883
|
+ do_action( 'uwp_admin_extra_custom_fields', $field_info, $cf ); ?> |
|
1714
|
1884
|
|
|
1715
|
|
- echo apply_filters( "uwp_builder_show_in_$field_type}", '', $result_str, $cf, $field_info ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1716
|
|
- |
|
1717
|
|
- } else { |
|
1718
|
|
- $value = ''; |
|
1719
|
|
- if ( isset( $field_info->show_in ) ) { |
|
1720
|
|
- $value = esc_attr( $field_info->show_in ); |
|
1721
|
|
- } elseif ( isset( $cf['defaults']['show_in'] ) && $cf['defaults']['show_in'] ) { |
|
1722
|
|
- $value = esc_attr( $cf['defaults']['show_in'] ); |
|
1723
|
|
- } |
|
1724
|
|
- |
|
1725
|
|
- $show_in_locations = uwp_get_show_in_locations(); |
|
1726
|
|
- |
|
1727
|
|
- if ( $field_type == 'fieldset' ) { |
|
1728
|
|
- unset( $show_in_locations['[fieldset]'] ); |
|
1729
|
|
- } |
|
1730
|
|
- |
|
1731
|
|
- if ( ! in_array( |
|
1732
|
|
- $field_type, |
|
1733
|
|
- array( |
|
1734
|
|
- 'text', |
|
1735
|
|
- 'datepicker', |
|
1736
|
|
- 'textarea', |
|
1737
|
|
- 'time', |
|
1738
|
|
- 'phone', |
|
1739
|
|
- 'email', |
|
1740
|
|
- 'select', |
|
1741
|
|
- 'multiselect', |
|
1742
|
|
- 'url', |
|
1743
|
|
- 'html', |
|
1744
|
|
- 'fieldset', |
|
1745
|
|
- 'radio', |
|
1746
|
|
- 'checkbox', |
|
1747
|
|
- 'file', |
|
1748
|
|
- ) |
|
1749
|
|
- ) ) { |
|
1750
|
|
- unset( $show_in_locations['[own_tab]'] ); |
|
1751
|
|
- } |
|
1752
|
|
- |
|
1753
|
|
- $show_in_values = $value ? explode( ',', $value ) : ''; |
|
1754
|
|
- |
|
1755
|
|
- echo aui()->select( |
|
1756
|
|
- array( |
|
1757
|
|
- 'id' => 'show_in', |
|
1758
|
|
- 'name' => 'show_in[]', |
|
1759
|
|
- 'label_type' => 'top', |
|
1760
|
|
- 'multiple' => true, |
|
1761
|
|
- 'select2' => true, |
|
1762
|
|
- 'class' => ' mw-100', |
|
1763
|
|
- 'options' => $show_in_locations, |
|
1764
|
|
- 'label' => __( 'Show in what locations?', 'userswp' ) . uwp_help_tip( __( 'Select in what locations you want to display this field.', 'userswp' ) ), |
|
1765
|
|
- 'value' => $show_in_values, |
|
1766
|
|
- 'placeholder' => __( 'Select locations', 'userswp' ), |
|
1767
|
|
- ) |
|
1768
|
|
- ); |
|
1769
|
|
- |
|
1770
|
|
- } |
|
1771
|
|
- |
|
1772
|
|
- do_action( 'uwp_admin_extra_custom_fields', $field_info, $cf ); |
|
1773
|
|
- ?> |
|
1774
|
|
- |
|
1775
|
|
- |
|
1776
|
|
- <div class="uwp-input-wrap uwp-tab-actions" data-setting="save_button"> |
|
1777
|
|
- |
|
1778
|
|
- <span class="text-left text-start float-left float-start"> |
|
1779
|
|
- <?php UsersWP_Settings_Page::toggle_advanced_button( 'btn btn-outline-primary text-left text-start uwp-advanced-toggle', false ); ?> |
|
1780
|
|
- </span> |
|
1781
|
|
- |
|
1782
|
|
- <a class=" btn btn-link text-muted" href="javascript:void(0);" onclick="uwp_tabs_close_settings(this); return false;"><?php _e( 'Close', 'userswp' ); ?></a> |
|
1783
|
|
- <a href='javascript:void(0);' type="button" class="btn btn-primary" id="save" |
|
1784
|
|
- onclick="save_field('<?php echo esc_attr( $result_str ); ?>');"><?php echo esc_attr( __( 'Save', 'userswp' ) ); ?></a> |
|
1785
|
|
- </div> |
|
1786
|
|
- </script> |
|
1787
|
|
- </div> |
|
1885
|
+ <li> |
|
1886
|
+ <label for="save" class="uwp-tooltip-wrap"> |
|
1887
|
+ </label> |
|
1888
|
+ <div class="uwp-input-wrap uwp-tab-actions" data-setting="save_button"> |
|
1889
|
+ <input type="button" class="button button-primary" name="save" id="save" |
|
1890
|
+ value="<?php echo esc_attr( __( 'Save', 'userswp' ) ); ?>" |
|
1891
|
+ onclick="save_field('<?php echo esc_attr( $result_str ); ?>')"/> |
|
1892
|
+ <?php |
|
1893
|
+ $can_delete = apply_filters( 'uwp_cfa_can_delete_field', true, $field_info, $form_type ); |
|
1894
|
+ if ( $can_delete ){ ?> |
|
1895
|
+ <a class="item-delete submitdelete deletion" id="delete-16" |
|
1896
|
+ href="javascript:void(0);" |
|
1897
|
+ onclick="delete_field('<?php echo esc_attr( $result_str ); ?>', '<?php echo esc_attr( wp_create_nonce( 'custom_fields_delete_' . $result_str ) ); ?>', '<?php echo esc_attr($htmlvar_name); ?>')"><?php esc_html_e( "Remove", "userswp" ); ?></a> |
|
1898
|
+ <?php } ?> |
|
1899
|
+ <?php UsersWP_Settings_Page::toggle_advanced_button(); ?> |
|
1900
|
+ </div> |
|
1901
|
+ </li> |
|
1902
|
+ </ul> |
|
1903
|
+ </div> |
|
1904
|
+ </form> |
|
1788
|
1905
|
</li> |
|
1789
|
1906
|
<?php |
|
1790
|
1907
|
} |
|
1791
|
1908
|
|
|
@@ -1808,21 +1925,22 @@ |
|
1808
|
1925
|
$value = esc_attr( $field_info->validation_pattern ); |
|
1809
|
1926
|
} elseif ( isset( $cf['defaults']['validation_pattern'] ) && $cf['defaults']['validation_pattern'] ) { |
|
1810
|
1927
|
$value = $cf['defaults']['validation_pattern']; |
|
1811
|
1928
|
} |
|
1929
|
+ ?> |
|
1930
|
+ <li class="cf-is-validation-pattern uwp-setting-name uwp-advanced-setting"> |
|
1931
|
+ <label for="validation_pattern" class="uwp-tooltip-wrap"> |
|
1932
|
+ <?php |
|
1933
|
+ echo uwp_help_tip( __( 'Enter regex expression for HTML5 pattern validation.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1934
|
+ esc_html_e( 'Validation pattern:', 'userswp' ); ?> |
|
1935
|
+ </label> |
|
1936
|
+ <div class="uwp-input-wrap"> |
|
1937
|
+ <input type="text" name="validation_pattern" id="validation_pattern" |
|
1938
|
+ value="<?php echo esc_attr( $value ); ?>"/> |
|
1939
|
+ </div> |
|
1940
|
+ </li> |
|
1812
|
1941
|
|
|
1813
|
|
- echo aui()->input( |
|
1814
|
|
- array( |
|
1815
|
|
- 'id' => 'validation_pattern', |
|
1816
|
|
- 'name' => 'validation_pattern', |
|
1817
|
|
- 'label_type' => 'top', |
|
1818
|
|
- 'label' => __( 'Validation Pattern', 'userswp' ) . uwp_help_tip( __( 'Enter regex expression for HTML5 pattern validation.', 'userswp' ) ), |
|
1819
|
|
- 'type' => 'text', |
|
1820
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1821
|
|
- 'value' => wp_slash( $value ), // Keep slashes |
|
1822
|
|
- ) |
|
1823
|
|
- ); |
|
1824
|
|
- |
|
1942
|
+ <?php |
|
1825
|
1943
|
$value = ''; |
|
1826
|
1944
|
if ( isset( $field_info->validation_msg ) ) { |
|
1827
|
1945
|
$value = esc_attr( $field_info->validation_msg ); |
|
1828
|
1946
|
} elseif ( isset( $cf['defaults']['validation_msg'] ) && $cf['defaults']['validation_msg'] ) { |
|
@@ -1827,21 +1945,22 @@ |
|
1827
|
1945
|
$value = esc_attr( $field_info->validation_msg ); |
|
1828
|
1946
|
} elseif ( isset( $cf['defaults']['validation_msg'] ) && $cf['defaults']['validation_msg'] ) { |
|
1829
|
1947
|
$value = $cf['defaults']['validation_msg']; |
|
1830
|
1948
|
} |
|
1949
|
+ ?> |
|
1950
|
+ <li class="cf-is-validation-msg uwp-setting-name uwp-advanced-setting"> |
|
1951
|
+ <label for="validation_msg" class="uwp-tooltip-wrap"> |
|
1952
|
+ <?php |
|
1953
|
+ echo uwp_help_tip( __( 'Enter a extra validation message to show to the user if validation fails.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1954
|
+ esc_html_e( 'Validation message:', 'userswp' ); ?> |
|
1955
|
+ </label> |
|
1956
|
+ <div class="uwp-input-wrap"> |
|
1957
|
+ <input type="text" name="validation_msg" id="required_msg" |
|
1958
|
+ value="<?php echo esc_attr( $value ); ?>"/> |
|
1959
|
+ </div> |
|
1960
|
+ </li> |
|
1961
|
+ <?php |
|
1831
|
1962
|
|
|
1832
|
|
- echo aui()->input( |
|
1833
|
|
- array( |
|
1834
|
|
- 'id' => 'validation_msg', |
|
1835
|
|
- 'name' => 'validation_msg', |
|
1836
|
|
- 'label_type' => 'top', |
|
1837
|
|
- 'label' => __( 'Validation Message', 'userswp' ) . uwp_help_tip( __( 'Enter a extra validation message to show to the user if validation fails.', 'userswp' ) ), |
|
1838
|
|
- 'type' => 'text', |
|
1839
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
1840
|
|
- 'value' => $value, |
|
1841
|
|
- ) |
|
1842
|
|
- ); |
|
1843
|
|
- |
|
1844
|
1963
|
$output = ob_get_clean(); |
|
1845
|
1964
|
|
|
1846
|
1965
|
return $output; |
|
1847
|
1966
|
} |
|
@@ -1848,30 +1967,27 @@ |
|
1848
|
1967
|
|
|
1849
|
1968
|
public function register_selected_fields( $form_type ) { |
|
1850
|
1969
|
global $wpdb; |
|
1851
|
1970
|
$extras_table_name = uwp_get_table_prefix() . 'uwp_form_extras'; |
|
1852
|
|
- $form_id = self::get_form_id() |
|
1971
|
+ $form_id = ! empty( $_GET['form'] ) ? absint($_GET['form']) : 1; |
|
1853
|
1972
|
?> |
|
1854
|
1973
|
<input type="hidden" name="manage_field_type" class="manage_field_type" value="register"> |
|
1855
|
|
- <input type="hidden" name="uwp_create_field_nonce" class="uwp_create_field_nonce" value="<?php echo wp_create_nonce( 'uwp_create_field_nonce' ); ?>"/> |
|
1856
|
|
- <ul class="core uwp_form_extras uwp-tabs-selected ps-0 list-group "> |
|
1857
|
|
- <?php |
|
1974
|
+ <ul class="core uwp_form_extras uwp-tabs-selected"><?php |
|
1858
|
1975
|
|
|
1859
|
1976
|
$fields = $wpdb->get_results( |
|
1860
|
1977
|
$wpdb->prepare( |
|
1861
|
|
- 'select * from ' . $extras_table_name . ' where form_type = %s AND form_id = %d order by sort_order asc', |
|
1978
|
+ "select * from " . $extras_table_name . " where form_type = %s AND form_id = %d order by sort_order asc", |
|
1862
|
1979
|
array( $form_type, $form_id ) |
|
1863
|
1980
|
) |
|
1864
|
1981
|
); |
|
1865
|
1982
|
|
|
1866
|
1983
|
if ( ! empty( $fields ) ) { |
|
1867
|
|
- foreach ( $fields as $field ) { |
|
1868
|
|
- $result_str = $field; |
|
1869
|
|
- $field_ins_upd = 'display'; |
|
1870
|
|
- $this->register_field_adminhtml( $result_str, $field_ins_upd, false ); |
|
1871
|
|
- } |
|
1872
|
|
- } |
|
1873
|
|
- ?> |
|
1984
|
+ foreach ( $fields as $field ) { |
|
1985
|
+ $result_str = $field; |
|
1986
|
+ $field_ins_upd = 'display'; |
|
1987
|
+ $this->register_field_adminhtml( $result_str, $field_ins_upd, false ); |
|
1988
|
+ } |
|
1989
|
+ } ?> |
|
1874
|
1990
|
</ul> |
|
1875
|
1991
|
<?php |
|
1876
|
1992
|
} |
|
1877
|
1993
|
|
|
@@ -1882,12 +1998,12 @@ |
|
1882
|
1998
|
$extras_table_name = uwp_get_table_prefix() . 'uwp_form_extras'; |
|
1883
|
1999
|
|
|
1884
|
2000
|
$cf = $result_str; |
|
1885
|
2001
|
if ( ! is_object( $cf ) && ( is_int( $cf ) || ctype_digit( $cf ) ) ) { |
|
1886
|
|
- $field_info = $wpdb->get_row( $wpdb->prepare( 'select * from ' . $extras_table_name . ' where id= %d', array( $cf ) ) ); |
|
2002
|
+ $field_info = $wpdb->get_row( $wpdb->prepare( "select * from " . $extras_table_name . " where id= %d", array( $cf ) ) ); |
|
1887
|
2003
|
} elseif ( is_object( $cf ) ) { |
|
1888
|
2004
|
$result_str = $cf->id; |
|
1889
|
|
- $field_info = $wpdb->get_row( $wpdb->prepare( 'select * from ' . $extras_table_name . ' where id= %d', array( (int) $cf->id ) ) ); |
|
2005
|
+ $field_info = $wpdb->get_row( $wpdb->prepare( "select * from " . $extras_table_name . " where id= %d", array( (int) $cf->id ) ) ); |
|
1890
|
2006
|
} else { |
|
1891
|
2007
|
$field_info = false; |
|
1892
|
2008
|
} |
|
1893
|
2009
|
|
|
@@ -1896,8 +2012,9 @@ |
|
1896
|
2012
|
} else { |
|
1897
|
2013
|
$field_type = $field_info->field_type; |
|
1898
|
2014
|
} |
|
1899
|
2015
|
|
|
2016
|
+ |
|
1900
|
2017
|
$field_site_name = ''; |
|
1901
|
2018
|
if ( isset( $request['site_title'] ) ) { |
|
1902
|
2019
|
$field_site_name = $request['site_title']; |
|
1903
|
2020
|
} |
|
@@ -1912,8 +2029,9 @@ |
|
1912
|
2029
|
} |
|
1913
|
2030
|
} |
|
1914
|
2031
|
$field_info = stripslashes_deep( $field_info ); // strip slashes |
|
1915
|
2032
|
} |
|
2033
|
+ $field_site_name = sanitize_title( $field_site_name ); |
|
1916
|
2034
|
|
|
1917
|
2035
|
if ( isset( $request['form_type'] ) ) { |
|
1918
|
2036
|
$form_type = esc_attr( $request['form_type'] ); |
|
1919
|
2037
|
} else { |
|
@@ -1930,9 +2048,9 @@ |
|
1930
|
2048
|
if ( ! is_object( $field_info ) ) { |
|
1931
|
2049
|
$field_info = new stdClass(); |
|
1932
|
2050
|
} |
|
1933
|
2051
|
$field_info->field_icon = $wpdb->get_var( |
|
1934
|
|
- $wpdb->prepare( 'SELECT field_icon FROM ' . $table_name . ' WHERE htmlvar_name = %s', array( $htmlvar_name ) ) |
|
2052
|
+ $wpdb->prepare( "SELECT field_icon FROM " . $table_name . " WHERE htmlvar_name = %s", array( $htmlvar_name ) ) |
|
1935
|
2053
|
); |
|
1936
|
2054
|
} |
|
1937
|
2055
|
|
|
1938
|
2056
|
$icon = isset( $field_info->field_icon ) ? $field_info->field_icon : ''; |
|
@@ -1938,48 +2056,41 @@ |
|
1938
|
2056
|
$icon = isset( $field_info->field_icon ) ? $field_info->field_icon : ''; |
|
1939
|
2057
|
if ( uwp_is_fa_icon( $icon ) ) { |
|
1940
|
2058
|
$field_icon = '<i class="' . esc_attr( $icon ) . '" aria-hidden="true"></i>'; |
|
1941
|
2059
|
} elseif ( uwp_is_icon_url( $icon ) ) { |
|
1942
|
|
- $field_icon = '<b style="background-image: url("' . esc_url( $icon ) . '")"></b>'; |
|
2060
|
+ $field_icon = '<b style="background-image: url("' . esc_url($icon) . '")"></b>'; |
|
1943
|
2061
|
} elseif ( isset( $field_info->field_type ) && $field_info->field_type == 'fieldset' ) { |
|
1944
|
2062
|
$field_icon = '<i class="fas fa-arrows-alt-h" aria-hidden="true"></i>'; |
|
1945
|
2063
|
} else { |
|
1946
|
2064
|
$field_icon = '<i class="fas fa-cog" aria-hidden="true"></i>'; |
|
1947
|
2065
|
} |
|
1948
|
|
- |
|
1949
|
|
- $no_actions = array( 'email' ); |
|
1950
|
|
- $no_actions = apply_filters( 'uwp_register_fields_without_actions', $no_actions ); |
|
1951
|
2066
|
?> |
|
1952
|
2067
|
<li class="text li-settings" id="licontainer_<?php echo esc_attr( $result_str ); ?>"> |
|
2068
|
+ <i class="fas fa-caret-down toggle-arrow" aria-hidden="true" onclick="uwp_show_hide(this);"></i> |
|
1953
|
2069
|
<form> |
|
1954
|
|
- <div class="title title<?php echo esc_attr( $result_str ); ?> uwp-fieldset hover-shadow dd-form d-flex justify-content-between rounded list-group-item border rounded-smx text-start bg-light"> |
|
2070
|
+ <div class="title title<?php echo esc_attr( $result_str ); ?> uwp-fieldset"> |
|
1955
|
2071
|
<?php |
|
1956
|
2072
|
$nonce = wp_create_nonce( 'uwp_form_extras_nonce' . $result_str ); |
|
2073
|
+ echo $field_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
1957
|
2074
|
?> |
|
1958
|
|
- <div class=" flex-fill font-weight-bold fw-bold"> |
|
1959
|
|
- <?php echo $field_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
|
1960
|
|
- <b><?php echo ' ' . esc_html( $field_site_name ); ?></b> |
|
1961
|
|
- <span class="field-type float-end text-end small"><?php echo ' (' . esc_html( ucfirst( $field_type ) ) . ')'; ?></span> |
|
1962
|
|
- </div> |
|
1963
|
|
- <div class="dd-handle ui-sortable-handle"> |
|
1964
|
|
- <?php if ( isset( $htmlvar_name ) && ! in_array( $htmlvar_name, $no_actions ) ) { ?> |
|
1965
|
|
- <i class="far fa-trash-alt text-danger ml-2 ms-2 c-pointer" id="delete-16" |
|
1966
|
|
- onclick="delete_field('<?php echo esc_js( $result_str ); ?>', '<?php echo esc_js( $nonce ); ?>','<?php echo esc_js( $htmlvar_name ); ?>', 'register')" |
|
1967
|
|
- ></i> |
|
1968
|
|
- <?php } ?> |
|
1969
|
|
- <i class="fas fa-grip-vertical text-muted ml-2 ms-2" style="cursor: move" aria-hidden="true"></i> |
|
1970
|
|
- </div> |
|
2075
|
+ <b><?php echo esc_html( uwp_ucwords( ' ' . $field_site_name ) ); ?></b> |
|
2076
|
+ |
|
1971
|
2077
|
</div> |
|
1972
|
2078
|
|
|
1973
|
|
- <div id="field_frm<?php echo esc_attr( $result_str ); ?>" class="field_frm" style="display:none;"> |
|
2079
|
+ <div id="field_frm<?php echo esc_attr( $result_str ); ?>" class="field_frm" |
|
2080
|
+ style="display:<?php if ( $field_ins_upd == 'submit' ) { |
|
2081
|
+ echo 'block;'; |
|
2082
|
+ } else { |
|
2083
|
+ echo 'none;'; |
|
2084
|
+ } ?>"> |
|
1974
|
2085
|
<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( $nonce ); ?>"/> |
|
1975
|
2086
|
<input type="hidden" name="field_id" id="field_id" value="<?php echo esc_attr( $result_str ); ?>"/> |
|
1976
|
|
- <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr( $form_type ); ?>"/> |
|
1977
|
|
- <input type="hidden" name="field_type" id="field_type" value="<?php echo esc_attr( $field_type ); ?>"/> |
|
2087
|
+ <input type="hidden" name="form_type" id="form_type" value="<?php echo esc_attr($form_type); ?>"/> |
|
2088
|
+ <input type="hidden" name="field_type" id="field_type" value="<?php echo esc_attr($field_type); ?>"/> |
|
1978
|
2089
|
<input type="hidden" name="is_active" id="is_active" value="1"/> |
|
1979
|
2090
|
<ul class="widefat post fixed" style="width:100%;"> |
|
1980
|
2091
|
|
|
1981
|
|
- <input type="hidden" name="site_htmlvar_name" value="<?php echo esc_attr( $htmlvar_name ); ?>"/> |
|
2092
|
+ <input type="hidden" name="site_htmlvar_name" value="<?php echo esc_attr($htmlvar_name) ?>"/> |
|
1982
|
2093
|
|
|
1983
|
2094
|
<li> |
|
1984
|
2095
|
<div class="uwp-input-wrap"> |
|
1985
|
2096
|
<p><?php esc_html_e( 'No options available', 'userswp' ); ?></p> |
|
@@ -1987,17 +2098,20 @@ |
|
1987
|
2098
|
</li> |
|
1988
|
2099
|
|
|
1989
|
2100
|
<li> |
|
1990
|
2101
|
<div class="uwp-input-wrap"> |
|
1991
|
|
- <?php if ( isset( $htmlvar_name ) && ! in_array( $htmlvar_name, $no_actions ) ) { ?> |
|
2102
|
+ <?php |
|
2103
|
+ $no_actions = array( 'username', 'email' ); |
|
2104
|
+ $no_actions = apply_filters( 'uwp_register_fields_without_actions', $no_actions ); |
|
2105
|
+ if ( isset($htmlvar_name) && ! in_array( $htmlvar_name, $no_actions ) ) { ?> |
|
1992
|
2106
|
<input type="button" class="button button-primary" name="save" id="save" |
|
1993
|
|
- value="<?php esc_attr_e( 'Save', 'userswp' ); ?>" |
|
1994
|
|
- onclick="save_field('<?php echo esc_js( $result_str ); ?>', 'register')" |
|
1995
|
|
- style="display: none;"/> |
|
2107
|
+ value="<?php esc_attr_e( 'Save', 'userswp' ); ?>" |
|
2108
|
+ onclick="save_field('<?php echo esc_js( $result_str ); ?>', 'register')" |
|
2109
|
+ style="display: none;"/> |
|
1996
|
2110
|
<input type="button" name="delete" |
|
1997
|
|
- value="<?php esc_attr_e( 'Delete', 'userswp' ); ?>" |
|
1998
|
|
- onclick="delete_field('<?php echo esc_js( $result_str ); ?>', '<?php echo esc_js( $nonce ); ?>','<?php echo esc_js( $htmlvar_name ); ?>', 'register')" |
|
1999
|
|
- class="button"/> |
|
2111
|
+ value="<?php esc_attr_e( 'Delete', 'userswp' ); ?>" |
|
2112
|
+ onclick="delete_field('<?php echo esc_js( $result_str ); ?>', '<?php echo esc_js( $nonce ); ?>','<?php echo esc_js( $htmlvar_name ); ?>', 'register')" |
|
2113
|
+ class="button"/> |
|
2000
|
2114
|
<?php } ?> |
|
2001
|
2115
|
|
|
2002
|
2116
|
</div> |
|
2003
|
2117
|
</li> |
|
@@ -2025,10 +2139,10 @@ |
|
2025
|
2139
|
if ( ! $field_type_key ) { |
|
2026
|
2140
|
$field_type_key = isset( $_REQUEST['field_type_key'] ) ? esc_html( $_REQUEST['field_type_key'] ) : ''; |
|
2027
|
2141
|
} |
|
2028
|
2142
|
?> |
|
2029
|
|
- <div class="uwp-setting-name mb-3"> |
|
2030
|
|
- <label for="option_values" class=" form-label"> |
|
2143
|
+ <li class="uwp-setting-name"> |
|
2144
|
+ <label for="option_values" class="uwp-tooltip-wrap"> |
|
2031
|
2145
|
<?php |
|
2032
|
2146
|
$tip = __( 'Option Values should be separated by comma.', 'userswp' ); |
|
2033
|
2147
|
if ( $field_type != 'multiselect' ) { |
|
2034
|
2148
|
$tip .= '<br/><small>' . __( 'If using for a tick filter place a / and then either a 1 for true or 0 for false', 'userswp' ); |
|
@@ -2042,39 +2156,26 @@ |
|
2042
|
2156
|
} |
|
2043
|
2157
|
?> |
|
2044
|
2158
|
<?php |
|
2045
|
2159
|
echo uwp_help_tip( $tip ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2046
|
|
- esc_html_e( 'Option Values :', 'userswp' ); |
|
2047
|
|
- ?> |
|
2160
|
+ esc_html_e( 'Option Values :', 'userswp' ); ?> |
|
2048
|
2161
|
</label> |
|
2049
|
2162
|
<div class="uwp-input-wrap"> |
|
2050
|
2163
|
|
|
2051
|
|
- <?php |
|
2052
|
|
- if ( isset( $field_type_key ) && $field_type_key == 'uwp_country' ) { |
|
2053
|
|
- // @todo here we should show a multiselect to either include or exclude countries |
|
2054
|
|
- echo aui()->alert( |
|
2055
|
|
- array( |
|
2056
|
|
- 'type' => 'info', |
|
2057
|
|
- 'content' => esc_html__( 'A full country list will be shown', 'userswp' ), |
|
2058
|
|
- ) |
|
2059
|
|
- ); |
|
2164
|
+ <?php if ( isset( $field_type_key ) && $field_type_key == 'uwp_country' ) { |
|
2060
|
2165
|
|
|
2166
|
+ // @todo here we should show a multiselect to either include or exclude countries |
|
2167
|
+ esc_html_e( 'A full country list will be shown', 'userswp' ); |
|
2061
|
2168
|
} elseif ( isset( $field_type_key ) && $field_type_key == 'uwp_language' ) { |
|
2062
|
|
- echo aui()->alert( |
|
2063
|
|
- array( |
|
2064
|
|
- 'type' => 'info', |
|
2065
|
|
- 'content' => esc_html__( 'Available translation languages list will be shown', 'userswp' ), |
|
2066
|
|
- ) |
|
2067
|
|
- ); |
|
2068
|
|
- } else { |
|
2069
|
|
- ?> |
|
2070
|
|
- <input type="text" name="option_values" id="option_values" class="form-control" value="<?php echo esc_attr( $value ); ?>"/> |
|
2169
|
+ esc_html_e( 'Available translation languages list will be shown', 'userswp' ); |
|
2170
|
+ } else { ?> |
|
2171
|
+ <input type="text" name="option_values" id="option_values" value="<?php echo esc_attr($value); ?>"/> |
|
2071
|
2172
|
<?php } ?> |
|
2072
|
2173
|
|
|
2073
|
2174
|
<br/> |
|
2074
|
2175
|
|
|
2075
|
2176
|
</div> |
|
2076
|
|
- </div> |
|
2177
|
+ </li> |
|
2077
|
2178
|
<?php |
|
2078
|
2179
|
|
|
2079
|
2180
|
$html = ob_get_clean(); |
|
2080
|
2181
|
|
|
@@ -2087,14 +2188,13 @@ |
|
2087
|
2188
|
if ( isset( $field_info->extra_fields ) && $field_info->extra_fields != '' ) { |
|
2088
|
2189
|
$extra = unserialize( $field_info->extra_fields ); |
|
2089
|
2190
|
} |
|
2090
|
2191
|
?> |
|
2091
|
|
- <div class="uwp-setting-name uwp-advanced-setting mb-3"> |
|
2092
|
|
- <label for="date_format" class=" form-label"> |
|
2192
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
2193
|
+ <label for="date_format" class="uwp-tooltip-wrap"> |
|
2093
|
2194
|
<?php |
|
2094
|
2195
|
echo uwp_help_tip( __( 'Select the date format.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2095
|
|
- esc_html_e( 'Date Format :', 'userswp' ); |
|
2096
|
|
- ?> |
|
2196
|
+ esc_html_e( 'Date Format :', 'userswp' ); ?> |
|
2097
|
2197
|
</label> |
|
2098
|
2198
|
<div class="uwp-input-wrap" style="overflow:inherit;"> |
|
2099
|
2199
|
<?php |
|
2100
|
2200
|
$date_formats = array( |
|
@@ -2108,9 +2208,9 @@ |
|
2108
|
2208
|
); |
|
2109
|
2209
|
|
|
2110
|
2210
|
$date_formats = apply_filters( 'uwp_date_formats', $date_formats ); |
|
2111
|
2211
|
?> |
|
2112
|
|
- <select name="extra[date_format]" id="date_format" class="aui-selectx2 form-select mw-100" > |
|
2212
|
+ <select name="extra[date_format]" id="date_format" class="aui-select2"> |
|
2113
|
2213
|
<?php |
|
2114
|
2214
|
foreach ( $date_formats as $format ) { |
|
2115
|
2215
|
$selected = false; |
|
2116
|
2216
|
if ( ! empty( $extra ) && esc_attr( $extra['date_format'] ) == $format ) { |
|
@@ -2115,15 +2215,15 @@ |
|
2115
|
2215
|
$selected = false; |
|
2116
|
2216
|
if ( ! empty( $extra ) && esc_attr( $extra['date_format'] ) == $format ) { |
|
2117
|
2217
|
$selected = true; |
|
2118
|
2218
|
} |
|
2119
|
|
- echo '<option ' . selected( $selected, true, false ) . " value='" . esc_attr( $format ) . "'>" . esc_html( $format . ' (' . date_i18n( $format, time() ) . ')' ) . '</option>'; |
|
2219
|
+ echo "<option " . selected( $selected, true, false ) . " value='" . esc_attr( $format ) . "'>" . esc_html( $format . " (" . date_i18n( $format, time() ) . ")" ) . "</option>"; |
|
2120
|
2220
|
} |
|
2121
|
2221
|
?> |
|
2122
|
2222
|
</select> |
|
2123
|
2223
|
|
|
2124
|
2224
|
</div> |
|
2125
|
|
- </div> |
|
2225
|
+ </li> |
|
2126
|
2226
|
<?php |
|
2127
|
2227
|
|
|
2128
|
2228
|
$html = ob_get_clean(); |
|
2129
|
2229
|
|
|
@@ -2139,27 +2239,23 @@ |
|
2139
|
2239
|
$extra = unserialize( $field_info->extra_fields ); |
|
2140
|
2240
|
} |
|
2141
|
2241
|
$value = isset( $extra['confirm_password'] ) ? $extra['confirm_password'] : '1'; |
|
2142
|
2242
|
if ( isset( $field_info->htmlvar_name ) && $field_info->htmlvar_name == 'password' ) { |
|
2243
|
+ ?> |
|
2244
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
2245
|
+ <label for="extra[confirm_password]" class="uwp-tooltip-wrap"> |
|
2246
|
+ <?php |
|
2247
|
+ echo uwp_help_tip( __( 'Lets you display confirm password form field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2248
|
+ esc_html_e( 'Display confirm password field?:', 'userswp' ); ?> |
|
2249
|
+ </label> |
|
2143
|
2250
|
|
|
2144
|
|
- echo '<div class="' . uwp_advanced_toggle_class() . '">'; |
|
2145
|
|
- echo aui()->input( |
|
2146
|
|
- array( |
|
2147
|
|
- 'id' => 'extra_confirm_password', |
|
2148
|
|
- 'name' => 'extra[confirm_password]', |
|
2149
|
|
- 'type' => 'checkbox', |
|
2150
|
|
- 'label_type' => 'horizontal', |
|
2151
|
|
- 'label_col' => '4', |
|
2152
|
|
- 'label' => __( 'Display confirm password field', 'userswp' ), |
|
2153
|
|
- 'checked' => $value, |
|
2154
|
|
- 'value' => '1', |
|
2155
|
|
- 'switch' => 'md', |
|
2156
|
|
- 'label_force_left' => true, |
|
2157
|
|
- 'help_text' => uwp_help_tip( __( 'Lets you display confirm password form field.', 'userswp' ) ), |
|
2158
|
|
- ) |
|
2159
|
|
- ); |
|
2160
|
|
- echo '</div>'; |
|
2161
|
|
- |
|
2251
|
+ <div class="uwp-input-wrap"> |
|
2252
|
+ <input type="hidden" name="extra[confirm_password]" value="0"/> |
|
2253
|
+ <input type="checkbox" name="extra[confirm_password]" value="1" <?php checked( $value, 1, true ); ?> |
|
2254
|
+ onclick=""/> |
|
2255
|
+ </div> |
|
2256
|
+ </li> |
|
2257
|
+ <?php |
|
2162
|
2258
|
} |
|
2163
|
2259
|
$html = ob_get_clean(); |
|
2164
|
2260
|
|
|
2165
|
2261
|
return $output . $html; |
|
@@ -2174,27 +2270,23 @@ |
|
2174
|
2270
|
} |
|
2175
|
2271
|
$value = isset( $extra['confirm_email'] ) ? $extra['confirm_email'] : '0'; |
|
2176
|
2272
|
|
|
2177
|
2273
|
if ( isset( $field_info->htmlvar_name ) && $field_info->htmlvar_name == 'email' ) { |
|
2274
|
+ ?> |
|
2275
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
2276
|
+ <label for="extra[confirm_email]" class="uwp-tooltip-wrap"> |
|
2277
|
+ <?php |
|
2278
|
+ echo uwp_help_tip( __( 'Lets you display confirm email form field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2279
|
+ esc_html_e( 'Display confirm email field?:', 'userswp' ); ?> |
|
2280
|
+ </label> |
|
2178
|
2281
|
|
|
2179
|
|
- echo '<div class="' . uwp_advanced_toggle_class() . '">'; |
|
2180
|
|
- echo aui()->input( |
|
2181
|
|
- array( |
|
2182
|
|
- 'id' => 'extra_confirm_email', |
|
2183
|
|
- 'name' => 'extra[confirm_email]', |
|
2184
|
|
- 'type' => 'checkbox', |
|
2185
|
|
- 'label_type' => 'horizontal', |
|
2186
|
|
- 'label_col' => '4', |
|
2187
|
|
- 'label' => __( 'Display confirm email field', 'userswp' ), |
|
2188
|
|
- 'checked' => $value, |
|
2189
|
|
- 'value' => '1', |
|
2190
|
|
- 'switch' => 'md', |
|
2191
|
|
- 'label_force_left' => true, |
|
2192
|
|
- 'help_text' => uwp_help_tip( __( 'Lets you display confirm email form field.', 'userswp' ) ), |
|
2193
|
|
- ) |
|
2194
|
|
- ); |
|
2195
|
|
- echo '</div>'; |
|
2196
|
|
- |
|
2282
|
+ <div class="uwp-input-wrap"> |
|
2283
|
+ <input type="hidden" name="extra[confirm_email]" value="0"/> |
|
2284
|
+ <input type="checkbox" name="extra[confirm_email]" value="1" <?php checked( $value, 1, true ); ?> |
|
2285
|
+ onclick=""/> |
|
2286
|
+ </div> |
|
2287
|
+ </li> |
|
2288
|
+ <?php |
|
2197
|
2289
|
} |
|
2198
|
2290
|
$html = ob_get_clean(); |
|
2199
|
2291
|
|
|
2200
|
2292
|
return $output . $html; |
|
@@ -2208,17 +2300,17 @@ |
|
2208
|
2300
|
|
|
2209
|
2301
|
$extra_fields = isset( $field_info->extra_fields ) && $field_info->extra_fields != '' ? maybe_unserialize( $field_info->extra_fields ) : ''; |
|
2210
|
2302
|
$uwp_file_types = ! empty( $extra_fields ) && ! empty( $extra_fields['uwp_file_types'] ) ? $extra_fields['uwp_file_types'] : array( '*' ); |
|
2211
|
2303
|
?> |
|
2212
|
|
- <div class="uwp-setting-name uwp-advanced-setting mb-3"> |
|
2213
|
|
- <label for="uwp_file_types" class="form-label"> |
|
2304
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
2305
|
+ <label for="uwp_file_types" class="uwp-tooltip-wrap"> |
|
2214
|
2306
|
<?php |
|
2215
|
2307
|
echo uwp_help_tip( __( 'Select file types to allowed for file uploading. (Select multiple file types by holding down "Ctrl" key.)', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2216
|
|
- esc_html_e( 'Allowed file types :', 'userswp' ); |
|
2217
|
|
- ?> |
|
2308
|
+ esc_html_e( 'Allowed file types :', 'userswp' ); ?> |
|
2218
|
2309
|
</label> |
|
2219
|
2310
|
<div class="uwp-input-wrap"> |
|
2220
|
|
- <select name="extra[uwp_file_types][]" id="uwp_file_types" multiple="multiple" class="aui-select2 form-select mw-100" > |
|
2311
|
+ <select name="extra[uwp_file_types][]" id="uwp_file_types" multiple="multiple" class="aui-select2" |
|
2312
|
+ style="height:100px;width:90%;"> |
|
2221
|
2313
|
<option value="*" <?php selected( true, in_array( '*', $uwp_file_types ) ); ?>><?php esc_html_e( 'All types', 'userswp' ); ?></option> |
|
2222
|
2314
|
<?php foreach ( $allowed_file_types as $format => $types ) { ?> |
|
2223
|
2315
|
<optgroup |
|
2224
|
2316
|
label="<?php echo esc_attr( wp_sprintf( __( '%s formats', 'userswp' ), __( $format, 'userswp' ) ) ); ?>"> |
|
@@ -2228,9 +2320,9 @@ |
|
2228
|
2320
|
</optgroup> |
|
2229
|
2321
|
<?php } ?> |
|
2230
|
2322
|
</select> |
|
2231
|
2323
|
</div> |
|
2232
|
|
- </div> |
|
2324
|
+ </li> |
|
2233
|
2325
|
<?php |
|
2234
|
2326
|
|
|
2235
|
2327
|
$html = ob_get_clean(); |
|
2236
|
2328
|
|
|
@@ -2245,35 +2337,37 @@ |
|
2245
|
2337
|
$dt_value = esc_attr( $field_info->data_type ); |
|
2246
|
2338
|
} elseif ( isset( $cf['defaults']['data_type'] ) && $cf['defaults']['data_type'] ) { |
|
2247
|
2339
|
$dt_value = $cf['defaults']['data_type']; |
|
2248
|
2340
|
} |
|
2341
|
+ ?> |
|
2342
|
+ <li class="uwp-setting-name uwp-advanced-setting"> |
|
2343
|
+ <label for="data_type" class="uwp-tooltip-wrap"> |
|
2344
|
+ <?php |
|
2345
|
+ echo uwp_help_tip( __( 'Select Custom Field type', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2346
|
+ esc_html_e( 'Field Data Type:', 'userswp' ); ?> |
|
2347
|
+ </label> |
|
2348
|
+ <div class="uwp-input-wrap"> |
|
2249
|
2349
|
|
|
2250
|
|
- // fix some values |
|
2251
|
|
- if ( $dt_value == 'VARCHAR' ) { |
|
2252
|
|
- $dt_value = 'XVARCHAR'; |
|
2253
|
|
- } |
|
2350
|
+ <select name="data_type" id="data_type" class="aui-select2" |
|
2351
|
+ onchange="uwp_data_type_changed(this, '<?php echo esc_js( $result_str ); ?>');"> |
|
2352
|
+ <option |
|
2353
|
+ value="XVARCHAR" <?php if ( $dt_value == 'VARCHAR' ) { |
|
2354
|
+ echo 'selected="selected"'; |
|
2355
|
+ } ?>><?php esc_html_e( 'Text Field', 'userswp' ); ?></option> |
|
2356
|
+ <option |
|
2357
|
+ value="INT" <?php if ( $dt_value == 'INT' ) { |
|
2358
|
+ echo 'selected="selected"'; |
|
2359
|
+ } ?>><?php esc_html_e( 'Number Field', 'userswp' ); ?></option> |
|
2360
|
+ <option |
|
2361
|
+ value="FLOAT" <?php if ( $dt_value == 'FLOAT' ) { |
|
2362
|
+ echo 'selected="selected"'; |
|
2363
|
+ } ?>><?php esc_html_e( 'Decimal Field', 'userswp' ); ?></option> |
|
2364
|
+ </select> |
|
2254
|
2365
|
|
|
2255
|
|
- echo aui()->select( |
|
2256
|
|
- array( |
|
2257
|
|
- 'id' => 'data_type', |
|
2258
|
|
- 'name' => 'data_type', |
|
2259
|
|
- 'label_type' => 'top', |
|
2260
|
|
- 'multiple' => false, |
|
2261
|
|
- 'wrap_class' => uwp_advanced_toggle_class(), |
|
2262
|
|
- 'class' => 'mw-100', |
|
2263
|
|
- 'options' => array( |
|
2264
|
|
- 'XVARCHAR' => __( 'CHARACTER', 'userswp' ), |
|
2265
|
|
- 'INT' => __( 'NUMBER', 'userswp' ), |
|
2266
|
|
- 'FLOAT' => __( 'DECIMAL', 'userswp' ), |
|
2267
|
|
- ), |
|
2268
|
|
- 'label' => __( 'Data Type', 'userswp' ) . uwp_help_tip( __( 'Select Custom Field type', 'userswp' ) ), |
|
2269
|
|
- 'value' => $dt_value, |
|
2270
|
|
- 'extra_attributes' => array( |
|
2271
|
|
- 'onchange' => "javascript:uwp_data_type_changed(this, '$result_str');", |
|
2272
|
|
- ), |
|
2273
|
|
- ) |
|
2274
|
|
- ); |
|
2366
|
+ </div> |
|
2367
|
+ </li> |
|
2275
|
2368
|
|
|
2369
|
+ <?php |
|
2276
|
2370
|
$value = ''; |
|
2277
|
2371
|
if ( isset( $field_info->decimal_point ) ) { |
|
2278
|
2372
|
$value = esc_attr( $field_info->decimal_point ); |
|
2279
|
2373
|
} elseif ( isset( $cf['defaults']['decimal_point'] ) && $cf['defaults']['decimal_point'] ) { |
|
@@ -2278,34 +2372,27 @@ |
|
2278
|
2372
|
$value = esc_attr( $field_info->decimal_point ); |
|
2279
|
2373
|
} elseif ( isset( $cf['defaults']['decimal_point'] ) && $cf['defaults']['decimal_point'] ) { |
|
2280
|
2374
|
$value = $cf['defaults']['decimal_point']; |
|
2281
|
2375
|
} |
|
2376
|
+ ?> |
|
2282
|
2377
|
|
|
2283
|
|
- echo aui()->select( |
|
2284
|
|
- array( |
|
2285
|
|
- 'id' => 'decimal_point', |
|
2286
|
|
- 'name' => 'decimal_point', |
|
2287
|
|
- 'label_type' => 'top', |
|
2288
|
|
- 'multiple' => false, |
|
2289
|
|
- 'class' => ' mw-100', |
|
2290
|
|
- 'options' => array( |
|
2291
|
|
- '' => __( 'Select', 'userswp' ), |
|
2292
|
|
- '1' => '1', |
|
2293
|
|
- '2' => '2', |
|
2294
|
|
- '3' => '3', |
|
2295
|
|
- '4' => '4', |
|
2296
|
|
- '5' => '5', |
|
2297
|
|
- '6' => '6', |
|
2298
|
|
- '7' => '7', |
|
2299
|
|
- '8' => '8', |
|
2300
|
|
- '9' => '9', |
|
2301
|
|
- '10' => '10', |
|
2302
|
|
- ), |
|
2303
|
|
- 'label' => __( 'Decimal points', 'userswp' ) . uwp_help_tip( __( 'Decimals to display after point.', 'userswp' ) ), |
|
2304
|
|
- 'value' => $value, |
|
2305
|
|
- 'element_require' => '[%data_type%] == "FLOAT"', |
|
2306
|
|
- ) |
|
2307
|
|
- ); |
|
2378
|
+ <li class="decimal-point-wrapper uwp-setting-name uwp-advanced-setting" |
|
2379
|
+ style="<?php echo ( $dt_value == 'FLOAT' ) ? '' : 'display:none' ?>"> |
|
2380
|
+ <label for="decimal_point" class="uwp-tooltip-wrap"> |
|
2381
|
+ <?php |
|
2382
|
+ echo uwp_help_tip( __( 'Decimal places to display after point', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2383
|
+ esc_html_e( 'Select decimal precision:', 'userswp' ); ?> |
|
2384
|
+ </label> |
|
2385
|
+ <div class="uwp-input-wrap"> |
|
2386
|
+ <select name="decimal_point" id="decimal_point" class="aui-select2"> |
|
2387
|
+ <option value=""><?php esc_html_e( 'Select', 'userswp' ); ?></option> |
|
2388
|
+ <?php for ( $i = 1; $i <= 10; $i ++ ) { ?> |
|
2389
|
+ <option value="<?php echo (int) $i; ?>" <?php selected( $i, (int) $value ); ?>><?php echo (int) $i; ?></option> |
|
2390
|
+ <?php } ?> |
|
2391
|
+ </select> |
|
2392
|
+ </div> |
|
2393
|
+ </li> |
|
2394
|
+ <?php |
|
2308
|
2395
|
|
|
2309
|
2396
|
$output = ob_get_clean(); |
|
2310
|
2397
|
|
|
2311
|
2398
|
return $output; |
|
@@ -2318,15 +2405,15 @@ |
|
2318
|
2405
|
|
|
2319
|
2406
|
$value = 0; |
|
2320
|
2407
|
if ( isset( $field_info->is_register_field ) ) { |
|
2321
|
2408
|
$value = (int) $field_info->is_register_field; |
|
2322
|
|
- } elseif ( isset( $cf['defaults']['is_register_field'] ) && $cf['defaults']['is_register_field'] ) { |
|
2409
|
+ } else if ( isset( $cf['defaults']['is_register_field'] ) && $cf['defaults']['is_register_field'] ) { |
|
2323
|
2410
|
$value = ( $cf['defaults']['is_register_field'] ) ? 1 : 0; |
|
2324
|
2411
|
} |
|
2325
|
2412
|
|
|
2326
|
2413
|
if ( isset( $field_info->htmlvar_name ) ) { |
|
2327
|
2414
|
$htmlvar_name = $field_info->htmlvar_name; |
|
2328
|
|
- } elseif ( isset( $cf['defaults']['htmlvar_name'] ) && $cf['defaults']['htmlvar_name'] ) { |
|
2415
|
+ } else if ( isset( $cf['defaults']['htmlvar_name'] ) && $cf['defaults']['htmlvar_name'] ) { |
|
2329
|
2416
|
$htmlvar_name = ( $cf['defaults']['htmlvar_name'] ) ? $cf['defaults']['htmlvar_name'] : ''; |
|
2330
|
2417
|
} |
|
2331
|
2418
|
|
|
2332
|
2419
|
//register only field |
|
@@ -2334,9 +2421,9 @@ |
|
2334
|
2421
|
$hide_register_only_field = ( isset( $field_info->for_admin_use ) && $field_info->for_admin_use == '1' ) ? "style='display:none;'" : $hide_register_only_field; |
|
2335
|
2422
|
$register_only_value = 0; |
|
2336
|
2423
|
if ( isset( $field_info->is_register_only_field ) ) { |
|
2337
|
2424
|
$register_only_value = (int) $field_info->is_register_only_field; |
|
2338
|
|
- } elseif ( isset( $cf['defaults']['is_register_only_field'] ) && $cf['defaults']['is_register_only_field'] ) { |
|
2425
|
+ } else if ( isset( $cf['defaults']['is_register_only_field'] ) && $cf['defaults']['is_register_only_field'] ) { |
|
2339
|
2426
|
$register_only_value = ( $cf['defaults']['is_register_only_field'] ) ? 1 : 0; |
|
2340
|
2427
|
} |
|
2341
|
2428
|
|
|
2342
|
2429
|
$user_sort_value = 0; |
|
@@ -2341,114 +2428,78 @@ |
|
2341
|
2428
|
|
|
2342
|
2429
|
$user_sort_value = 0; |
|
2343
|
2430
|
if ( isset( $field_info->user_sort ) ) { |
|
2344
|
2431
|
$user_sort_value = (int) $field_info->user_sort; |
|
2345
|
|
- } elseif ( isset( $cf['defaults']['user_sort'] ) && $cf['defaults']['user_sort'] ) { |
|
2432
|
+ } else if ( isset( $cf['defaults']['user_sort'] ) && $cf['defaults']['user_sort'] ) { |
|
2346
|
2433
|
$user_sort_value = ( $cf['defaults']['user_sort'] ) ? 1 : 0; |
|
2347
|
2434
|
} |
|
2348
|
2435
|
|
|
2349
|
2436
|
?> |
|
2350
|
|
- <div <?php echo $hide_register_field; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> class="cf-incin-reg-form uwp-setting-name mb-3"> |
|
2437
|
+ <li <?php echo $hide_register_field; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> class="cf-incin-reg-form uwp-setting-name"> |
|
2438
|
+ <label for="is_register_field" class="uwp-tooltip-wrap"> |
|
2439
|
+ <?php |
|
2440
|
+ echo uwp_help_tip( __( 'Lets you use this field as register form field, set from register tab above.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2441
|
+ esc_html_e( 'Include this field in register form:', 'userswp' ); ?> |
|
2442
|
+ </label> |
|
2351
|
2443
|
|
|
2352
|
2444
|
<?php |
|
2353
|
2445
|
$reg_only_fields = uwp_get_register_only_fields(); |
|
2354
|
2446
|
if ( isset( $htmlvar_name ) && in_array( $htmlvar_name, $reg_only_fields ) ) { |
|
2355
|
2447
|
?> |
|
2356
|
|
- <label for="is_register_field" class=" form-label"> |
|
2357
|
|
- <?php |
|
2358
|
|
- echo uwp_help_tip( __( 'Lets you use this field as register form field, set from register tab above.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2359
|
|
- esc_html_e( 'Include this field in register form:', 'userswp' ); |
|
2360
|
|
- ?> |
|
2361
|
|
- </label> |
|
2362
|
|
- <input type="hidden" name="is_register_field" value="1"/> |
|
2363
|
|
- <p><?php esc_html_e( 'This is mandatory register form field.', 'userswp' ); ?></p> |
|
2448
|
+ <div> |
|
2449
|
+ <input type="hidden" name="is_register_field" value="1"/> |
|
2450
|
+ <p><?php esc_html_e( 'This is mandatory register form field.', 'userswp' ); ?></p> |
|
2451
|
+ </div> |
|
2364
|
2452
|
<?php |
|
2365
|
2453
|
} else { |
|
2366
|
|
- echo aui()->input( |
|
2367
|
|
- array( |
|
2368
|
|
- 'id' => 'is_register_field', |
|
2369
|
|
- 'name' => 'is_register_field', |
|
2370
|
|
- 'type' => 'checkbox', |
|
2371
|
|
- 'label_type' => 'horizontal', |
|
2372
|
|
- 'label_col' => '4', |
|
2373
|
|
- 'label' => __( 'Include this field in register form', 'userswp' ), |
|
2374
|
|
- 'checked' => $value, |
|
2375
|
|
- 'value' => '1', |
|
2376
|
|
- 'switch' => 'md', |
|
2377
|
|
- 'label_force_left' => true, |
|
2378
|
|
- 'help_text' => uwp_help_tip( __( 'Lets you use this field as register form field, set from register tab above.', 'userswp' ) ), |
|
2379
|
|
- ) |
|
2380
|
|
- ); |
|
2381
|
|
- } |
|
2382
|
|
- ?> |
|
2383
|
|
- </div> |
|
2454
|
+ ?> |
|
2455
|
+ <div class="uwp-input-wrap"> |
|
2456
|
+ <input type="hidden" name="is_register_field" value="0"/> |
|
2457
|
+ <input type="checkbox" name="is_register_field" value="1" <?php checked( $value, 1, true ); ?> /> |
|
2458
|
+ </div> |
|
2459
|
+ <?php } ?> |
|
2460
|
+ </li> |
|
2384
|
2461
|
|
|
2385
|
|
- <div <?php echo $hide_register_only_field; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> class="cf-inconlyin-reg-form uwp-setting-name uwp-advanced-setting"> |
|
2462
|
+ <li <?php echo $hide_register_only_field; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>class="cf-inconlyin-reg-form uwp-setting-name uwp-advanced-setting"> |
|
2463
|
+ <label for="is_register_only_field" class="uwp-tooltip-wrap"> |
|
2464
|
+ <?php |
|
2465
|
+ echo uwp_help_tip( __( 'Lets you use this field as register ONLY form field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2466
|
+ esc_html_e( 'Include this field ONLY in register form:', 'userswp' ); ?> |
|
2467
|
+ </label> |
|
2386
|
2468
|
|
|
2387
|
|
- |
|
2388
|
2469
|
<?php |
|
2389
|
2470
|
if ( isset( $htmlvar_name ) && in_array( $htmlvar_name, $reg_only_fields ) ) { |
|
2390
|
2471
|
?> |
|
2391
|
|
- <label for="is_register_only_field" class="form-label"> |
|
2392
|
|
- <?php |
|
2393
|
|
- echo uwp_help_tip( __( 'Lets you use this field as register ONLY form field.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2394
|
|
- esc_html_e( 'Include this field ONLY in register form:', 'userswp' ); |
|
2395
|
|
- ?> |
|
2396
|
|
- </label> |
|
2397
|
|
- <input type="hidden" name="is_register_only_field" class="form-control" value="1"/> |
|
2398
|
|
- <p><?php esc_html_e( 'This field is applicable only for register form.', 'userswp' ); ?></p> |
|
2472
|
+ <div> |
|
2473
|
+ <input type="hidden" name="is_register_only_field" value="1"/> |
|
2474
|
+ <p><?php esc_html_e( 'This field is applicable only for register form.', 'userswp' ); ?></p> |
|
2475
|
+ </div> |
|
2399
|
2476
|
<?php |
|
2400
|
2477
|
} else { |
|
2401
|
|
- echo aui()->input( |
|
2402
|
|
- array( |
|
2403
|
|
- 'id' => 'is_register_only_field', |
|
2404
|
|
- 'name' => 'is_register_only_field', |
|
2405
|
|
- 'type' => 'checkbox', |
|
2406
|
|
- 'label_type' => 'horizontal', |
|
2407
|
|
- 'label_col' => '4', |
|
2408
|
|
- 'label' => __( 'Include this field ONLY in register form', 'userswp' ), |
|
2409
|
|
- 'checked' => $register_only_value, |
|
2410
|
|
- 'value' => '1', |
|
2411
|
|
- 'switch' => 'md', |
|
2412
|
|
- 'label_force_left' => true, |
|
2413
|
|
- 'help_text' => uwp_help_tip( __( 'Lets you use this field as register ONLY form field.', 'userswp' ) ), |
|
2478
|
+ ?> |
|
2479
|
+ <div class="uwp-input-wrap"> |
|
2480
|
+ <input type="hidden" name="is_register_only_field" value="0"/> |
|
2481
|
+ <input type="checkbox" name="is_register_only_field" |
|
2482
|
+ value="1" <?php checked( $register_only_value, 1, true ); ?> /> |
|
2483
|
+ </div> |
|
2484
|
+ <?php } ?> |
|
2485
|
+ </li> |
|
2414
|
2486
|
|
|
2415
|
|
- ) |
|
2416
|
|
- ); |
|
2417
|
|
- |
|
2418
|
|
- } |
|
2419
|
|
- ?> |
|
2420
|
|
- </div> |
|
2421
|
|
- |
|
2422
|
|
- <div <?php echo $hide_user_sort; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> class="cf-incin-reg-form uwp-setting-name uwp-advanced-setting"> |
|
2487
|
+ <li <?php echo $hide_user_sort; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> class="cf-incin-reg-form uwp-setting-name uwp-advanced-setting"> |
|
2488
|
+ <label for="user_sort" class="uwp-tooltip-wrap"> |
|
2423
|
2489
|
<?php |
|
2490
|
+ echo uwp_help_tip( __( 'Lets you use this field as sorting in the users listing page, set from user sorting tab above.', 'userswp' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2491
|
+ esc_html_e( 'Include this field in sorting options:', 'userswp' ); ?> |
|
2492
|
+ </label> |
|
2493
|
+ <input type="hidden" name="user_sort" value="0"/> |
|
2494
|
+ <input type="checkbox" name="user_sort" value="1" <?php checked( $user_sort_value, 1, true ); ?> /> |
|
2495
|
+ </li> |
|
2424
|
2496
|
|
|
2425
|
|
- echo aui()->input( |
|
2426
|
|
- array( |
|
2427
|
|
- 'id' => 'user_sort', |
|
2428
|
|
- 'name' => 'user_sort', |
|
2429
|
|
- 'type' => 'checkbox', |
|
2430
|
|
- 'label_type' => 'horizontal', |
|
2431
|
|
- 'label_col' => '4', |
|
2432
|
|
- 'label' => __( 'Include this field in sorting options', 'userswp' ), |
|
2433
|
|
- 'checked' => $user_sort_value, |
|
2434
|
|
- 'value' => '1', |
|
2435
|
|
- 'switch' => 'md', |
|
2436
|
|
- 'label_force_left' => true, |
|
2437
|
|
- 'help_text' => uwp_help_tip( __( 'Lets you use this field as sorting in the users listing page, set from user sorting tab above.', 'userswp' ) ), |
|
2438
|
|
- |
|
2439
|
|
- ) |
|
2440
|
|
- ); |
|
2441
|
|
- |
|
2442
|
|
- ?> |
|
2443
|
|
- |
|
2444
|
|
- </div> |
|
2445
|
|
- |
|
2446
|
2497
|
<?php |
|
2447
|
2498
|
} |
|
2448
|
2499
|
|
|
2449
|
2500
|
public function return_empty_string() { |
|
2450
|
|
- return ''; |
|
2501
|
+ return ""; |
|
2451
|
2502
|
} |
|
2452
|
2503
|
|
|
2453
|
2504
|
public function register_available_fields_head( $heading, $form_type ) { |
|
2454
|
2505
|
switch ( $form_type ) { |
|
@@ -2509,9 +2560,9 @@ |
|
2509
|
2560
|
$field_type = isset( $_REQUEST['field_type'] ) ? sanitize_text_field( $_REQUEST['field_type'] ) : ''; |
|
2510
|
2561
|
$field_type_key = isset( $_REQUEST['field_type_key'] ) ? sanitize_text_field( $_REQUEST['field_type_key'] ) : ''; |
|
2511
|
2562
|
$field_action = isset( $_REQUEST['field_ins_upd'] ) ? sanitize_text_field( $_REQUEST['field_ins_upd'] ) : ''; |
|
2512
|
2563
|
$field_id = isset( $_REQUEST['field_id'] ) ? sanitize_text_field( $_REQUEST['field_id'] ) : ''; |
|
2513
|
|
- $form_id = isset( $_REQUEST['form_id'] ) ? absint( $_REQUEST['form_id'] ) : 1; |
|
2564
|
+ $form_id = isset( $_REQUEST['form_id'] ) ? absint($_REQUEST['form_id']) : 1; |
|
2514
|
2565
|
|
|
2515
|
2566
|
$field_id = $field_id != '' ? trim( $field_id, '_' ) : $field_id; |
|
2516
|
2567
|
|
|
2517
|
2568
|
$field_ids = array(); |
|
@@ -2521,13 +2572,10 @@ |
|
2521
|
2572
|
} |
|
2522
|
2573
|
} |
|
2523
|
2574
|
|
|
2524
|
2575
|
/* ------- check nonce field ------- */ |
|
2525
|
|
- if ( isset( $_REQUEST['update'] ) && $_REQUEST['update'] == 'update' && isset( $_REQUEST['create_field'] ) && isset( $_REQUEST['manage_field_type'] ) && $_REQUEST['manage_field_type'] == 'custom_fields' ) { |
|
2526
|
|
- if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'uwp_create_field_nonce' ) ) { |
|
2527
|
|
- return; |
|
2528
|
|
- } |
|
2529
|
|
- echo $this->set_field_order( $field_ids, $form_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2576
|
+ if ( isset( $_REQUEST['update'] ) && $_REQUEST['update'] == "update" && isset( $_REQUEST['create_field'] ) && isset( $_REQUEST['manage_field_type'] ) && $_REQUEST['manage_field_type'] == 'custom_fields' ) { |
|
2577
|
+ echo $this->set_field_order( $field_ids, $form_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
2530
|
2578
|
} |
|
2531
|
2579
|
|
|
2532
|
2580
|
/* ---- Show field form in admin ---- */ |
|
2533
|
2581
|
if ( $field_type != '' && $field_id != '' && $field_action == 'new' && isset( $_REQUEST['create_field'] ) && isset( $_REQUEST['manage_field_type'] ) && $_REQUEST['manage_field_type'] == 'custom_fields' ) { |
|
@@ -2533,8 +2581,9 @@ |
|
2533
|
2581
|
if ( $field_type != '' && $field_id != '' && $field_action == 'new' && isset( $_REQUEST['create_field'] ) && isset( $_REQUEST['manage_field_type'] ) && $_REQUEST['manage_field_type'] == 'custom_fields' ) { |
|
2534
|
2582
|
$this->form_field_adminhtml( $field_type, $field_id, $field_action, $field_type_key, $form_type ); |
|
2535
|
2583
|
} |
|
2536
|
2584
|
|
|
2585
|
+ |
|
2537
|
2586
|
/* ---- Delete field ---- */ |
|
2538
|
2587
|
if ( $field_id != '' && $field_action == 'delete' && isset( $_REQUEST['_wpnonce'] ) && isset( $_REQUEST['create_field'] ) && isset( $_REQUEST['manage_field_type'] ) && $_REQUEST['manage_field_type'] == 'custom_fields' ) { |
|
2539
|
2588
|
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom_fields_delete_' . $field_id ) ) { |
|
2540
|
2589
|
return; |
|
@@ -2555,9 +2604,9 @@ |
|
2555
|
2604
|
} else { |
|
2556
|
2605
|
$tags = ''; |
|
2557
|
2606
|
} |
|
2558
|
2607
|
|
|
2559
|
|
- if ( $tags != 'skip_field' && !empty( $_REQUEST[ $pkey ] ) ) { |
|
2608
|
+ if ( $tags != 'skip_field' ) { |
|
2560
|
2609
|
$_REQUEST[ $pkey ] = strip_tags( $_REQUEST[ $pkey ], $tags ); |
|
2561
|
2610
|
} |
|
2562
|
2611
|
} |
|
2563
|
2612
|
|
|
@@ -2571,8 +2620,9 @@ |
|
2571
|
2620
|
} |
|
2572
|
2621
|
} |
|
2573
|
2622
|
|
|
2574
|
2623
|
wp_die(); |
|
2624
|
+ |
|
2575
|
2625
|
} |
|
2576
|
2626
|
|
|
2577
|
2627
|
public function set_field_order( $field_ids = array(), $form_id = 1 ) { |
|
2578
|
2628
|
|
|
@@ -2580,9 +2630,9 @@ |
|
2580
|
2630
|
|
|
2581
|
2631
|
$table_name = uwp_get_table_prefix() . 'uwp_form_fields'; |
|
2582
|
2632
|
|
|
2583
|
2633
|
$count = 0; |
|
2584
|
|
- if ( ! empty( $field_ids ) ) : |
|
2634
|
+ if ( ! empty( $field_ids ) ): |
|
2585
|
2635
|
$user_meta_info = false; |
|
2586
|
2636
|
foreach ( $field_ids as $id ) { |
|
2587
|
2637
|
|
|
2588
|
2638
|
$cf = trim( $id, '_' ); |
|
@@ -2588,19 +2638,19 @@ |
|
2588
|
2638
|
$cf = trim( $id, '_' ); |
|
2589
|
2639
|
|
|
2590
|
2640
|
$user_meta_info = $wpdb->query( |
|
2591
|
2641
|
$wpdb->prepare( |
|
2592
|
|
- 'update ' . $table_name . ' set |
|
2642
|
+ "update " . $table_name . " set |
|
2593
|
2643
|
sort_order=%d |
|
2594
|
|
- where id= %d and form_id = %d', |
|
2644
|
+ where id= %d and form_id = %d", |
|
2595
|
2645
|
array( $count, $cf, $form_id ) |
|
2596
|
2646
|
) |
|
2597
|
2647
|
); |
|
2598
|
|
- ++$count; |
|
2648
|
+ $count ++; |
|
2599
|
2649
|
} |
|
2600
|
2650
|
|
|
2601
|
2651
|
return $user_meta_info; |
|
2602
|
|
- else : |
|
2652
|
+ else: |
|
2603
|
2653
|
return false; |
|
2604
|
2654
|
endif; |
|
2605
|
2655
|
} |
|
2606
|
2656
|
|
|
@@ -2614,19 +2664,22 @@ |
|
2614
|
2664
|
|
|
2615
|
2665
|
if ( $field_id != '' ) { |
|
2616
|
2666
|
$cf = trim( $field_id, '_' ); |
|
2617
|
2667
|
|
|
2618
|
|
- if ( $field = $wpdb->get_row( $wpdb->prepare( 'select id, htmlvar_name FROM ' . $table_name . ' WHERE id= %d AND form_id = %d', array( (int) $cf, (int) $form_id ) ) ) ) { |
|
2668
|
+ if ( $field = $wpdb->get_row( $wpdb->prepare( "select id, htmlvar_name from " . $table_name . " where id= %d AND form_id = %d", array( $cf, $form_id ) ) ) ) { |
|
2619
|
2669
|
|
|
2620
|
|
- $excluded_delete = array( 'email' ); |
|
2621
|
|
- $excluded_delete = apply_filters( 'uwp_register_fields_exculde_delete', $excluded_delete ); |
|
2622
|
|
- |
|
2623
|
|
- if ( isset( $field->htmlvar_name ) && in_array( $field->htmlvar_name, $excluded_delete ) ) { |
|
2670
|
+ $excluded_delete = array('username', 'email'); |
|
2671
|
+ if(isset($field->htmlvar_name) && in_array($field->htmlvar_name, $excluded_delete)){ |
|
2624
|
2672
|
return $field_id; |
|
2625
|
2673
|
} |
|
2626
|
2674
|
|
|
2675
|
+ $wpdb->query( $wpdb->prepare( "delete from " . $table_name . " where id= %d AND form_id = %d", array( $cf, $form_id ) ) ); |
|
2676
|
+ |
|
2677
|
+ // Also delete register form field |
|
2678
|
+ $wpdb->query( $wpdb->prepare( "delete from " . $extras_table_name . " where site_htmlvar_name= %s AND form_id = %d ", array( $field->htmlvar_name, $form_id ) ) ); |
|
2679
|
+ |
|
2627
|
2680
|
// delete the meta column |
|
2628
|
|
- if ( isset( $field->htmlvar_name ) && $delete_meta ) { |
|
2681
|
+ if ( isset($field->htmlvar_name) && $delete_meta ) { |
|
2629
|
2682
|
$register_forms = uwp_get_option( 'multiple_registration_forms' ); |
|
2630
|
2683
|
$custom_fields = array(); |
|
2631
|
2684
|
|
|
2632
|
2685
|
if ( ! empty( $register_forms ) && is_array( $register_forms ) ) { |
|
@@ -2636,26 +2689,21 @@ |
|
2636
|
2689
|
|
|
2637
|
2690
|
if ( isset( $form_ids ) && count( $form_ids ) > 0 ) { |
|
2638
|
2691
|
$form_ids_placeholder = array_fill( 0, count( $form_ids ), '%d' ); |
|
2639
|
2692
|
$form_ids_placeholder = implode( ', ', $form_ids_placeholder ); |
|
2640
|
|
- $query = $wpdb->prepare( 'SELECT id FROM ' . $table_name . " WHERE form_type = 'account' AND htmlvar_name = '" . $field->htmlvar_name . "' AND form_id IN (" . $form_ids_placeholder . ') ORDER BY sort_order ASC', $form_ids ); |
|
2641
|
|
- $custom_fields = $wpdb->get_results( $query ); |
|
2693
|
+ $query = $wpdb->prepare("SELECT id FROM " . $table_name . " WHERE form_type = 'account' AND htmlvar_name = '".$field->htmlvar_name."' AND form_id IN (" . $form_ids_placeholder . ") ORDER BY sort_order ASC", $form_ids); |
|
2694
|
+ $custom_fields = $wpdb->get_results( $query); |
|
2642
|
2695
|
} |
|
2643
|
2696
|
} |
|
2644
|
2697
|
|
|
2645
|
|
- if ( isset( $custom_fields ) && ! empty( $custom_fields ) && count( $custom_fields ) > 1 ) { |
|
2698
|
+ if(isset($custom_fields) && !empty($custom_fields) && count($custom_fields) > 0){ |
|
2646
|
2699
|
// Do not delete user meta column if field used in more than one form. |
|
2647
|
2700
|
} else { |
|
2648
|
2701
|
$col_name = sanitize_sql_orderby( $field->htmlvar_name ); |
|
2649
|
|
- $wpdb->query( "ALTER TABLE `{$meta_table}` DROP COLUMN `{$col_name}`" ); |
|
2702
|
+ $wpdb->query( "ALTER TABLE `{$meta_table}` DROP COLUMN $col_name" ); |
|
2650
|
2703
|
} |
|
2651
|
2704
|
} |
|
2652
|
2705
|
|
|
2653
|
|
- $wpdb->query( $wpdb->prepare( 'delete from ' . $table_name . ' where id= %d AND form_id = %d', array( $cf, $form_id ) ) ); |
|
2654
|
|
- |
|
2655
|
|
- // Also delete register form field |
|
2656
|
|
- $wpdb->query( $wpdb->prepare( 'delete from ' . $extras_table_name . ' where site_htmlvar_name= %s AND form_id = %d ', array( $field->htmlvar_name, $form_id ) ) ); |
|
2657
|
|
- |
|
2658
|
2706
|
do_action( 'uwp_after_custom_field_deleted', $cf, $field ); |
|
2659
|
2707
|
|
|
2660
|
2708
|
return $field_id; |
|
2661
|
2709
|
} else { |
|
@@ -2693,9 +2741,9 @@ |
|
2693
|
2741
|
|
|
2694
|
2742
|
$old_html_variable_name = 'uwp_account_' . $cehhtmlvar_name; |
|
2695
|
2743
|
$check_old_html_variable = $wpdb->get_var( |
|
2696
|
2744
|
$wpdb->prepare( |
|
2697
|
|
- 'select htmlvar_name from ' . $table_name . ' where id <> %d and htmlvar_name = %s and form_type = %s and form_id = %d', |
|
2745
|
+ "select htmlvar_name from " . $table_name . " where id <> %d and htmlvar_name = %s and form_type = %s and form_id = %d", |
|
2698
|
2746
|
array( $cf, $old_html_variable_name, $form_type, $form_id ) |
|
2699
|
2747
|
) |
|
2700
|
2748
|
); |
|
2701
|
2749
|
|
|
@@ -2700,13 +2748,14 @@ |
|
2700
|
2748
|
); |
|
2701
|
2749
|
|
|
2702
|
2750
|
$check_html_variable = $wpdb->get_var( |
|
2703
|
2751
|
$wpdb->prepare( |
|
2704
|
|
- 'select htmlvar_name from ' . $table_name . ' where id <> %d and htmlvar_name = %s and form_type = %s and form_id = %d', |
|
2752
|
+ "select htmlvar_name from " . $table_name . " where id <> %d and htmlvar_name = %s and form_type = %s and form_id = %d", |
|
2705
|
2753
|
array( $cf, $cehhtmlvar_name, $form_type, $form_id ) |
|
2706
|
2754
|
) |
|
2707
|
2755
|
); |
|
2708
|
2756
|
|
|
2757
|
+ |
|
2709
|
2758
|
if ( ( ! $check_old_html_variable && ! $check_html_variable ) || $request_field['field_type'] == 'fieldset' ) { |
|
2710
|
2759
|
|
|
2711
|
2760
|
if ( $cf != '' ) { |
|
2712
|
2761
|
|
|
@@ -2711,9 +2760,9 @@ |
|
2711
|
2760
|
if ( $cf != '' ) { |
|
2712
|
2761
|
|
|
2713
|
2762
|
$user_meta_info = $wpdb->get_row( |
|
2714
|
2763
|
$wpdb->prepare( |
|
2715
|
|
- 'select * from ' . $table_name . ' where id = %d', |
|
2764
|
+ "select * from " . $table_name . " where id = %d", |
|
2716
|
2765
|
array( $cf ) |
|
2717
|
2766
|
) |
|
2718
|
2767
|
); |
|
2719
|
2768
|
|
|
@@ -2729,18 +2778,14 @@ |
|
2729
|
2778
|
$help_text = isset( $request_field['help_text'] ) ? sanitize_text_field( $request_field['help_text'] ) : ''; |
|
2730
|
2779
|
$field_type = sanitize_text_field( $request_field['field_type'] ); |
|
2731
|
2780
|
$data_type = sanitize_text_field( $request_field['data_type'] ); |
|
2732
|
2781
|
$field_type_key = isset( $request_field['field_type_key'] ) ? sanitize_text_field( $request_field['field_type_key'] ) : $field_type; |
|
2733
|
|
- $htmlvar_name = isset( $request_field['htmlvar_name'] ) ? str_replace( |
|
2734
|
|
- array( |
|
2735
|
|
- '-', |
|
2736
|
|
- ' ', |
|
2737
|
|
- '"', |
|
2738
|
|
- "'", |
|
2739
|
|
- ), |
|
2740
|
|
- array( '_', '', '', '' ), |
|
2741
|
|
- sanitize_title_with_dashes( $request_field['htmlvar_name'] ) |
|
2742
|
|
- ) : null; |
|
2782
|
+ $htmlvar_name = isset( $request_field['htmlvar_name'] ) ? str_replace( array( |
|
2783
|
+ '-', |
|
2784
|
+ ' ', |
|
2785
|
+ '"', |
|
2786
|
+ "'" |
|
2787
|
+ ), array( '_', '', '', '' ), sanitize_title_with_dashes( $request_field['htmlvar_name'] ) ) : null; |
|
2743
|
2788
|
$default_value = isset( $request_field['default_value'] ) ? sanitize_text_field( $request_field['default_value'] ) : ''; |
|
2744
|
2789
|
$sort_order = isset( $request_field['sort_order'] ) ? absint( $request_field['sort_order'] ) : ''; |
|
2745
|
2790
|
$is_active = isset( $request_field['is_active'] ) ? absint( $request_field['is_active'] ) : 1; |
|
2746
|
2791
|
$placeholder_value = isset( $request_field['placeholder_value'] ) ? $request_field['placeholder_value'] : ''; |
|
@@ -2763,20 +2808,14 @@ |
|
2763
|
2808
|
$validation_msg = isset( $request_field['validation_msg'] ) ? sanitize_text_field( $request_field['validation_msg'] ) : ''; |
|
2764
|
2809
|
$user_sort = isset( $request_field['user_sort'] ) ? absint( $request_field['user_sort'] ) : 0; |
|
2765
|
2810
|
|
|
2766
|
2811
|
if ( empty( $htmlvar_name ) ) { |
|
2767
|
|
- $htmlvar_name = sanitize_key( |
|
2768
|
|
- str_replace( |
|
2769
|
|
- array( '-', ' ', '"', "'" ), |
|
2770
|
|
- array( |
|
2771
|
|
- '_', |
|
2772
|
|
- '_', |
|
2773
|
|
- '', |
|
2774
|
|
- '', |
|
2775
|
|
- ), |
|
2776
|
|
- $request_field['site_title'] |
|
2777
|
|
- ) |
|
2778
|
|
- ); |
|
2812
|
+ $htmlvar_name = sanitize_key( str_replace( array( '-', ' ', '"', "'" ), array( |
|
2813
|
+ '_', |
|
2814
|
+ '_', |
|
2815
|
+ '', |
|
2816
|
+ '' |
|
2817
|
+ ), $request_field['site_title'] ) ); |
|
2779
|
2818
|
if ( str_replace( '_', '', $htmlvar_name ) != '' ) { |
|
2780
|
2819
|
$htmlvar_name = substr( $htmlvar_name, 0, 50 ); |
|
2781
|
2820
|
} else { |
|
2782
|
2821
|
$htmlvar_name = time(); |
|
@@ -2783,14 +2822,14 @@ |
|
2783
|
2822
|
} |
|
2784
|
2823
|
} |
|
2785
|
2824
|
|
|
2786
|
2825
|
if ( is_array( $show_in ) ) { |
|
2787
|
|
- $show_in = implode( ',', $request_field['show_in'] ); |
|
2826
|
+ $show_in = implode( ",", $request_field['show_in'] ); |
|
2788
|
2827
|
$show_in = sanitize_text_field( $show_in ); |
|
2789
|
2828
|
} |
|
2790
|
2829
|
|
|
2791
|
2830
|
if ( is_array( $user_roles ) ) { |
|
2792
|
|
- $user_roles = implode( ',', $request_field['user_roles'] ); |
|
2831
|
+ $user_roles = implode( ",", $request_field['user_roles'] ); |
|
2793
|
2832
|
$user_roles = sanitize_text_field( $user_roles ); |
|
2794
|
2833
|
} |
|
2795
|
2834
|
|
|
2796
|
2835
|
$option_values = ''; |
|
@@ -2803,9 +2842,9 @@ |
|
2803
|
2842
|
} |
|
2804
|
2843
|
|
|
2805
|
2844
|
if ( $sort_order == '' ) { |
|
2806
|
2845
|
|
|
2807
|
|
- $last_order = $wpdb->get_var( 'SELECT MAX(sort_order) as last_order FROM ' . $table_name ); |
|
2846
|
+ $last_order = $wpdb->get_var( "SELECT MAX(sort_order) as last_order FROM " . $table_name ); |
|
2808
|
2847
|
|
|
2809
|
2848
|
$sort_order = (int) $last_order + 1; |
|
2810
|
2849
|
} |
|
2811
|
2850
|
|
|
@@ -2814,13 +2853,14 @@ |
|
2814
|
2853
|
$excluded = uwp_get_excluded_fields(); |
|
2815
|
2854
|
|
|
2816
|
2855
|
if ( ! in_array( $htmlvar_name, $excluded ) ) { |
|
2817
|
2856
|
// Create custom columns |
|
2818
|
|
- switch ( $field_type ) : |
|
2857
|
+ switch ( $field_type ): |
|
2819
|
2858
|
|
|
2820
|
2859
|
case 'checkbox': |
|
2821
|
2860
|
case 'multiselect': |
|
2822
|
2861
|
case 'select': |
|
2862
|
+ |
|
2823
|
2863
|
$op_size = '500'; |
|
2824
|
2864
|
|
|
2825
|
2865
|
// only make the field as big as it needs to be. |
|
2826
|
2866
|
if ( isset( $option_values ) && $option_values && $field_type == 'select' ) { |
|
@@ -2841,9 +2881,9 @@ |
|
2841
|
2881
|
$op_size = strlen( $option_values ); |
|
2842
|
2882
|
} |
|
2843
|
2883
|
} |
|
2844
|
2884
|
|
|
2845
|
|
- $meta_field_add = 'ALTER TABLE ' . $meta_table . ' CHANGE `' . $old_html_variable . '` `' . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
2885
|
+ $meta_field_add = "ALTER TABLE " . $meta_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "`VARCHAR( $op_size ) NULL"; |
|
2846
|
2886
|
|
|
2847
|
2887
|
if ( $default_value != '' ) { |
|
2848
|
2888
|
$meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
2849
|
2889
|
} |
|
@@ -2860,8 +2900,9 @@ |
|
2860
|
2900
|
if ( isset( $request_field['multi_display_type'] ) ) { |
|
2861
|
2901
|
$extra_fields = $request_field['multi_display_type']; |
|
2862
|
2902
|
} |
|
2863
|
2903
|
|
|
2904
|
+ |
|
2864
|
2905
|
break; |
|
2865
|
2906
|
|
|
2866
|
2907
|
case 'textarea': |
|
2867
|
2908
|
case 'editor': |
|
@@ -2866,9 +2907,10 @@ |
|
2866
|
2907
|
case 'textarea': |
|
2867
|
2908
|
case 'editor': |
|
2868
|
2909
|
case 'url': |
|
2869
|
2910
|
case 'file': |
|
2870
|
|
- $alter_result = $wpdb->query( 'ALTER TABLE ' . $meta_table . ' CHANGE `' . $old_html_variable . '` `' . $htmlvar_name . '` TEXT NULL' ); |
|
2911
|
+ |
|
2912
|
+ $alter_result = $wpdb->query( "ALTER TABLE " . $meta_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL" ); |
|
2871
|
2913
|
if ( $alter_result === false ) { |
|
2872
|
2914
|
return __( 'Column change failed, you may have too many columns.', 'userswp' ); |
|
2873
|
2915
|
} |
|
2874
|
2916
|
if ( isset( $request_field['advanced_editor'] ) ) { |
|
@@ -2883,11 +2925,11 @@ |
|
2883
|
2925
|
|
|
2884
|
2926
|
default: |
|
2885
|
2927
|
if ( $data_type != 'VARCHAR' && $data_type != '' ) { |
|
2886
|
2928
|
if ( $data_type == 'FLOAT' && $decimal_point > 0 ) { |
|
2887
|
|
- $default_value_add = 'ALTER TABLE ' . $meta_table . ' CHANGE `' . $old_html_variable . '` `' . $htmlvar_name . '` DECIMAL(11, ' . (int) $decimal_point . ') NULL'; |
|
2929
|
+ $default_value_add = "ALTER TABLE " . $meta_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int) $decimal_point . ") NULL"; |
|
2888
|
2930
|
} else { |
|
2889
|
|
- $default_value_add = 'ALTER TABLE ' . $meta_table . ' CHANGE `' . $old_html_variable . '` `' . $htmlvar_name . '` ' . $data_type . ' NULL'; |
|
2931
|
+ $default_value_add = "ALTER TABLE " . $meta_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL"; |
|
2890
|
2932
|
} |
|
2891
|
2933
|
|
|
2892
|
2934
|
if ( is_numeric( $default_value ) && $default_value != '' ) { |
|
2893
|
2935
|
$default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
@@ -2892,9 +2934,9 @@ |
|
2892
|
2934
|
if ( is_numeric( $default_value ) && $default_value != '' ) { |
|
2893
|
2935
|
$default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
2894
|
2936
|
} |
|
2895
|
2937
|
} else { |
|
2896
|
|
- $default_value_add = 'ALTER TABLE ' . $meta_table . ' CHANGE `' . $old_html_variable . '` `' . $htmlvar_name . '` VARCHAR( 254 ) NULL'; |
|
2938
|
+ $default_value_add = "ALTER TABLE " . $meta_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` VARCHAR( 254 ) NULL"; |
|
2897
|
2939
|
if ( $default_value != '' ) { |
|
2898
|
2940
|
$default_value_add .= " DEFAULT '" . $default_value . "'"; |
|
2899
|
2941
|
} |
|
2900
|
2942
|
} |
|
@@ -2912,10 +2954,12 @@ |
|
2912
|
2954
|
$extra_field_query = serialize( $extra_fields ); |
|
2913
|
2955
|
} |
|
2914
|
2956
|
|
|
2915
|
2957
|
$wpdb->query( |
|
2958
|
+ |
|
2916
|
2959
|
$wpdb->prepare( |
|
2917
|
|
- 'update ' . $table_name . ' set |
|
2960
|
+ |
|
2961
|
+ "update " . $table_name . " set |
|
2918
|
2962
|
form_type = %s, |
|
2919
|
2963
|
site_title = %s, |
|
2920
|
2964
|
form_label = %s, |
|
2921
|
2965
|
help_text = %s, |
|
@@ -2946,9 +2990,10 @@ |
|
2946
|
2990
|
validation_pattern = %s, |
|
2947
|
2991
|
validation_msg = %s, |
|
2948
|
2992
|
form_id = %d, |
|
2949
|
2993
|
user_sort = %s |
|
2950
|
|
- where id = %d', |
|
2994
|
+ where id = %d", |
|
2995
|
+ |
|
2951
|
2996
|
array( |
|
2952
|
2997
|
$form_type, |
|
2953
|
2998
|
$site_title, |
|
2954
|
2999
|
$form_label, |
|
@@ -2980,11 +3025,12 @@ |
|
2980
|
3025
|
$validation_pattern, |
|
2981
|
3026
|
$validation_msg, |
|
2982
|
3027
|
$form_id, |
|
2983
|
3028
|
$user_sort, |
|
2984
|
|
- $cf, |
|
3029
|
+ $cf |
|
2985
|
3030
|
) |
|
2986
|
3031
|
) |
|
3032
|
+ |
|
2987
|
3033
|
); |
|
2988
|
3034
|
|
|
2989
|
3035
|
$lastid = trim( $cf ); |
|
2990
|
3036
|
|
|
@@ -2991,14 +3037,14 @@ |
|
2991
|
3037
|
do_action( 'uwp_after_custom_fields_updated', $lastid ); |
|
2992
|
3038
|
|
|
2993
|
3039
|
} else { |
|
2994
|
3040
|
|
|
2995
|
|
- switch ( $field_type ) : |
|
3041
|
+ switch ( $field_type ): |
|
2996
|
3042
|
|
|
2997
|
3043
|
case 'checkbox': |
|
2998
|
3044
|
$data_type = 'TINYINT'; |
|
2999
|
3045
|
|
|
3000
|
|
- $meta_field_add = $data_type . '( 1 ) NOT NULL '; |
|
3046
|
+ $meta_field_add = $data_type . "( 1 ) NOT NULL "; |
|
3001
|
3047
|
if ( (int) $default_value === 1 ) { |
|
3002
|
3048
|
$meta_field_add .= " DEFAULT '1'"; |
|
3003
|
3049
|
} |
|
3004
|
3050
|
|
|
@@ -3052,11 +3098,12 @@ |
|
3052
|
3098
|
case 'textarea': |
|
3053
|
3099
|
case 'editor': |
|
3054
|
3100
|
case 'url': |
|
3055
|
3101
|
case 'file': |
|
3102
|
+ |
|
3056
|
3103
|
$data_type = 'TEXT'; |
|
3057
|
3104
|
|
|
3058
|
|
- $meta_field_add = $data_type . ' NULL '; |
|
3105
|
+ $meta_field_add = $data_type . " NULL "; |
|
3059
|
3106
|
|
|
3060
|
3107
|
$add_result = uwp_add_column_if_not_exist( $meta_table, $htmlvar_name, $meta_field_add ); |
|
3061
|
3108
|
if ( $add_result === false ) { |
|
3062
|
3109
|
return __( 'Column creation failed, you may have too many columns or the default value does not match with field data type.', 'userswp' ); |
|
@@ -3064,11 +3111,12 @@ |
|
3064
|
3111
|
|
|
3065
|
3112
|
break; |
|
3066
|
3113
|
|
|
3067
|
3114
|
case 'datepicker': |
|
3115
|
+ |
|
3068
|
3116
|
$data_type = 'DATE'; |
|
3069
|
3117
|
|
|
3070
|
|
- $meta_field_add = $data_type . ' NULL '; |
|
3118
|
+ $meta_field_add = $data_type . " NULL "; |
|
3071
|
3119
|
|
|
3072
|
3120
|
$add_result = uwp_add_column_if_not_exist( $meta_table, $htmlvar_name, $meta_field_add ); |
|
3073
|
3121
|
if ( $add_result === false ) { |
|
3074
|
3122
|
return __( 'Column creation failed, you may have too many columns or the default value must have in valid date format.', 'userswp' ); |
|
@@ -3076,11 +3124,12 @@ |
|
3076
|
3124
|
|
|
3077
|
3125
|
break; |
|
3078
|
3126
|
|
|
3079
|
3127
|
case 'time': |
|
3128
|
+ |
|
3080
|
3129
|
$data_type = 'TIME'; |
|
3081
|
3130
|
|
|
3082
|
|
- $meta_field_add = $data_type . ' NULL '; |
|
3131
|
+ $meta_field_add = $data_type . " NULL "; |
|
3083
|
3132
|
|
|
3084
|
3133
|
$add_result = uwp_add_column_if_not_exist( $meta_table, $htmlvar_name, $meta_field_add ); |
|
3085
|
3134
|
if ( $add_result === false ) { |
|
3086
|
3135
|
return __( 'Column creation failed, you may have too many columns or the default value must have in valid time format.', 'userswp' ); |
|
@@ -3088,13 +3137,14 @@ |
|
3088
|
3137
|
|
|
3089
|
3138
|
break; |
|
3090
|
3139
|
|
|
3091
|
3140
|
default: |
|
3141
|
+ |
|
3092
|
3142
|
if ( $data_type != 'VARCHAR' && $data_type != '' ) { |
|
3093
|
|
- $meta_field_add = $data_type . ' NULL '; |
|
3143
|
+ $meta_field_add = $data_type . " NULL "; |
|
3094
|
3144
|
|
|
3095
|
3145
|
if ( $data_type == 'FLOAT' && $decimal_point > 0 ) { |
|
3096
|
|
- $meta_field_add = 'DECIMAL(11, ' . (int) $decimal_point . ') NULL '; |
|
3146
|
+ $meta_field_add = "DECIMAL(11, " . (int) $decimal_point . ") NULL "; |
|
3097
|
3147
|
} |
|
3098
|
3148
|
|
|
3099
|
3149
|
if ( is_numeric( $default_value ) && $default_value != '' ) { |
|
3100
|
3150
|
$meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
@@ -3099,9 +3149,9 @@ |
|
3099
|
3149
|
if ( is_numeric( $default_value ) && $default_value != '' ) { |
|
3100
|
3150
|
$meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
3101
|
3151
|
} |
|
3102
|
3152
|
} else { |
|
3103
|
|
- $meta_field_add = ' VARCHAR( 254 ) NULL '; |
|
3153
|
+ $meta_field_add = " VARCHAR( 254 ) NULL "; |
|
3104
|
3154
|
|
|
3105
|
3155
|
if ( $default_value != '' ) { |
|
3106
|
3156
|
$meta_field_add .= " DEFAULT '" . $default_value . "'"; |
|
3107
|
3157
|
} |
|
@@ -3119,10 +3169,12 @@ |
|
3119
|
3169
|
$extra_field_query = serialize( $extra_fields ); |
|
3120
|
3170
|
} |
|
3121
|
3171
|
|
|
3122
|
3172
|
$wpdb->query( |
|
3173
|
+ |
|
3123
|
3174
|
$wpdb->prepare( |
|
3124
|
|
- 'insert into ' . $table_name . ' set |
|
3175
|
+ |
|
3176
|
+ "insert into " . $table_name . " set |
|
3125
|
3177
|
form_type = %s, |
|
3126
|
3178
|
site_title = %s, |
|
3127
|
3179
|
form_label = %s, |
|
3128
|
3180
|
help_text = %s, |
|
@@ -3152,9 +3204,10 @@ |
|
3152
|
3204
|
extra_fields = %s, |
|
3153
|
3205
|
validation_pattern = %s, |
|
3154
|
3206
|
validation_msg = %s, |
|
3155
|
3207
|
form_id = %d, |
|
3156
|
|
- user_sort = %s ', |
|
3208
|
+ user_sort = %s ", |
|
3209
|
+ |
|
3157
|
3210
|
array( |
|
3158
|
3211
|
$form_type, |
|
3159
|
3212
|
$site_title, |
|
3160
|
3213
|
$form_label, |
|
@@ -3185,11 +3238,13 @@ |
|
3185
|
3238
|
$extra_field_query, |
|
3186
|
3239
|
$validation_pattern, |
|
3187
|
3240
|
$validation_msg, |
|
3188
|
3241
|
$form_id, |
|
3189
|
|
- $user_sort, |
|
3242
|
+ $user_sort |
|
3190
|
3243
|
) |
|
3244
|
+ |
|
3191
|
3245
|
) |
|
3246
|
+ |
|
3192
|
3247
|
); |
|
3193
|
3248
|
|
|
3194
|
3249
|
$lastid = $wpdb->insert_id; |
|
3195
|
3250
|
|
|
@@ -3198,11 +3253,13 @@ |
|
3198
|
3253
|
} |
|
3199
|
3254
|
|
|
3200
|
3255
|
return (int) $lastid; |
|
3201
|
3256
|
|
|
3257
|
+ |
|
3202
|
3258
|
} else { |
|
3203
|
3259
|
return 'invalid_key'; |
|
3204
|
3260
|
} |
|
3261
|
+ |
|
3205
|
3262
|
} |
|
3206
|
3263
|
|
|
3207
|
3264
|
public function register_ajax_handler() { |
|
3208
|
3265
|
if ( isset( $_REQUEST['create_field'] ) ) { |
|
@@ -3214,14 +3271,10 @@ |
|
3214
|
3271
|
$form_id = isset( $_REQUEST['form_id'] ) ? sanitize_text_field( $_REQUEST['form_id'] ) : 1; |
|
3215
|
3272
|
$field_id = isset( $_REQUEST['field_id'] ) ? trim( sanitize_text_field( $_REQUEST['field_id'] ), '_' ) : ''; |
|
3216
|
3273
|
$field_action = isset( $_REQUEST['field_ins_upd'] ) ? sanitize_text_field( $_REQUEST['field_ins_upd'] ) : ''; |
|
3217
|
3274
|
|
|
3218
|
|
- /* ------- update order of fields ------- */ |
|
3219
|
|
- if ( isset( $_REQUEST['update'] ) && $_REQUEST['update'] == 'update' && isset( $_REQUEST['_wpnonce'] )) { |
|
3220
|
|
- if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'uwp_create_field_nonce' ) ) { |
|
3221
|
|
- return; |
|
3222
|
|
- } |
|
3223
|
|
- |
|
3275
|
+ /* ------- check nonce field ------- */ |
|
3276
|
+ if ( isset( $_REQUEST['update'] ) && $_REQUEST['update'] == 'update' ) { |
|
3224
|
3277
|
$field_ids = array(); |
|
3225
|
3278
|
if ( ! empty( $_REQUEST['licontainer'] ) && is_array( $_REQUEST['licontainer'] ) ) { |
|
3226
|
3279
|
foreach ( $_REQUEST['licontainer'] as $lic_id ) { |
|
3227
|
3280
|
$field_ids[] = sanitize_text_field( $lic_id ); |
|
@@ -3227,9 +3280,9 @@ |
|
3227
|
3280
|
$field_ids[] = sanitize_text_field( $lic_id ); |
|
3228
|
3281
|
} |
|
3229
|
3282
|
} |
|
3230
|
3283
|
|
|
3231
|
|
- $return = uwp_form_extras_field_order( $field_ids, 'register', $form_id ); |
|
3284
|
+ $return = uwp_form_extras_field_order( $field_ids, "register", $form_id ); |
|
3232
|
3285
|
|
|
3233
|
3286
|
if ( is_array( $return ) ) { |
|
3234
|
3287
|
$return = json_encode( $return ); |
|
3235
|
3288
|
} |
|
@@ -3241,8 +3294,9 @@ |
|
3241
|
3294
|
if ( $field_action == 'new' ) { |
|
3242
|
3295
|
$form_type = isset( $_REQUEST['form_type'] ) ? sanitize_text_field( $_REQUEST['form_type'] ) : ''; |
|
3243
|
3296
|
$fields = $this->register_fields( $form_type, $form_id ); |
|
3244
|
3297
|
|
|
3298
|
+ |
|
3245
|
3299
|
$_REQUEST['site_field_id'] = isset( $_REQUEST['field_id'] ) ? sanitize_text_field( $_REQUEST['field_id'] ) : ''; |
|
3246
|
3300
|
$_REQUEST['is_default'] = '0'; |
|
3247
|
3301
|
|
|
3248
|
3302
|
if ( ! empty( $fields ) ) { |
|
@@ -3255,8 +3309,9 @@ |
|
3255
|
3309
|
} |
|
3256
|
3310
|
} |
|
3257
|
3311
|
} |
|
3258
|
3312
|
|
|
3313
|
+ |
|
3259
|
3314
|
$htmlvar_name = isset( $_REQUEST['htmlvar_name'] ) ? sanitize_text_field( $_REQUEST['htmlvar_name'] ) : ''; |
|
3260
|
3315
|
|
|
3261
|
3316
|
$this->register_field_adminhtml( $htmlvar_name, $field_action, false, $_REQUEST ); |
|
3262
|
3317
|
} |
|
@@ -3283,8 +3338,9 @@ |
|
3283
|
3338
|
$_REQUEST[ $pkey ] = strip_tags( sanitize_text_field( $_REQUEST[ $pkey ] ), $tags ); |
|
3284
|
3339
|
} |
|
3285
|
3340
|
} |
|
3286
|
3341
|
|
|
3342
|
+ |
|
3287
|
3343
|
$return = $this->register_field_save( $_REQUEST ); |
|
3288
|
3344
|
|
|
3289
|
3345
|
if ( is_int( $return ) ) { |
|
3290
|
3346
|
$lastid = $return; |
|
@@ -3305,9 +3361,9 @@ |
|
3305
|
3361
|
|
|
3306
|
3362
|
if ( $field_id != '' ) { |
|
3307
|
3363
|
$cf = trim( $field_id, '_' ); |
|
3308
|
3364
|
|
|
3309
|
|
- $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $extras_table_name . ' WHERE id= %d ', array( $cf ) ) ); |
|
3365
|
+ $wpdb->query( $wpdb->prepare( "delete from " . $extras_table_name . " where id= %d ", array( $cf ) ) ); |
|
3310
|
3366
|
|
|
3311
|
3367
|
return $field_id; |
|
3312
|
3368
|
|
|
3313
|
3369
|
} else { |
|
@@ -3330,19 +3386,16 @@ |
|
3330
|
3386
|
$cf = trim( $result_str, '_' ); |
|
3331
|
3387
|
|
|
3332
|
3388
|
/*-------- check duplicate validation --------*/ |
|
3333
|
3389
|
|
|
3334
|
|
- $site_htmlvar_name = isset( $request_field['site_htmlvar_name'] ) ? sanitize_text_field( $request_field['site_htmlvar_name'] ) : sanitize_text_field( $request_field['htmlvar_name'] ); |
|
3390
|
+ $site_htmlvar_name = isset( $request_field['site_htmlvar_name'] ) ? sanitize_text_field($request_field['site_htmlvar_name']) : sanitize_text_field($request_field['htmlvar_name']); |
|
3335
|
3391
|
$form_type = $request_field['form_type']; |
|
3336
|
3392
|
$field_type = $request_field['field_type']; |
|
3337
|
3393
|
|
|
3338
|
|
- $check_html_variable = $wpdb->get_var( |
|
3339
|
|
- $wpdb->prepare( |
|
3340
|
|
- 'select site_htmlvar_name from ' . $extras_table_name . ' where id <> %d and site_htmlvar_name = %s and form_type = %s and form_id=%d', |
|
3341
|
|
- array( $cf, $site_htmlvar_name, $form_type, $form_id ) |
|
3342
|
|
- ) |
|
3343
|
|
- ); |
|
3394
|
+ $check_html_variable = $wpdb->get_var( $wpdb->prepare( "select site_htmlvar_name from " . $extras_table_name . " where id <> %d and site_htmlvar_name = %s and form_type = %s and form_id=%d", |
|
3395
|
+ array( $cf, $site_htmlvar_name, $form_type, $form_id ) ) ); |
|
3344
|
3396
|
|
|
3397
|
+ |
|
3345
|
3398
|
if ( ! $check_html_variable ) { |
|
3346
|
3399
|
|
|
3347
|
3400
|
if ( $cf != '' ) { |
|
3348
|
3401
|
|
|
@@ -3347,9 +3400,9 @@ |
|
3347
|
3400
|
if ( $cf != '' ) { |
|
3348
|
3401
|
|
|
3349
|
3402
|
$user_meta_info = $wpdb->get_row( |
|
3350
|
3403
|
$wpdb->prepare( |
|
3351
|
|
- 'select * from ' . $extras_table_name . ' where id = %d', |
|
3404
|
+ "select * from " . $extras_table_name . " where id = %d", |
|
3352
|
3405
|
array( $cf ) |
|
3353
|
3406
|
) |
|
3354
|
3407
|
); |
|
3355
|
3408
|
|
|
@@ -3358,9 +3411,9 @@ |
|
3358
|
3411
|
if ( $form_type == '' ) { |
|
3359
|
3412
|
$form_type = 'register'; |
|
3360
|
3413
|
} |
|
3361
|
3414
|
|
|
3362
|
|
- $site_htmlvar_name = sanitize_text_field( $request_field['site_htmlvar_name'] ); |
|
3415
|
+ $site_htmlvar_name = sanitize_text_field($request_field['site_htmlvar_name']); |
|
3363
|
3416
|
$field_id = ( isset( $request_field['field_id'] ) && $request_field['field_id'] ) ? str_replace( 'new', '', $request_field['field_id'] ) : ''; |
|
3364
|
3417
|
|
|
3365
|
3418
|
if ( ! empty( $user_meta_info ) ) { |
|
3366
|
3419
|
|
|
@@ -3365,15 +3418,15 @@ |
|
3365
|
3418
|
if ( ! empty( $user_meta_info ) ) { |
|
3366
|
3419
|
|
|
3367
|
3420
|
$wpdb->query( |
|
3368
|
3421
|
$wpdb->prepare( |
|
3369
|
|
- 'update ' . $extras_table_name . ' set |
|
3422
|
+ "update " . $extras_table_name . " set |
|
3370
|
3423
|
form_type = %s, |
|
3371
|
3424
|
field_type = %s, |
|
3372
|
3425
|
site_htmlvar_name = %s, |
|
3373
|
3426
|
sort_order = %s, |
|
3374
|
3427
|
form_id = %d |
|
3375
|
|
- where id = %d', |
|
3428
|
+ where id = %d", |
|
3376
|
3429
|
array( |
|
3377
|
3430
|
$form_type, |
|
3378
|
3431
|
$field_type, |
|
3379
|
3432
|
$site_htmlvar_name, |
|
@@ -3378,31 +3431,36 @@ |
|
3378
|
3431
|
$field_type, |
|
3379
|
3432
|
$site_htmlvar_name, |
|
3380
|
3433
|
$field_id, |
|
3381
|
3434
|
$form_id, |
|
3382
|
|
- $cf, |
|
3435
|
+ $cf |
|
3383
|
3436
|
) |
|
3437
|
+ |
|
3384
|
3438
|
) |
|
3439
|
+ |
|
3385
|
3440
|
); |
|
3386
|
3441
|
|
|
3387
|
3442
|
$lastid = trim( $cf ); |
|
3388
|
3443
|
|
|
3444
|
+ |
|
3389
|
3445
|
} else { |
|
3390
|
3446
|
|
|
3447
|
+ |
|
3391
|
3448
|
$wpdb->query( |
|
3392
|
3449
|
$wpdb->prepare( |
|
3393
|
|
- 'insert into ' . $extras_table_name . ' set |
|
3450
|
+ |
|
3451
|
+ "insert into " . $extras_table_name . " set |
|
3394
|
3452
|
form_type = %s, |
|
3395
|
3453
|
field_type = %s, |
|
3396
|
3454
|
site_htmlvar_name = %s, |
|
3397
|
3455
|
sort_order = %s, |
|
3398
|
|
- form_id = %s', |
|
3456
|
+ form_id = %s", |
|
3399
|
3457
|
array( |
|
3400
|
3458
|
$form_type, |
|
3401
|
3459
|
$field_type, |
|
3402
|
3460
|
$site_htmlvar_name, |
|
3403
|
3461
|
$field_id, |
|
3404
|
|
- $form_id, |
|
3462
|
+ $form_id |
|
3405
|
3463
|
) |
|
3406
|
3464
|
) |
|
3407
|
3465
|
); |
|
3408
|
3466
|
$lastid = $wpdb->insert_id; |
|
@@ -3410,9 +3468,11 @@ |
|
3410
|
3468
|
} |
|
3411
|
3469
|
|
|
3412
|
3470
|
return (int) $lastid; |
|
3413
|
3471
|
|
|
3472
|
+ |
|
3414
|
3473
|
} else { |
|
3415
|
3474
|
return 'invalid_key'; |
|
3416
|
3475
|
} |
|
3417
|
3476
|
} |
|
3418
|
|
-} |
|
3477
|
+ |
|
3478
|
+} |