@@ -14,38 +14,38 @@ discard block |
||
14 | 14 | |
15 | 15 | public static function get_direct_link( $key, $form = false ) { |
16 | 16 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
17 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
18 | - |
|
19 | - return $target_url; |
|
20 | - } |
|
21 | - |
|
22 | - public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
23 | - $defaults = array( |
|
24 | - 'blank' => true, |
|
25 | - 'field_id' => false, |
|
26 | - 'onchange' => false, |
|
27 | - 'exclude' => false, |
|
28 | - 'class' => '', |
|
17 | + $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
18 | + |
|
19 | + return $target_url; |
|
20 | + } |
|
21 | + |
|
22 | + public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
23 | + $defaults = array( |
|
24 | + 'blank' => true, |
|
25 | + 'field_id' => false, |
|
26 | + 'onchange' => false, |
|
27 | + 'exclude' => false, |
|
28 | + 'class' => '', |
|
29 | 29 | 'inc_children' => 'exclude', |
30 | - ); |
|
31 | - $args = wp_parse_args( $args, $defaults ); |
|
30 | + ); |
|
31 | + $args = wp_parse_args( $args, $defaults ); |
|
32 | 32 | |
33 | - if ( ! $args['field_id'] ) { |
|
34 | - $args['field_id'] = $field_name; |
|
35 | - } |
|
33 | + if ( ! $args['field_id'] ) { |
|
34 | + $args['field_id'] = $field_name; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | $query = array(); |
38 | - if ( $args['exclude'] ) { |
|
38 | + if ( $args['exclude'] ) { |
|
39 | 39 | $query['id !'] = $args['exclude']; |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
42 | + $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
43 | 43 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
44 | 44 | $add_html = array(); |
45 | 45 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
46 | 46 | self::add_html_attr( $args['class'], 'class', $add_html ); |
47 | 47 | |
48 | - ?> |
|
48 | + ?> |
|
49 | 49 | <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $args['field_id'] ) ?>" <?php echo implode( ' ', $add_html ); ?>> |
50 | 50 | <?php if ( $args['blank'] ) { ?> |
51 | 51 | <option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | <?php } ?> |
58 | 58 | </select> |
59 | 59 | <?php |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @param string $class |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - public static function form_switcher() { |
|
75 | + public static function form_switcher() { |
|
76 | 76 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
77 | 77 | $forms = FrmForm::get_published_forms( $where ); |
78 | 78 | |
@@ -81,32 +81,32 @@ discard block |
||
81 | 81 | unset( $args['form'] ); |
82 | 82 | } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
83 | 83 | unset( $args['id'] ); |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | 86 | $frm_action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
87 | 87 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
88 | - $args['frm_action'] = 'list'; |
|
89 | - $args['form'] = 0; |
|
88 | + $args['frm_action'] = 'list'; |
|
89 | + $args['form'] = 0; |
|
90 | 90 | } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
91 | - $args['frm_action'] = 'edit'; |
|
91 | + $args['frm_action'] = 'edit'; |
|
92 | 92 | } else if ( isset( $_GET['post'] ) ) { |
93 | - $args['form'] = 0; |
|
94 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
95 | - } |
|
93 | + $args['form'] = 0; |
|
94 | + $base = admin_url('edit.php?post_type=frm_display'); |
|
95 | + } |
|
96 | 96 | |
97 | - ?> |
|
97 | + ?> |
|
98 | 98 | <li class="dropdown last" id="frm_bs_dropdown"> |
99 | 99 | <a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown"><?php _e( 'Switch Form', 'formidable' ) ?> <b class="caret"></b></a> |
100 | 100 | <ul class="frm-dropdown-menu frm-on-top" role="menu" aria-labelledby="frm-navbarDrop"> |
101 | 101 | <?php |
102 | 102 | foreach ( $forms as $form ) { |
103 | 103 | if ( isset( $args['id'] ) ) { |
104 | - $args['id'] = $form->id; |
|
104 | + $args['id'] = $form->id; |
|
105 | 105 | } |
106 | - if ( isset( $args['form'] ) ) { |
|
107 | - $args['form'] = $form->id; |
|
106 | + if ( isset( $args['form'] ) ) { |
|
107 | + $args['form'] = $form->id; |
|
108 | 108 | } |
109 | - ?> |
|
109 | + ?> |
|
110 | 110 | <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
111 | 111 | <?php |
112 | 112 | unset( $form ); |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | </ul> |
115 | 115 | </li> |
116 | 116 | <?php |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | public static function get_sortable_classes( $col, $sort_col, $sort_dir ) { |
120 | - echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
121 | - echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
122 | - } |
|
120 | + echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
121 | + echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
122 | + } |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Get the invalid form error message |
@@ -143,104 +143,104 @@ discard block |
||
143 | 143 | return $message; |
144 | 144 | } |
145 | 145 | |
146 | - /** |
|
147 | - * Used when a form is created |
|
148 | - */ |
|
149 | - public static function setup_new_vars( $values = array() ) { |
|
150 | - global $wpdb; |
|
146 | + /** |
|
147 | + * Used when a form is created |
|
148 | + */ |
|
149 | + public static function setup_new_vars( $values = array() ) { |
|
150 | + global $wpdb; |
|
151 | 151 | |
152 | - if ( ! empty( $values ) ) { |
|
153 | - $post_values = $values; |
|
154 | - } else { |
|
155 | - $values = array(); |
|
156 | - $post_values = isset($_POST) ? $_POST : array(); |
|
157 | - } |
|
152 | + if ( ! empty( $values ) ) { |
|
153 | + $post_values = $values; |
|
154 | + } else { |
|
155 | + $values = array(); |
|
156 | + $post_values = isset($_POST) ? $_POST : array(); |
|
157 | + } |
|
158 | 158 | |
159 | 159 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
160 | 160 | if ( ! isset( $values[ $var ] ) ) { |
161 | 161 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
162 | - } |
|
163 | - } |
|
162 | + } |
|
163 | + } |
|
164 | 164 | |
165 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
165 | + $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
166 | 166 | |
167 | 167 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
168 | - if ( ! isset( $values[ $var ] ) ) { |
|
168 | + if ( ! isset( $values[ $var ] ) ) { |
|
169 | 169 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
170 | - } |
|
171 | - } |
|
170 | + } |
|
171 | + } |
|
172 | 172 | |
173 | - if ( ! isset( $values['form_key'] ) ) { |
|
173 | + if ( ! isset( $values['form_key'] ) ) { |
|
174 | 174 | $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' ); |
175 | - } |
|
175 | + } |
|
176 | 176 | |
177 | 177 | $values = self::fill_default_opts( $values, false, $post_values ); |
178 | 178 | $values['custom_style'] = FrmAppHelper::custom_style_value( $post_values ); |
179 | 179 | |
180 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
181 | - } |
|
180 | + return apply_filters('frm_setup_new_form_vars', $values); |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * Used when editing a form |
|
185 | - */ |
|
186 | - public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
183 | + /** |
|
184 | + * Used when editing a form |
|
185 | + */ |
|
186 | + public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
187 | 187 | if ( empty( $post_values ) ) { |
188 | 188 | $post_values = stripslashes_deep( $_POST ); |
189 | 189 | } |
190 | 190 | |
191 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
192 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
193 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
194 | - $values['status'] = $record->status; |
|
191 | + $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
192 | + $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
193 | + $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
194 | + $values['status'] = $record->status; |
|
195 | 195 | |
196 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
196 | + $values = self::fill_default_opts($values, $record, $post_values); |
|
197 | 197 | |
198 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
199 | - } |
|
198 | + return apply_filters('frm_setup_edit_form_vars', $values); |
|
199 | + } |
|
200 | 200 | |
201 | 201 | public static function fill_default_opts( $values, $record, $post_values ) { |
202 | 202 | |
203 | - $defaults = self::get_default_opts(); |
|
203 | + $defaults = self::get_default_opts(); |
|
204 | 204 | foreach ( $defaults as $var => $default ) { |
205 | - if ( is_array($default) ) { |
|
206 | - if ( ! isset( $values[ $var ] ) ) { |
|
205 | + if ( is_array($default) ) { |
|
206 | + if ( ! isset( $values[ $var ] ) ) { |
|
207 | 207 | $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
208 | - } |
|
208 | + } |
|
209 | 209 | |
210 | - foreach ( $default as $k => $v ) { |
|
210 | + foreach ( $default as $k => $v ) { |
|
211 | 211 | $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v); |
212 | 212 | |
213 | - if ( is_array( $v ) ) { |
|
214 | - foreach ( $v as $k1 => $v1 ) { |
|
213 | + if ( is_array( $v ) ) { |
|
214 | + foreach ( $v as $k1 => $v1 ) { |
|
215 | 215 | $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
216 | - unset( $k1, $v1 ); |
|
217 | - } |
|
218 | - } |
|
216 | + unset( $k1, $v1 ); |
|
217 | + } |
|
218 | + } |
|
219 | 219 | |
220 | - unset($k, $v); |
|
221 | - } |
|
222 | - } else { |
|
220 | + unset($k, $v); |
|
221 | + } |
|
222 | + } else { |
|
223 | 223 | $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
224 | - } |
|
224 | + } |
|
225 | 225 | |
226 | - unset($var, $default); |
|
227 | - } |
|
226 | + unset($var, $default); |
|
227 | + } |
|
228 | 228 | |
229 | - return $values; |
|
230 | - } |
|
229 | + return $values; |
|
230 | + } |
|
231 | 231 | |
232 | - public static function get_default_opts() { |
|
233 | - $frm_settings = FrmAppHelper::get_settings(); |
|
232 | + public static function get_default_opts() { |
|
233 | + $frm_settings = FrmAppHelper::get_settings(); |
|
234 | 234 | |
235 | - return array( |
|
236 | - 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
237 | - 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
238 | - 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
239 | - 'before_html' => self::get_default_html('before'), |
|
240 | - 'after_html' => '', |
|
241 | - 'submit_html' => self::get_default_html('submit'), |
|
242 | - ); |
|
243 | - } |
|
235 | + return array( |
|
236 | + 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
237 | + 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
238 | + 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
239 | + 'before_html' => self::get_default_html('before'), |
|
240 | + 'after_html' => '', |
|
241 | + 'submit_html' => self::get_default_html('submit'), |
|
242 | + ); |
|
243 | + } |
|
244 | 244 | |
245 | 245 | /** |
246 | 246 | * @param array $options |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | - /** |
|
259 | - * @param string $loc |
|
260 | - */ |
|
258 | + /** |
|
259 | + * @param string $loc |
|
260 | + */ |
|
261 | 261 | public static function get_default_html( $loc ) { |
262 | 262 | if ( $loc == 'submit' ) { |
263 | - $draft_link = self::get_draft_link(); |
|
264 | - $default_html = <<<SUBMIT_HTML |
|
263 | + $draft_link = self::get_draft_link(); |
|
264 | + $default_html = <<<SUBMIT_HTML |
|
265 | 265 | <div class="frm_submit"> |
266 | 266 | [if back_button]<button type="submit" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook]>[back_label]</button>[/if back_button] |
267 | 267 | <button class="frm_button_submit" type="submit" [button_action]>[button_label]</button> |
@@ -269,22 +269,22 @@ discard block |
||
269 | 269 | </div> |
270 | 270 | SUBMIT_HTML; |
271 | 271 | } else if ( $loc == 'before' ) { |
272 | - $default_html = <<<BEFORE_HTML |
|
272 | + $default_html = <<<BEFORE_HTML |
|
273 | 273 | <legend class="frm_hidden">[form_name]</legend> |
274 | 274 | [if form_name]<h3 class="frm_form_title">[form_name]</h3>[/if form_name] |
275 | 275 | [if form_description]<div class="frm_description">[form_description]</div>[/if form_description] |
276 | 276 | BEFORE_HTML; |
277 | 277 | } else { |
278 | - $default_html = ''; |
|
279 | - } |
|
278 | + $default_html = ''; |
|
279 | + } |
|
280 | 280 | |
281 | - return $default_html; |
|
282 | - } |
|
281 | + return $default_html; |
|
282 | + } |
|
283 | 283 | |
284 | - public static function get_draft_link() { |
|
285 | - $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
286 | - return $link; |
|
287 | - } |
|
284 | + public static function get_draft_link() { |
|
285 | + $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
286 | + return $link; |
|
287 | + } |
|
288 | 288 | |
289 | 289 | public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { |
290 | 290 | $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values ); |
@@ -311,13 +311,13 @@ discard block |
||
311 | 311 | echo $button_parts[1]; |
312 | 312 | } |
313 | 313 | |
314 | - /** |
|
315 | - * Automatically add end section fields if they don't exist (2.0 migration) |
|
316 | - * @since 2.0 |
|
317 | - * |
|
318 | - * @param boolean $reset_fields |
|
319 | - */ |
|
320 | - public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
314 | + /** |
|
315 | + * Automatically add end section fields if they don't exist (2.0 migration) |
|
316 | + * @since 2.0 |
|
317 | + * |
|
318 | + * @param boolean $reset_fields |
|
319 | + */ |
|
320 | + public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
321 | 321 | if ( empty( $fields ) ) { |
322 | 322 | return; |
323 | 323 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $prev_order = false; |
328 | 328 | $add_order = 0; |
329 | 329 | $last_field = false; |
330 | - foreach ( $fields as $field ) { |
|
330 | + foreach ( $fields as $field ) { |
|
331 | 331 | if ( $prev_order === $field->field_order ) { |
332 | 332 | $add_order++; |
333 | 333 | } |
@@ -338,48 +338,48 @@ discard block |
||
338 | 338 | FrmField::update( $field->id, array( 'field_order' => $field->field_order ) ); |
339 | 339 | } |
340 | 340 | |
341 | - switch ( $field->type ) { |
|
342 | - case 'divider': |
|
343 | - // create an end section if open |
|
341 | + switch ( $field->type ) { |
|
342 | + case 'divider': |
|
343 | + // create an end section if open |
|
344 | 344 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
345 | 345 | |
346 | - // mark it open for the next end section |
|
347 | - $open = true; |
|
348 | - break; |
|
349 | - case 'break'; |
|
346 | + // mark it open for the next end section |
|
347 | + $open = true; |
|
348 | + break; |
|
349 | + case 'break'; |
|
350 | 350 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
351 | - break; |
|
352 | - case 'end_divider': |
|
353 | - if ( ! $open ) { |
|
354 | - // the section isn't open, so this is an extra field that needs to be removed |
|
355 | - FrmField::destroy( $field->id ); |
|
356 | - $reset_fields = true; |
|
357 | - } |
|
358 | - |
|
359 | - // There is already an end section here, so there is no need to create one |
|
360 | - $open = false; |
|
361 | - } |
|
351 | + break; |
|
352 | + case 'end_divider': |
|
353 | + if ( ! $open ) { |
|
354 | + // the section isn't open, so this is an extra field that needs to be removed |
|
355 | + FrmField::destroy( $field->id ); |
|
356 | + $reset_fields = true; |
|
357 | + } |
|
358 | + |
|
359 | + // There is already an end section here, so there is no need to create one |
|
360 | + $open = false; |
|
361 | + } |
|
362 | 362 | $prev_order = $field->field_order; |
363 | 363 | |
364 | 364 | $last_field = $field; |
365 | 365 | unset( $field ); |
366 | - } |
|
366 | + } |
|
367 | 367 | |
368 | 368 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $last_field ); |
369 | - } |
|
369 | + } |
|
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Create end section field if it doesn't exist. This is for migration from < 2.0 |
373 | 373 | * Fix any ordering that may be messed up |
374 | 374 | */ |
375 | 375 | public static function maybe_create_end_section( &$open, &$reset_fields, &$add_order, $end_section_values, $field, $move = 'no' ) { |
376 | - if ( ! $open ) { |
|
377 | - return; |
|
378 | - } |
|
376 | + if ( ! $open ) { |
|
377 | + return; |
|
378 | + } |
|
379 | 379 | |
380 | 380 | $end_section_values['field_order'] = $field->field_order + 1; |
381 | 381 | |
382 | - FrmField::create( $end_section_values ); |
|
382 | + FrmField::create( $end_section_values ); |
|
383 | 383 | |
384 | 384 | if ( $move == 'move' ) { |
385 | 385 | // bump the order of current field unless we're at the end of the form |
@@ -387,39 +387,39 @@ discard block |
||
387 | 387 | } |
388 | 388 | |
389 | 389 | $add_order += 2; |
390 | - $open = false; |
|
391 | - $reset_fields = true; |
|
392 | - } |
|
390 | + $open = false; |
|
391 | + $reset_fields = true; |
|
392 | + } |
|
393 | 393 | |
394 | - public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
394 | + public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
395 | 395 | foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) { |
396 | - if ( $code == 'form_name' ) { |
|
397 | - $replace_with = $form->name; |
|
398 | - } else if ( $code == 'form_description' ) { |
|
399 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
400 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
401 | - $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
402 | - } else { |
|
403 | - $replace_with = ''; |
|
404 | - } |
|
396 | + if ( $code == 'form_name' ) { |
|
397 | + $replace_with = $form->name; |
|
398 | + } else if ( $code == 'form_description' ) { |
|
399 | + $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
400 | + } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
401 | + $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
402 | + } else { |
|
403 | + $replace_with = ''; |
|
404 | + } |
|
405 | 405 | |
406 | 406 | FrmShortcodeHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html ); |
407 | - } |
|
407 | + } |
|
408 | 408 | |
409 | - //replace [form_key] |
|
410 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
409 | + //replace [form_key] |
|
410 | + $html = str_replace('[form_key]', $form->form_key, $html); |
|
411 | 411 | |
412 | - //replace [frmurl] |
|
413 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
412 | + //replace [frmurl] |
|
413 | + $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
414 | 414 | |
415 | 415 | if ( strpos( $html, '[button_label]' ) ) { |
416 | 416 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
417 | 417 | $submit_label = apply_filters( 'frm_submit_button', $title, $form ); |
418 | 418 | $submit_label = esc_attr( do_shortcode( $submit_label ) ); |
419 | 419 | $html = str_replace( '[button_label]', $submit_label, $html ); |
420 | - } |
|
420 | + } |
|
421 | 421 | |
422 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
422 | + $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
423 | 423 | |
424 | 424 | if ( strpos( $html, '[if back_button]' ) ) { |
425 | 425 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -433,17 +433,17 @@ discard block |
||
433 | 433 | $html = do_shortcode( $html ); |
434 | 434 | } |
435 | 435 | |
436 | - return $html; |
|
437 | - } |
|
436 | + return $html; |
|
437 | + } |
|
438 | 438 | |
439 | 439 | public static function submit_button_label( $submit ) { |
440 | - if ( ! $submit || empty($submit) ) { |
|
441 | - $frm_settings = FrmAppHelper::get_settings(); |
|
442 | - $submit = $frm_settings->submit_value; |
|
443 | - } |
|
440 | + if ( ! $submit || empty($submit) ) { |
|
441 | + $frm_settings = FrmAppHelper::get_settings(); |
|
442 | + $submit = $frm_settings->submit_value; |
|
443 | + } |
|
444 | 444 | |
445 | - return $submit; |
|
446 | - } |
|
445 | + return $submit; |
|
446 | + } |
|
447 | 447 | |
448 | 448 | /** |
449 | 449 | * If the Formidable styling isn't being loaded, |
@@ -460,19 +460,19 @@ discard block |
||
460 | 460 | } |
461 | 461 | |
462 | 462 | public static function get_form_style_class( $form = false ) { |
463 | - $style = self::get_form_style($form); |
|
464 | - $class = ' with_frm_style'; |
|
465 | - |
|
466 | - if ( empty($style) ) { |
|
467 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
468 | - return $class; |
|
469 | - } else { |
|
470 | - return; |
|
471 | - } |
|
472 | - } |
|
473 | - |
|
474 | - //If submit button needs to be inline or centered |
|
475 | - if ( is_object($form) ) { |
|
463 | + $style = self::get_form_style($form); |
|
464 | + $class = ' with_frm_style'; |
|
465 | + |
|
466 | + if ( empty($style) ) { |
|
467 | + if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
468 | + return $class; |
|
469 | + } else { |
|
470 | + return; |
|
471 | + } |
|
472 | + } |
|
473 | + |
|
474 | + //If submit button needs to be inline or centered |
|
475 | + if ( is_object($form) ) { |
|
476 | 476 | $form = $form->options; |
477 | 477 | } |
478 | 478 | |
@@ -484,17 +484,17 @@ discard block |
||
484 | 484 | $class .= ' frm_center_submit'; |
485 | 485 | } |
486 | 486 | |
487 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
487 | + $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
488 | 488 | |
489 | - return $class; |
|
490 | - } |
|
489 | + return $class; |
|
490 | + } |
|
491 | 491 | |
492 | - /** |
|
493 | - * @param string|boolean $form |
|
494 | - * |
|
495 | - * @return string |
|
496 | - */ |
|
497 | - public static function get_form_style( $form ) { |
|
492 | + /** |
|
493 | + * @param string|boolean $form |
|
494 | + * |
|
495 | + * @return string |
|
496 | + */ |
|
497 | + public static function get_form_style( $form ) { |
|
498 | 498 | $style = 1; |
499 | 499 | if ( empty( $form ) || 'default' == 'form' ) { |
500 | 500 | return $style; |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | $style = ( $form && is_object( $form ) && isset( $form->options['custom_style'] ) ) ? $form->options['custom_style'] : $style; |
515 | 515 | |
516 | 516 | return $style; |
517 | - } |
|
517 | + } |
|
518 | 518 | |
519 | 519 | /** |
520 | 520 | * Display the validation error messages when an entry is submitted |
@@ -576,72 +576,72 @@ discard block |
||
576 | 576 | } |
577 | 577 | |
578 | 578 | public static function get_scroll_js( $form_id ) { |
579 | - ?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
580 | - } |
|
579 | + ?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
580 | + } |
|
581 | 581 | |
582 | 582 | public static function edit_form_link( $form_id ) { |
583 | - if ( is_object($form_id) ) { |
|
584 | - $form = $form_id; |
|
585 | - $name = $form->name; |
|
586 | - $form_id = $form->id; |
|
587 | - } else { |
|
588 | - $name = FrmForm::getName($form_id); |
|
589 | - } |
|
590 | - |
|
591 | - if ( $form_id ) { |
|
583 | + if ( is_object($form_id) ) { |
|
584 | + $form = $form_id; |
|
585 | + $name = $form->name; |
|
586 | + $form_id = $form->id; |
|
587 | + } else { |
|
588 | + $name = FrmForm::getName($form_id); |
|
589 | + } |
|
590 | + |
|
591 | + if ( $form_id ) { |
|
592 | 592 | $val = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ) ) . '">' . ( '' == $name ? __( '(no title)' ) : FrmAppHelper::truncate( $name, 40 ) ) . '</a>'; |
593 | - } else { |
|
594 | - $val = ''; |
|
595 | - } |
|
593 | + } else { |
|
594 | + $val = ''; |
|
595 | + } |
|
596 | 596 | |
597 | - return $val; |
|
597 | + return $val; |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | public static function delete_trash_link( $id, $status, $length = 'long' ) { |
601 | - $link = ''; |
|
602 | - $labels = array( |
|
603 | - 'restore' => array( |
|
604 | - 'long' => __( 'Restore from Trash', 'formidable' ), |
|
605 | - 'short' => __( 'Restore', 'formidable' ), |
|
606 | - ), |
|
607 | - 'trash' => array( |
|
608 | - 'long' => __( 'Move to Trash', 'formidable' ), |
|
609 | - 'short' => __( 'Trash', 'formidable' ), |
|
610 | - ), |
|
611 | - 'delete' => array( |
|
612 | - 'long' => __( 'Delete Permanently', 'formidable' ), |
|
613 | - 'short' => __( 'Delete', 'formidable' ), |
|
614 | - ), |
|
615 | - ); |
|
616 | - |
|
617 | - $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
601 | + $link = ''; |
|
602 | + $labels = array( |
|
603 | + 'restore' => array( |
|
604 | + 'long' => __( 'Restore from Trash', 'formidable' ), |
|
605 | + 'short' => __( 'Restore', 'formidable' ), |
|
606 | + ), |
|
607 | + 'trash' => array( |
|
608 | + 'long' => __( 'Move to Trash', 'formidable' ), |
|
609 | + 'short' => __( 'Trash', 'formidable' ), |
|
610 | + ), |
|
611 | + 'delete' => array( |
|
612 | + 'long' => __( 'Delete Permanently', 'formidable' ), |
|
613 | + 'short' => __( 'Delete', 'formidable' ), |
|
614 | + ), |
|
615 | + ); |
|
616 | + |
|
617 | + $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
618 | 618 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
619 | - if ( 'trash' == $status ) { |
|
619 | + if ( 'trash' == $status ) { |
|
620 | 620 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
621 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
622 | - if ( EMPTY_TRASH_DAYS ) { |
|
621 | + } else if ( current_user_can('frm_delete_forms') ) { |
|
622 | + if ( EMPTY_TRASH_DAYS ) { |
|
623 | 623 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
624 | - } else { |
|
624 | + } else { |
|
625 | 625 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>'; |
626 | - } |
|
627 | - } |
|
626 | + } |
|
627 | + } |
|
628 | 628 | |
629 | - return $link; |
|
630 | - } |
|
629 | + return $link; |
|
630 | + } |
|
631 | 631 | |
632 | 632 | public static function status_nice_name( $status ) { |
633 | - $nice_names = array( |
|
634 | - 'draft' => __( 'Draft', 'formidable' ), |
|
635 | - 'trash' => __( 'Trash', 'formidable' ), |
|
636 | - 'publish' => __( 'Published', 'formidable' ), |
|
637 | - ); |
|
638 | - |
|
639 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
640 | - $status = 'publish'; |
|
641 | - } |
|
633 | + $nice_names = array( |
|
634 | + 'draft' => __( 'Draft', 'formidable' ), |
|
635 | + 'trash' => __( 'Trash', 'formidable' ), |
|
636 | + 'publish' => __( 'Published', 'formidable' ), |
|
637 | + ); |
|
638 | + |
|
639 | + if ( ! in_array($status, array_keys($nice_names)) ) { |
|
640 | + $status = 'publish'; |
|
641 | + } |
|
642 | 642 | |
643 | 643 | $name = $nice_names[ $status ]; |
644 | 644 | |
645 | - return $name; |
|
646 | - } |
|
645 | + return $name; |
|
646 | + } |
|
647 | 647 | } |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | public static function setup_new_vars( $type = '', $form_id = '' ) { |
9 | 9 | |
10 | - if ( strpos($type, '|') ) { |
|
11 | - list($type, $setting) = explode('|', $type); |
|
12 | - } |
|
10 | + if ( strpos($type, '|') ) { |
|
11 | + list($type, $setting) = explode('|', $type); |
|
12 | + } |
|
13 | 13 | |
14 | 14 | $values = self::get_default_field( $type ); |
15 | 15 | |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | - return $values; |
|
33 | - } |
|
32 | + return $values; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | public static function get_html_id( $field, $plus = '' ) { |
36 | 36 | return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field ); |
37 | - } |
|
37 | + } |
|
38 | 38 | |
39 | - public static function setup_edit_vars( $field, $doing_ajax = false ) { |
|
39 | + public static function setup_edit_vars( $field, $doing_ajax = false ) { |
|
40 | 40 | $values = self::field_object_to_array( $field, $doing_ajax ); |
41 | 41 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | 44 | public static function field_object_to_array( $field, $doing_ajax = false ) { |
45 | 45 | $values = (array) $field; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - public static function get_default_field_opts( $type, $field, $limit = false ) { |
|
87 | + public static function get_default_field_opts( $type, $field, $limit = false ) { |
|
88 | 88 | if ( $limit ) { |
89 | 89 | _deprecated_function( __FUNCTION__, '3.0', 'FrmFieldHelper::get_default_field_options' ); |
90 | 90 | $field_options = self::get_default_field_options( $type ); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | return $field_options; |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @since 3.0 |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | return $field_type->get_new_field_defaults(); |
124 | 124 | } |
125 | 125 | |
126 | - public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
127 | - global $wpdb; |
|
126 | + public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
127 | + global $wpdb; |
|
128 | 128 | |
129 | 129 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
130 | - $values['form_id'] = $form_id; |
|
131 | - $values['options'] = maybe_serialize($field->options); |
|
132 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
133 | - |
|
134 | - foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
135 | - $values[ $col ] = $field->{$col}; |
|
136 | - } |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @since 2.0 |
|
141 | - */ |
|
130 | + $values['form_id'] = $form_id; |
|
131 | + $values['options'] = maybe_serialize($field->options); |
|
132 | + $values['default_value'] = maybe_serialize($field->default_value); |
|
133 | + |
|
134 | + foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
135 | + $values[ $col ] = $field->{$col}; |
|
136 | + } |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @since 2.0 |
|
141 | + */ |
|
142 | 142 | public static function get_error_msg( $field, $error ) { |
143 | 143 | $frm_settings = FrmAppHelper::get_settings(); |
144 | 144 | $default_settings = $frm_settings->default_options(); |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | |
244 | 244 | public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
245 | 245 | _deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodesHelper::get_shortcode_tag' ); |
246 | - return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args ); |
|
247 | - } |
|
246 | + return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args ); |
|
247 | + } |
|
248 | 248 | |
249 | 249 | public static function get_checkbox_id( $field, $opt_key ) { |
250 | 250 | $id = $field['id']; |
@@ -256,37 +256,37 @@ discard block |
||
256 | 256 | |
257 | 257 | public static function display_recaptcha( $field ) { |
258 | 258 | _deprecated_function( __FUNCTION__, '3.0', 'FrmFieldCaptcha::field_input' ); |
259 | - } |
|
259 | + } |
|
260 | 260 | |
261 | 261 | public static function show_single_option( $field ) { |
262 | 262 | if ( ! is_array( $field['options'] ) ) { |
263 | 263 | return; |
264 | 264 | } |
265 | 265 | |
266 | - $field_name = $field['name']; |
|
267 | - $html_id = self::get_html_id($field); |
|
266 | + $field_name = $field['name']; |
|
267 | + $html_id = self::get_html_id($field); |
|
268 | 268 | |
269 | 269 | foreach ( $field['options'] as $opt_key => $opt ) { |
270 | - $field_val = self::get_value_from_array( $opt, $opt_key, $field ); |
|
271 | - $opt = self::get_label_from_array( $opt, $opt_key, $field ); |
|
270 | + $field_val = self::get_value_from_array( $opt, $opt_key, $field ); |
|
271 | + $opt = self::get_label_from_array( $opt, $opt_key, $field ); |
|
272 | 272 | |
273 | 273 | // Get string for Other text field, if needed |
274 | 274 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
275 | 275 | |
276 | 276 | $checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array($field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"':''; |
277 | 277 | |
278 | - // If this is an "Other" option, get the HTML for it |
|
278 | + // If this is an "Other" option, get the HTML for it |
|
279 | 279 | if ( self::is_other_opt( $opt_key ) ) { |
280 | 280 | if ( FrmAppHelper::pro_is_installed() ) { |
281 | 281 | require( FrmProAppHelper::plugin_path() . '/classes/views/frmpro-fields/other-option.php' ); |
282 | 282 | } |
283 | - } else { |
|
283 | + } else { |
|
284 | 284 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' ); |
285 | - } |
|
285 | + } |
|
286 | 286 | |
287 | 287 | unset( $checked, $other_val ); |
288 | 288 | } |
289 | - } |
|
289 | + } |
|
290 | 290 | |
291 | 291 | public static function get_value_from_array( $opt, $opt_key, $field ) { |
292 | 292 | $opt = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
@@ -299,47 +299,47 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | public static function get_term_link( $tax_id ) { |
302 | - $tax = get_taxonomy($tax_id); |
|
303 | - if ( ! $tax ) { |
|
304 | - return; |
|
305 | - } |
|
302 | + $tax = get_taxonomy($tax_id); |
|
303 | + if ( ! $tax ) { |
|
304 | + return; |
|
305 | + } |
|
306 | 306 | |
307 | - $link = sprintf( |
|
308 | - __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
307 | + $link = sprintf( |
|
308 | + __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
309 | 309 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
310 | - ); |
|
311 | - unset($tax); |
|
310 | + ); |
|
311 | + unset($tax); |
|
312 | 312 | |
313 | - return $link; |
|
314 | - } |
|
313 | + return $link; |
|
314 | + } |
|
315 | 315 | |
316 | 316 | public static function value_meets_condition( $observed_value, $cond, $hide_opt ) { |
317 | 317 | $hide_opt = self::get_value_for_comparision( $hide_opt ); |
318 | 318 | $observed_value = self::get_value_for_comparision( $observed_value ); |
319 | 319 | |
320 | - if ( is_array($observed_value) ) { |
|
321 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
322 | - } |
|
323 | - |
|
324 | - $m = false; |
|
325 | - if ( $cond == '==' ) { |
|
326 | - $m = $observed_value == $hide_opt; |
|
327 | - } else if ( $cond == '!=' ) { |
|
328 | - $m = $observed_value != $hide_opt; |
|
329 | - } else if ( $cond == '>' ) { |
|
330 | - $m = $observed_value > $hide_opt; |
|
331 | - } else if ( $cond == '<' ) { |
|
332 | - $m = $observed_value < $hide_opt; |
|
333 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
334 | - $m = stripos($observed_value, $hide_opt); |
|
335 | - if ( $cond == 'not LIKE' ) { |
|
336 | - $m = ( $m === false ) ? true : false; |
|
337 | - } else { |
|
338 | - $m = ( $m === false ) ? false : true; |
|
339 | - } |
|
340 | - } |
|
341 | - return $m; |
|
342 | - } |
|
320 | + if ( is_array($observed_value) ) { |
|
321 | + return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
322 | + } |
|
323 | + |
|
324 | + $m = false; |
|
325 | + if ( $cond == '==' ) { |
|
326 | + $m = $observed_value == $hide_opt; |
|
327 | + } else if ( $cond == '!=' ) { |
|
328 | + $m = $observed_value != $hide_opt; |
|
329 | + } else if ( $cond == '>' ) { |
|
330 | + $m = $observed_value > $hide_opt; |
|
331 | + } else if ( $cond == '<' ) { |
|
332 | + $m = $observed_value < $hide_opt; |
|
333 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
334 | + $m = stripos($observed_value, $hide_opt); |
|
335 | + if ( $cond == 'not LIKE' ) { |
|
336 | + $m = ( $m === false ) ? true : false; |
|
337 | + } else { |
|
338 | + $m = ( $m === false ) ? false : true; |
|
339 | + } |
|
340 | + } |
|
341 | + return $m; |
|
342 | + } |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Trim and sanitize the values |
@@ -355,174 +355,174 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
358 | - $m = false; |
|
359 | - if ( $cond == '==' ) { |
|
360 | - if ( is_array($hide_opt) ) { |
|
361 | - $m = array_intersect($hide_opt, $observed_value); |
|
362 | - $m = empty($m) ? false : true; |
|
363 | - } else { |
|
364 | - $m = in_array($hide_opt, $observed_value); |
|
365 | - } |
|
366 | - } else if ( $cond == '!=' ) { |
|
367 | - $m = ! in_array($hide_opt, $observed_value); |
|
368 | - } else if ( $cond == '>' ) { |
|
369 | - $min = min($observed_value); |
|
370 | - $m = $min > $hide_opt; |
|
371 | - } else if ( $cond == '<' ) { |
|
372 | - $max = max($observed_value); |
|
373 | - $m = $max < $hide_opt; |
|
374 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
375 | - foreach ( $observed_value as $ob ) { |
|
376 | - $m = strpos($ob, $hide_opt); |
|
377 | - if ( $m !== false ) { |
|
378 | - $m = true; |
|
379 | - break; |
|
380 | - } |
|
381 | - } |
|
382 | - |
|
383 | - if ( $cond == 'not LIKE' ) { |
|
384 | - $m = ( $m === false ) ? true : false; |
|
385 | - } |
|
386 | - } |
|
387 | - |
|
388 | - return $m; |
|
389 | - } |
|
390 | - |
|
391 | - /** |
|
392 | - * Replace a few basic shortcodes and field ids |
|
393 | - * @since 2.0 |
|
394 | - * @return string |
|
395 | - */ |
|
358 | + $m = false; |
|
359 | + if ( $cond == '==' ) { |
|
360 | + if ( is_array($hide_opt) ) { |
|
361 | + $m = array_intersect($hide_opt, $observed_value); |
|
362 | + $m = empty($m) ? false : true; |
|
363 | + } else { |
|
364 | + $m = in_array($hide_opt, $observed_value); |
|
365 | + } |
|
366 | + } else if ( $cond == '!=' ) { |
|
367 | + $m = ! in_array($hide_opt, $observed_value); |
|
368 | + } else if ( $cond == '>' ) { |
|
369 | + $min = min($observed_value); |
|
370 | + $m = $min > $hide_opt; |
|
371 | + } else if ( $cond == '<' ) { |
|
372 | + $max = max($observed_value); |
|
373 | + $m = $max < $hide_opt; |
|
374 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
375 | + foreach ( $observed_value as $ob ) { |
|
376 | + $m = strpos($ob, $hide_opt); |
|
377 | + if ( $m !== false ) { |
|
378 | + $m = true; |
|
379 | + break; |
|
380 | + } |
|
381 | + } |
|
382 | + |
|
383 | + if ( $cond == 'not LIKE' ) { |
|
384 | + $m = ( $m === false ) ? true : false; |
|
385 | + } |
|
386 | + } |
|
387 | + |
|
388 | + return $m; |
|
389 | + } |
|
390 | + |
|
391 | + /** |
|
392 | + * Replace a few basic shortcodes and field ids |
|
393 | + * @since 2.0 |
|
394 | + * @return string |
|
395 | + */ |
|
396 | 396 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
397 | - if ( strpos($value, '[sitename]') !== false ) { |
|
398 | - $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
399 | - $value = str_replace('[sitename]', $new_value, $value); |
|
400 | - } |
|
397 | + if ( strpos($value, '[sitename]') !== false ) { |
|
398 | + $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
399 | + $value = str_replace('[sitename]', $new_value, $value); |
|
400 | + } |
|
401 | 401 | |
402 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
403 | - $value = do_shortcode($value); |
|
402 | + $value = apply_filters('frm_content', $value, $form, $entry); |
|
403 | + $value = do_shortcode($value); |
|
404 | 404 | |
405 | - return $value; |
|
406 | - } |
|
405 | + return $value; |
|
406 | + } |
|
407 | 407 | |
408 | 408 | public static function get_shortcodes( $content, $form_id ) { |
409 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
410 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
411 | - } |
|
409 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
410 | + return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
411 | + } |
|
412 | 412 | |
413 | - $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
413 | + $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
414 | 414 | |
415 | - $tagregexp = self::allowed_shortcodes($fields); |
|
415 | + $tagregexp = self::allowed_shortcodes($fields); |
|
416 | 416 | |
417 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
417 | + preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
418 | 418 | |
419 | - return $matches; |
|
420 | - } |
|
419 | + return $matches; |
|
420 | + } |
|
421 | 421 | |
422 | 422 | public static function allowed_shortcodes( $fields = array() ) { |
423 | - $tagregexp = array( |
|
424 | - 'editlink', 'id', 'key', 'ip', |
|
425 | - 'siteurl', 'sitename', 'admin_email', |
|
426 | - 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
423 | + $tagregexp = array( |
|
424 | + 'editlink', 'id', 'key', 'ip', |
|
425 | + 'siteurl', 'sitename', 'admin_email', |
|
426 | + 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
427 | 427 | 'parent[-|_]id', |
428 | - ); |
|
428 | + ); |
|
429 | 429 | |
430 | - foreach ( $fields as $field ) { |
|
431 | - $tagregexp[] = $field->id; |
|
432 | - $tagregexp[] = $field->field_key; |
|
433 | - } |
|
430 | + foreach ( $fields as $field ) { |
|
431 | + $tagregexp[] = $field->id; |
|
432 | + $tagregexp[] = $field->field_key; |
|
433 | + } |
|
434 | 434 | |
435 | - $tagregexp = implode('|', $tagregexp); |
|
436 | - return $tagregexp; |
|
437 | - } |
|
435 | + $tagregexp = implode('|', $tagregexp); |
|
436 | + return $tagregexp; |
|
437 | + } |
|
438 | 438 | |
439 | 439 | public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
440 | - $shortcode_values = array( |
|
441 | - 'id' => $entry->id, |
|
442 | - 'key' => $entry->item_key, |
|
443 | - 'ip' => $entry->ip, |
|
444 | - ); |
|
440 | + $shortcode_values = array( |
|
441 | + 'id' => $entry->id, |
|
442 | + 'key' => $entry->item_key, |
|
443 | + 'ip' => $entry->ip, |
|
444 | + ); |
|
445 | 445 | |
446 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
446 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
447 | 447 | if ( empty( $tag ) ) { |
448 | 448 | continue; |
449 | 449 | } |
450 | 450 | |
451 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
451 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
452 | 452 | |
453 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
453 | + if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
454 | 454 | $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
455 | - $tags = explode(' ', $tag); |
|
456 | - if ( is_array($tags) ) { |
|
457 | - $tag = $tags[0]; |
|
458 | - } |
|
459 | - } else { |
|
460 | - $tag = $shortcodes[2][ $short_key ]; |
|
461 | - } |
|
462 | - |
|
463 | - switch ( $tag ) { |
|
464 | - case 'id': |
|
465 | - case 'key': |
|
466 | - case 'ip': |
|
467 | - $replace_with = $shortcode_values[ $tag ]; |
|
468 | - break; |
|
469 | - |
|
470 | - case 'user_agent': |
|
471 | - case 'user-agent': |
|
472 | - $entry->description = maybe_unserialize($entry->description); |
|
455 | + $tags = explode(' ', $tag); |
|
456 | + if ( is_array($tags) ) { |
|
457 | + $tag = $tags[0]; |
|
458 | + } |
|
459 | + } else { |
|
460 | + $tag = $shortcodes[2][ $short_key ]; |
|
461 | + } |
|
462 | + |
|
463 | + switch ( $tag ) { |
|
464 | + case 'id': |
|
465 | + case 'key': |
|
466 | + case 'ip': |
|
467 | + $replace_with = $shortcode_values[ $tag ]; |
|
468 | + break; |
|
469 | + |
|
470 | + case 'user_agent': |
|
471 | + case 'user-agent': |
|
472 | + $entry->description = maybe_unserialize($entry->description); |
|
473 | 473 | $replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] ); |
474 | - break; |
|
475 | - |
|
476 | - case 'created_at': |
|
477 | - case 'created-at': |
|
478 | - case 'updated_at': |
|
479 | - case 'updated-at': |
|
480 | - if ( isset($atts['format']) ) { |
|
481 | - $time_format = ' '; |
|
482 | - } else { |
|
483 | - $atts['format'] = get_option('date_format'); |
|
484 | - $time_format = ''; |
|
485 | - } |
|
486 | - |
|
487 | - $this_tag = str_replace('-', '_', $tag); |
|
488 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
489 | - unset($this_tag); |
|
490 | - break; |
|
491 | - |
|
492 | - case 'created_by': |
|
493 | - case 'created-by': |
|
494 | - case 'updated_by': |
|
495 | - case 'updated-by': |
|
496 | - $this_tag = str_replace('-', '_', $tag); |
|
474 | + break; |
|
475 | + |
|
476 | + case 'created_at': |
|
477 | + case 'created-at': |
|
478 | + case 'updated_at': |
|
479 | + case 'updated-at': |
|
480 | + if ( isset($atts['format']) ) { |
|
481 | + $time_format = ' '; |
|
482 | + } else { |
|
483 | + $atts['format'] = get_option('date_format'); |
|
484 | + $time_format = ''; |
|
485 | + } |
|
486 | + |
|
487 | + $this_tag = str_replace('-', '_', $tag); |
|
488 | + $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
489 | + unset($this_tag); |
|
490 | + break; |
|
491 | + |
|
492 | + case 'created_by': |
|
493 | + case 'created-by': |
|
494 | + case 'updated_by': |
|
495 | + case 'updated-by': |
|
496 | + $this_tag = str_replace('-', '_', $tag); |
|
497 | 497 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
498 | - unset($this_tag); |
|
499 | - break; |
|
500 | - |
|
501 | - case 'admin_email': |
|
502 | - case 'siteurl': |
|
503 | - case 'frmurl': |
|
504 | - case 'sitename': |
|
505 | - case 'get': |
|
506 | - $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
507 | - break; |
|
508 | - |
|
509 | - default: |
|
510 | - $field = FrmField::getOne( $tag ); |
|
511 | - if ( ! $field ) { |
|
512 | - break; |
|
513 | - } |
|
514 | - |
|
515 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
516 | - |
|
517 | - $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
518 | - |
|
519 | - $atts['entry_id'] = $entry->id; |
|
520 | - $atts['entry_key'] = $entry->item_key; |
|
521 | - |
|
522 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
523 | - $replace_with = $field->name; |
|
524 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
525 | - $replace_with = $field->description; |
|
498 | + unset($this_tag); |
|
499 | + break; |
|
500 | + |
|
501 | + case 'admin_email': |
|
502 | + case 'siteurl': |
|
503 | + case 'frmurl': |
|
504 | + case 'sitename': |
|
505 | + case 'get': |
|
506 | + $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
507 | + break; |
|
508 | + |
|
509 | + default: |
|
510 | + $field = FrmField::getOne( $tag ); |
|
511 | + if ( ! $field ) { |
|
512 | + break; |
|
513 | + } |
|
514 | + |
|
515 | + $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
516 | + |
|
517 | + $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
518 | + |
|
519 | + $atts['entry_id'] = $entry->id; |
|
520 | + $atts['entry_key'] = $entry->item_key; |
|
521 | + |
|
522 | + if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
523 | + $replace_with = $field->name; |
|
524 | + } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
525 | + $replace_with = $field->description; |
|
526 | 526 | } else { |
527 | 527 | $string_value = $replace_with; |
528 | 528 | if ( is_array( $replace_with ) ) { |
@@ -536,82 +536,82 @@ discard block |
||
536 | 536 | } |
537 | 537 | } |
538 | 538 | |
539 | - unset($field); |
|
540 | - break; |
|
541 | - } |
|
539 | + unset($field); |
|
540 | + break; |
|
541 | + } |
|
542 | 542 | |
543 | - if ( isset($replace_with) ) { |
|
544 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
545 | - } |
|
543 | + if ( isset($replace_with) ) { |
|
544 | + $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
545 | + } |
|
546 | 546 | |
547 | - unset($atts, $conditional, $replace_with); |
|
547 | + unset($atts, $conditional, $replace_with); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | return $content; |
551 | - } |
|
552 | - |
|
553 | - /** |
|
554 | - * Get the value to replace a few standard shortcodes |
|
555 | - * |
|
556 | - * @since 2.0 |
|
557 | - * @return string |
|
558 | - */ |
|
559 | - public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
560 | - $new_value = ''; |
|
561 | - switch ( $tag ) { |
|
562 | - case 'admin_email': |
|
563 | - $new_value = get_option('admin_email'); |
|
564 | - break; |
|
565 | - case 'siteurl': |
|
566 | - $new_value = FrmAppHelper::site_url(); |
|
567 | - break; |
|
568 | - case 'frmurl': |
|
569 | - $new_value = FrmAppHelper::plugin_url(); |
|
570 | - break; |
|
571 | - case 'sitename': |
|
572 | - $new_value = FrmAppHelper::site_name(); |
|
573 | - break; |
|
574 | - case 'get': |
|
575 | - $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
576 | - break; |
|
577 | - } |
|
578 | - |
|
579 | - return $new_value; |
|
580 | - } |
|
581 | - |
|
582 | - /** |
|
583 | - * Process the [get] shortcode |
|
584 | - * |
|
585 | - * @since 2.0 |
|
586 | - * @return string|array |
|
587 | - */ |
|
588 | - public static function process_get_shortcode( $atts, $return_array = false ) { |
|
589 | - if ( ! isset($atts['param']) ) { |
|
590 | - return ''; |
|
591 | - } |
|
592 | - |
|
593 | - if ( strpos($atts['param'], '[') ) { |
|
594 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
595 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
596 | - } |
|
597 | - |
|
598 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
599 | - $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
600 | - |
|
601 | - if ( $new_value == '' ) { |
|
602 | - if ( ! isset($atts['prev_val']) ) { |
|
603 | - $atts['prev_val'] = ''; |
|
604 | - } |
|
605 | - |
|
606 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
607 | - } |
|
608 | - |
|
609 | - if ( is_array($new_value) && ! $return_array ) { |
|
610 | - $new_value = implode(', ', $new_value); |
|
611 | - } |
|
612 | - |
|
613 | - return $new_value; |
|
614 | - } |
|
551 | + } |
|
552 | + |
|
553 | + /** |
|
554 | + * Get the value to replace a few standard shortcodes |
|
555 | + * |
|
556 | + * @since 2.0 |
|
557 | + * @return string |
|
558 | + */ |
|
559 | + public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
560 | + $new_value = ''; |
|
561 | + switch ( $tag ) { |
|
562 | + case 'admin_email': |
|
563 | + $new_value = get_option('admin_email'); |
|
564 | + break; |
|
565 | + case 'siteurl': |
|
566 | + $new_value = FrmAppHelper::site_url(); |
|
567 | + break; |
|
568 | + case 'frmurl': |
|
569 | + $new_value = FrmAppHelper::plugin_url(); |
|
570 | + break; |
|
571 | + case 'sitename': |
|
572 | + $new_value = FrmAppHelper::site_name(); |
|
573 | + break; |
|
574 | + case 'get': |
|
575 | + $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
576 | + break; |
|
577 | + } |
|
578 | + |
|
579 | + return $new_value; |
|
580 | + } |
|
581 | + |
|
582 | + /** |
|
583 | + * Process the [get] shortcode |
|
584 | + * |
|
585 | + * @since 2.0 |
|
586 | + * @return string|array |
|
587 | + */ |
|
588 | + public static function process_get_shortcode( $atts, $return_array = false ) { |
|
589 | + if ( ! isset($atts['param']) ) { |
|
590 | + return ''; |
|
591 | + } |
|
592 | + |
|
593 | + if ( strpos($atts['param'], '[') ) { |
|
594 | + $atts['param'] = str_replace('[', '[', $atts['param']); |
|
595 | + $atts['param'] = str_replace(']', ']', $atts['param']); |
|
596 | + } |
|
597 | + |
|
598 | + $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
599 | + $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
600 | + |
|
601 | + if ( $new_value == '' ) { |
|
602 | + if ( ! isset($atts['prev_val']) ) { |
|
603 | + $atts['prev_val'] = ''; |
|
604 | + } |
|
605 | + |
|
606 | + $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
607 | + } |
|
608 | + |
|
609 | + if ( is_array($new_value) && ! $return_array ) { |
|
610 | + $new_value = implode(', ', $new_value); |
|
611 | + } |
|
612 | + |
|
613 | + return $new_value; |
|
614 | + } |
|
615 | 615 | |
616 | 616 | public static function get_display_value( $value, $field, $atts = array() ) { |
617 | 617 | |
@@ -671,37 +671,37 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | public static function get_field_types( $type ) { |
674 | - $single_input = array( |
|
675 | - 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
676 | - 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
677 | - 'user_id', 'tag', 'password', |
|
678 | - ); |
|
674 | + $single_input = array( |
|
675 | + 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
676 | + 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
677 | + 'user_id', 'tag', 'password', |
|
678 | + ); |
|
679 | 679 | $multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' ); |
680 | 680 | $other_type = array( 'html', 'break' ); |
681 | 681 | |
682 | 682 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
683 | 683 | |
684 | - $field_types = array(); |
|
685 | - if ( in_array($type, $single_input) ) { |
|
686 | - self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
687 | - } else if ( in_array($type, $multiple_input) ) { |
|
688 | - self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
689 | - } else if ( in_array($type, $other_type) ) { |
|
690 | - self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
684 | + $field_types = array(); |
|
685 | + if ( in_array($type, $single_input) ) { |
|
686 | + self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
687 | + } else if ( in_array($type, $multiple_input) ) { |
|
688 | + self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
689 | + } else if ( in_array($type, $other_type) ) { |
|
690 | + self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
691 | 691 | } else if ( isset( $field_selection[ $type ] ) ) { |
692 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
693 | - } |
|
692 | + $field_types[ $type ] = $field_selection[ $type ]; |
|
693 | + } |
|
694 | 694 | |
695 | 695 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
696 | - return $field_types; |
|
697 | - } |
|
696 | + return $field_types; |
|
697 | + } |
|
698 | 698 | |
699 | - private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
700 | - foreach ( $inputs as $input ) { |
|
701 | - $field_types[ $input ] = $fields[ $input ]; |
|
702 | - unset($input); |
|
703 | - } |
|
704 | - } |
|
699 | + private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
700 | + foreach ( $inputs as $input ) { |
|
701 | + $field_types[ $input ] = $fields[ $input ]; |
|
702 | + unset($input); |
|
703 | + } |
|
704 | + } |
|
705 | 705 | |
706 | 706 | /** |
707 | 707 | * Check if current field option is an "other" option |
@@ -715,14 +715,14 @@ discard block |
||
715 | 715 | return $opt_key && strpos( $opt_key, 'other_' ) === 0; |
716 | 716 | } |
717 | 717 | |
718 | - /** |
|
719 | - * Get value that belongs in "Other" text box |
|
720 | - * |
|
721 | - * @since 2.0.6 |
|
722 | - * |
|
723 | - * @param array $args |
|
724 | - */ |
|
725 | - public static function get_other_val( $args ) { |
|
718 | + /** |
|
719 | + * Get value that belongs in "Other" text box |
|
720 | + * |
|
721 | + * @since 2.0.6 |
|
722 | + * |
|
723 | + * @param array $args |
|
724 | + */ |
|
725 | + public static function get_other_val( $args ) { |
|
726 | 726 | $defaults = array( |
727 | 727 | 'opt_key' => 0, 'field' => array(), |
728 | 728 | 'parent' => false, 'pointer' => false, |
@@ -798,20 +798,20 @@ discard block |
||
798 | 798 | } |
799 | 799 | |
800 | 800 | return $other_val; |
801 | - } |
|
802 | - |
|
803 | - /** |
|
804 | - * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
805 | - * Intended for front-end use |
|
806 | - * |
|
807 | - * @since 2.0.6 |
|
808 | - * |
|
809 | - * @param array $args should include field, opt_key and field name |
|
810 | - * @param boolean $other_opt |
|
811 | - * @param string $checked |
|
812 | - * @return string $other_val |
|
813 | - */ |
|
814 | - public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
801 | + } |
|
802 | + |
|
803 | + /** |
|
804 | + * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
805 | + * Intended for front-end use |
|
806 | + * |
|
807 | + * @since 2.0.6 |
|
808 | + * |
|
809 | + * @param array $args should include field, opt_key and field name |
|
810 | + * @param boolean $other_opt |
|
811 | + * @param string $checked |
|
812 | + * @return string $other_val |
|
813 | + */ |
|
814 | + public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
815 | 815 | //Check if this is an "Other" option |
816 | 816 | if ( ! self::is_other_opt( $args['opt_key'] ) ) { |
817 | 817 | return; |
@@ -827,8 +827,8 @@ discard block |
||
827 | 827 | $checked = 'checked="checked" '; |
828 | 828 | } |
829 | 829 | |
830 | - return $other_args; |
|
831 | - } |
|
830 | + return $other_args; |
|
831 | + } |
|
832 | 832 | |
833 | 833 | /** |
834 | 834 | * @param array $args |
@@ -878,8 +878,8 @@ discard block |
||
878 | 878 | * @since 2.0.6 |
879 | 879 | */ |
880 | 880 | public static function include_other_input( $args ) { |
881 | - if ( ! $args['other_opt'] ) { |
|
882 | - return; |
|
881 | + if ( ! $args['other_opt'] ) { |
|
882 | + return; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | $classes = array( 'frm_other_input' ); |
@@ -900,15 +900,15 @@ discard block |
||
900 | 900 | } |
901 | 901 | |
902 | 902 | /** |
903 | - * Get the HTML id for an "Other" text field |
|
904 | - * Note: This does not affect fields in repeating sections |
|
905 | - * |
|
906 | - * @since 2.0.08 |
|
907 | - * @param string $type - field type |
|
908 | - * @param string $html_id |
|
909 | - * @param string|boolean $opt_key |
|
910 | - * @return string $other_id |
|
911 | - */ |
|
903 | + * Get the HTML id for an "Other" text field |
|
904 | + * Note: This does not affect fields in repeating sections |
|
905 | + * |
|
906 | + * @since 2.0.08 |
|
907 | + * @param string $type - field type |
|
908 | + * @param string $html_id |
|
909 | + * @param string|boolean $opt_key |
|
910 | + * @return string $other_id |
|
911 | + */ |
|
912 | 912 | public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) { |
913 | 913 | $other_id = $html_id; |
914 | 914 | |
@@ -966,10 +966,10 @@ discard block |
||
966 | 966 | } |
967 | 967 | |
968 | 968 | public static function switch_field_ids( $val ) { |
969 | - global $frm_duplicate_ids; |
|
970 | - $replace = array(); |
|
971 | - $replace_with = array(); |
|
972 | - foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
969 | + global $frm_duplicate_ids; |
|
970 | + $replace = array(); |
|
971 | + $replace_with = array(); |
|
972 | + foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
973 | 973 | $replace[] = '[if ' . $old . ']'; |
974 | 974 | $replace_with[] = '[if ' . $new . ']'; |
975 | 975 | $replace[] = '[if ' . $old . ' '; |
@@ -984,153 +984,153 @@ discard block |
||
984 | 984 | $replace_with[] = '[' . $new . ']'; |
985 | 985 | $replace[] = '[' . $old . ' '; |
986 | 986 | $replace_with[] = '[' . $new . ' '; |
987 | - unset($old, $new); |
|
988 | - } |
|
987 | + unset($old, $new); |
|
988 | + } |
|
989 | 989 | if ( is_array( $val ) ) { |
990 | 990 | foreach ( $val as $k => $v ) { |
991 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
992 | - unset($k, $v); |
|
993 | - } |
|
994 | - } else { |
|
995 | - $val = str_replace($replace, $replace_with, $val); |
|
996 | - } |
|
997 | - |
|
998 | - return $val; |
|
999 | - } |
|
1000 | - |
|
1001 | - public static function get_us_states() { |
|
1002 | - return apply_filters( 'frm_us_states', array( |
|
1003 | - 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
1004 | - 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
1005 | - 'DC' => 'District of Columbia', |
|
1006 | - 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
1007 | - 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
1008 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
1009 | - 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
1010 | - 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
1011 | - 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
1012 | - 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
1013 | - 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
1014 | - 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
1015 | - 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
1016 | - 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
1017 | - ) ); |
|
1018 | - } |
|
1019 | - |
|
1020 | - public static function get_countries() { |
|
1021 | - return apply_filters( 'frm_countries', array( |
|
1022 | - __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
1023 | - __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
1024 | - __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
1025 | - __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
1026 | - __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
1027 | - __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
1028 | - __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
1029 | - __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
1030 | - __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
1031 | - __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
1032 | - __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
1033 | - __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
1034 | - __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
1035 | - __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
1036 | - __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
1037 | - __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
1038 | - __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
1039 | - __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
1040 | - __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
1041 | - __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
1042 | - __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
1043 | - __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
1044 | - __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
1045 | - __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
1046 | - __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
1047 | - __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
1048 | - __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
1049 | - __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
1050 | - __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
1051 | - __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
1052 | - __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
1053 | - __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
1054 | - __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
1055 | - __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
1056 | - __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
1057 | - __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
1058 | - __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
1059 | - __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
1060 | - __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
1061 | - __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
1062 | - __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
1063 | - __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
1064 | - __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
1065 | - __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
1066 | - __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
1067 | - __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
1068 | - __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
1069 | - __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
1070 | - __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
1071 | - __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
1072 | - __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
1073 | - __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
1074 | - __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
1075 | - __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
1076 | - __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
1077 | - __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
1078 | - __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
1079 | - __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
1080 | - __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
1081 | - __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
1082 | - __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
1083 | - __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
1084 | - __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
1085 | - __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
1086 | - __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
1087 | - __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
1088 | - __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
1089 | - __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
1090 | - __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
1091 | - __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
1092 | - __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
1093 | - __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
1094 | - __( 'Zimbabwe', 'formidable' ), |
|
1095 | - ) ); |
|
1096 | - } |
|
991 | + $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
992 | + unset($k, $v); |
|
993 | + } |
|
994 | + } else { |
|
995 | + $val = str_replace($replace, $replace_with, $val); |
|
996 | + } |
|
997 | + |
|
998 | + return $val; |
|
999 | + } |
|
1000 | + |
|
1001 | + public static function get_us_states() { |
|
1002 | + return apply_filters( 'frm_us_states', array( |
|
1003 | + 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
1004 | + 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
1005 | + 'DC' => 'District of Columbia', |
|
1006 | + 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
1007 | + 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
1008 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
1009 | + 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
1010 | + 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
1011 | + 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
1012 | + 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
1013 | + 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
1014 | + 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
1015 | + 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
1016 | + 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
1017 | + ) ); |
|
1018 | + } |
|
1019 | + |
|
1020 | + public static function get_countries() { |
|
1021 | + return apply_filters( 'frm_countries', array( |
|
1022 | + __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
1023 | + __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
1024 | + __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
1025 | + __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
1026 | + __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
1027 | + __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
1028 | + __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
1029 | + __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
1030 | + __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
1031 | + __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
1032 | + __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
1033 | + __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
1034 | + __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
1035 | + __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
1036 | + __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
1037 | + __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
1038 | + __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
1039 | + __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
1040 | + __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
1041 | + __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
1042 | + __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
1043 | + __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
1044 | + __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
1045 | + __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
1046 | + __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
1047 | + __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
1048 | + __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
1049 | + __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
1050 | + __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
1051 | + __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
1052 | + __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
1053 | + __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
1054 | + __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
1055 | + __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
1056 | + __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
1057 | + __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
1058 | + __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
1059 | + __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
1060 | + __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
1061 | + __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
1062 | + __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
1063 | + __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
1064 | + __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
1065 | + __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
1066 | + __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
1067 | + __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
1068 | + __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
1069 | + __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
1070 | + __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
1071 | + __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
1072 | + __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
1073 | + __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
1074 | + __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
1075 | + __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
1076 | + __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
1077 | + __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
1078 | + __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
1079 | + __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
1080 | + __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
1081 | + __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
1082 | + __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
1083 | + __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
1084 | + __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
1085 | + __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
1086 | + __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
1087 | + __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
1088 | + __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
1089 | + __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
1090 | + __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
1091 | + __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
1092 | + __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
1093 | + __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
1094 | + __( 'Zimbabwe', 'formidable' ), |
|
1095 | + ) ); |
|
1096 | + } |
|
1097 | 1097 | |
1098 | 1098 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
1099 | 1099 | $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
1100 | 1100 | |
1101 | - $states = FrmFieldsHelper::get_us_states(); |
|
1102 | - $state_abv = array_keys($states); |
|
1103 | - sort($state_abv); |
|
1101 | + $states = FrmFieldsHelper::get_us_states(); |
|
1102 | + $state_abv = array_keys($states); |
|
1103 | + sort($state_abv); |
|
1104 | 1104 | $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
1105 | 1105 | |
1106 | - $states = array_values($states); |
|
1107 | - sort($states); |
|
1106 | + $states = array_values($states); |
|
1107 | + sort($states); |
|
1108 | 1108 | $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
1109 | - unset($state_abv, $states); |
|
1109 | + unset($state_abv, $states); |
|
1110 | 1110 | |
1111 | 1111 | $prepop[ __( 'Age', 'formidable' ) ] = array( |
1112 | - __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
1113 | - __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
1114 | - __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
1115 | - ); |
|
1112 | + __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
1113 | + __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
1114 | + __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
1115 | + ); |
|
1116 | 1116 | |
1117 | 1117 | $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
1118 | - __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1119 | - __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1120 | - ); |
|
1118 | + __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1119 | + __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1120 | + ); |
|
1121 | 1121 | |
1122 | 1122 | $prepop[ __( 'Importance', 'formidable' ) ] = array( |
1123 | - __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1124 | - __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1125 | - ); |
|
1123 | + __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1124 | + __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1125 | + ); |
|
1126 | 1126 | |
1127 | 1127 | $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
1128 | - __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1129 | - __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1130 | - ); |
|
1128 | + __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
1129 | + __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
1130 | + ); |
|
1131 | 1131 | |
1132 | 1132 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
1133 | - } |
|
1133 | + } |
|
1134 | 1134 | |
1135 | 1135 | /** |
1136 | 1136 | * Display a field value selector |
@@ -1140,10 +1140,10 @@ discard block |
||
1140 | 1140 | * @param int $selector_field_id |
1141 | 1141 | * @param array $selector_args |
1142 | 1142 | */ |
1143 | - public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
1144 | - $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
1145 | - $field_value_selector->display(); |
|
1146 | - } |
|
1143 | + public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
1144 | + $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
1145 | + $field_value_selector->display(); |
|
1146 | + } |
|
1147 | 1147 | |
1148 | 1148 | /** |
1149 | 1149 | * Convert a field object to a flat array |