@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined('ABSPATH') ) { |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | 3 | die( 'You are not allowed to call this page directly.' ); |
4 | 4 | } |
5 | 5 | |
@@ -7,12 +7,12 @@ 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); |
|
10 | + if ( strpos( $type, '|' ) ) { |
|
11 | + list( $type, $setting ) = explode( '|', $type ); |
|
12 | 12 | } |
13 | 13 | |
14 | - $defaults = self::get_default_field_opts($type, $form_id); |
|
15 | - $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
14 | + $defaults = self::get_default_field_opts( $type, $form_id ); |
|
15 | + $defaults['field_options']['custom_html'] = self::get_default_html( $type ); |
|
16 | 16 | |
17 | 17 | $values = array(); |
18 | 18 | |
@@ -20,20 +20,20 @@ discard block |
||
20 | 20 | if ( $var == 'field_options' ) { |
21 | 21 | $values['field_options'] = array(); |
22 | 22 | foreach ( $default as $opt_var => $opt_default ) { |
23 | - $values['field_options'][ $opt_var ] = $opt_default; |
|
24 | - unset($opt_var, $opt_default); |
|
23 | + $values['field_options'][$opt_var] = $opt_default; |
|
24 | + unset( $opt_var, $opt_default ); |
|
25 | 25 | } |
26 | 26 | } else { |
27 | - $values[ $var ] = $default; |
|
27 | + $values[$var] = $default; |
|
28 | 28 | } |
29 | - unset($var, $default); |
|
29 | + unset( $var, $default ); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if ( isset( $setting ) && ! empty( $setting ) ) { |
33 | 33 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
34 | 34 | $values['field_options']['data_type'] = $setting; |
35 | 35 | } else { |
36 | - $values['field_options'][ $setting ] = 1; |
|
36 | + $values['field_options'][$setting] = 1; |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | $fields = FrmField::field_selection(); |
59 | - $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
59 | + $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
|
60 | 60 | |
61 | - if ( isset( $fields[ $type ] ) ) { |
|
62 | - $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
61 | + if ( isset( $fields[$type] ) ) { |
|
62 | + $values['name'] = is_array( $fields[$type] ) ? $fields[$type]['name'] : $fields[$type]; |
|
63 | 63 | } |
64 | 64 | |
65 | - unset($fields); |
|
65 | + unset( $fields ); |
|
66 | 66 | |
67 | 67 | return $values; |
68 | 68 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | $values['form_name'] = ''; |
89 | 89 | } else { |
90 | 90 | foreach ( $defaults as $var => $default ) { |
91 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
92 | - unset($var, $default); |
|
91 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
92 | + unset( $var, $default ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : ''; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $values['options'] = $record->options; |
101 | 101 | $values['field_options'] = $record->field_options; |
102 | 102 | |
103 | - $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
103 | + $defaults = self::get_default_field_opts( $values['type'], $record, true ); |
|
104 | 104 | |
105 | 105 | if ( $values['type'] == 'captcha' ) { |
106 | 106 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | foreach ( $defaults as $opt => $default ) { |
111 | - $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
112 | - unset($opt, $default); |
|
111 | + $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default; |
|
112 | + unset( $opt, $default ); |
|
113 | 113 | } |
114 | 114 | |
115 | - $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
115 | + $values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type ); |
|
116 | 116 | |
117 | 117 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
118 | 118 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | global $wpdb; |
133 | 133 | |
134 | - $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
134 | + $form_id = ( is_numeric( $field ) ) ? $field : $field->form_id; |
|
135 | 135 | |
136 | 136 | $key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key; |
137 | 137 | |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | |
154 | 154 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
155 | 155 | $values['form_id'] = $form_id; |
156 | - $values['options'] = maybe_serialize($field->options); |
|
157 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
156 | + $values['options'] = maybe_serialize( $field->options ); |
|
157 | + $values['default_value'] = maybe_serialize( $field->default_value ); |
|
158 | 158 | |
159 | 159 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
160 | - $values[ $col ] = $field->{$col}; |
|
160 | + $values[$col] = $field->{$col}; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
@@ -171,21 +171,21 @@ discard block |
||
171 | 171 | |
172 | 172 | $conf_msg = __( 'The entered values do not match', 'formidable' ); |
173 | 173 | $defaults = array( |
174 | - 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ), |
|
175 | - 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ), |
|
174 | + 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ), |
|
175 | + 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ), |
|
176 | 176 | 'blank' => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ), |
177 | 177 | 'conf_msg' => array( 'full' => $conf_msg, 'part' => $conf_msg ), |
178 | 178 | ); |
179 | 179 | |
180 | 180 | $msg = FrmField::get_option( $field, $error ); |
181 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
181 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
182 | 182 | $msg = do_shortcode( $msg ); |
183 | 183 | return $msg; |
184 | 184 | } |
185 | 185 | |
186 | 186 | public static function get_form_fields( $form_id, $error = false ) { |
187 | - $fields = FrmField::get_all_for_form($form_id); |
|
188 | - $fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error); |
|
187 | + $fields = FrmField::get_all_for_form( $form_id ); |
|
188 | + $fields = apply_filters( 'frm_get_paged_fields', $fields, $form_id, $error ); |
|
189 | 189 | return $fields; |
190 | 190 | } |
191 | 191 | |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | </div> |
209 | 209 | DEFAULT_HTML; |
210 | 210 | } else { |
211 | - $default_html = apply_filters('frm_other_custom_html', '', $type); |
|
211 | + $default_html = apply_filters( 'frm_other_custom_html', '', $type ); |
|
212 | 212 | } |
213 | 213 | |
214 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
214 | + return apply_filters( 'frm_custom_html', $default_html, $type ); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) { |
218 | - $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
218 | + $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form ); |
|
219 | 219 | |
220 | 220 | $defaults = array( |
221 | 221 | 'field_name' => 'item_meta[' . $field['id'] . ']', |
@@ -223,42 +223,42 @@ discard block |
||
223 | 223 | 'field_plus_id' => '', |
224 | 224 | 'section_id' => '', |
225 | 225 | ); |
226 | - $args = wp_parse_args($args, $defaults); |
|
226 | + $args = wp_parse_args( $args, $defaults ); |
|
227 | 227 | $field_name = $args['field_name']; |
228 | 228 | $field_id = $args['field_id']; |
229 | - $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
229 | + $html_id = self::get_html_id( $field, $args['field_plus_id'] ); |
|
230 | 230 | |
231 | - if ( FrmField::is_multiple_select($field) ) { |
|
231 | + if ( FrmField::is_multiple_select( $field ) ) { |
|
232 | 232 | $field_name .= '[]'; |
233 | 233 | } |
234 | 234 | |
235 | 235 | //replace [id] |
236 | - $html = str_replace('[id]', $field_id, $html); |
|
236 | + $html = str_replace( '[id]', $field_id, $html ); |
|
237 | 237 | |
238 | 238 | // Remove the for attribute for captcha |
239 | 239 | if ( $field['type'] == 'captcha' ) { |
240 | - $html = str_replace(' for="field_[key]"', '', $html); |
|
240 | + $html = str_replace( ' for="field_[key]"', '', $html ); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // set the label for |
244 | - $html = str_replace('field_[key]', $html_id, $html); |
|
244 | + $html = str_replace( 'field_[key]', $html_id, $html ); |
|
245 | 245 | |
246 | 246 | //replace [key] |
247 | - $html = str_replace('[key]', $field['field_key'], $html); |
|
247 | + $html = str_replace( '[key]', $field['field_key'], $html ); |
|
248 | 248 | |
249 | 249 | //replace [description] and [required_label] and [error] |
250 | 250 | $required = FrmField::is_required( $field ) ? $field['required_indicator'] : ''; |
251 | 251 | if ( ! is_array( $errors ) ) { |
252 | 252 | $errors = array(); |
253 | 253 | } |
254 | - $error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false; |
|
254 | + $error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false; |
|
255 | 255 | |
256 | 256 | //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
257 | 257 | if ( $field['type'] == 'divider' ) { |
258 | 258 | if ( FrmField::is_option_true( $field, 'description' ) ) { |
259 | 259 | $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
260 | 260 | } else { |
261 | - $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
261 | + $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html ); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
@@ -268,41 +268,41 @@ discard block |
||
268 | 268 | |
269 | 269 | //replace [required_class] |
270 | 270 | $required_class = FrmField::is_required( $field ) ? ' frm_required_field' : ''; |
271 | - $html = str_replace('[required_class]', $required_class, $html); |
|
271 | + $html = str_replace( '[required_class]', $required_class, $html ); |
|
272 | 272 | |
273 | 273 | //replace [label_position] |
274 | - $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form); |
|
274 | + $field['label'] = apply_filters( 'frm_html_label_position', $field['label'], $field, $form ); |
|
275 | 275 | $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top'; |
276 | 276 | $html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html ); |
277 | 277 | |
278 | 278 | //replace [field_name] |
279 | - $html = str_replace('[field_name]', $field['name'], $html); |
|
279 | + $html = str_replace( '[field_name]', $field['name'], $html ); |
|
280 | 280 | |
281 | 281 | self::add_field_div_classes( $field_id, $field, $errors, $html ); |
282 | 282 | |
283 | 283 | //replace [entry_key] |
284 | 284 | $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
285 | - $html = str_replace('[entry_key]', $entry_key, $html); |
|
285 | + $html = str_replace( '[entry_key]', $entry_key, $html ); |
|
286 | 286 | |
287 | 287 | //replace [input] |
288 | - preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
288 | + preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER ); |
|
289 | 289 | global $frm_vars; |
290 | 290 | $frm_settings = FrmAppHelper::get_settings(); |
291 | 291 | |
292 | 292 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
293 | - $atts = shortcode_parse_atts( $shortcodes[2][ $short_key ] ); |
|
293 | + $atts = shortcode_parse_atts( $shortcodes[2][$short_key] ); |
|
294 | 294 | $tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
295 | 295 | |
296 | 296 | $replace_with = ''; |
297 | 297 | |
298 | 298 | if ( $tag == 'input' ) { |
299 | - if ( isset($atts['opt']) ) { |
|
300 | - $atts['opt']--; |
|
299 | + if ( isset( $atts['opt'] ) ) { |
|
300 | + $atts['opt'] --; |
|
301 | 301 | } |
302 | 302 | |
303 | - $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
304 | - if ( isset($atts['class']) ) { |
|
305 | - unset($atts['class']); |
|
303 | + $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : ''; |
|
304 | + if ( isset( $atts['class'] ) ) { |
|
305 | + unset( $atts['class'] ); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | $field['shortcodes'] = $atts; |
@@ -311,33 +311,33 @@ discard block |
||
311 | 311 | $replace_with = ob_get_contents(); |
312 | 312 | ob_end_clean(); |
313 | 313 | } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
314 | - $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
314 | + $replace_with = FrmProEntriesController::entry_delete_link( $atts ); |
|
315 | 315 | } |
316 | 316 | |
317 | - $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
317 | + $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html ); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if ( $form ) { |
321 | 321 | $form = (array) $form; |
322 | 322 | |
323 | 323 | //replace [form_key] |
324 | - $html = str_replace('[form_key]', $form['form_key'], $html); |
|
324 | + $html = str_replace( '[form_key]', $form['form_key'], $html ); |
|
325 | 325 | |
326 | 326 | //replace [form_name] |
327 | - $html = str_replace('[form_name]', $form['name'], $html); |
|
327 | + $html = str_replace( '[form_name]', $form['name'], $html ); |
|
328 | 328 | } |
329 | 329 | $html .= "\n"; |
330 | 330 | |
331 | 331 | //Return html if conf_field to prevent loop |
332 | - if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
332 | + if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) { |
|
333 | 333 | return $html; |
334 | 334 | } |
335 | 335 | |
336 | 336 | //If field is in repeating section |
337 | 337 | if ( $args['section_id'] ) { |
338 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
338 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ) ); |
|
339 | 339 | } else { |
340 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
340 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ) ); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | self::remove_collapse_shortcode( $html ); |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | */ |
383 | 383 | private static function get_field_div_classes( $field_id, $field, $errors, $html ) { |
384 | 384 | // Add error class |
385 | - $classes = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : ''; |
|
385 | + $classes = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : ''; |
|
386 | 386 | |
387 | 387 | // Add label position class |
388 | 388 | $classes .= ' frm_' . $field['label'] . '_container'; |
389 | 389 | |
390 | 390 | // Add CSS layout classes |
391 | 391 | if ( ! empty( $field['classes'] ) ) { |
392 | - if ( ! strpos( $html, 'frm_form_field ') ) { |
|
392 | + if ( ! strpos( $html, 'frm_form_field ' ) ) { |
|
393 | 393 | $classes .= ' frm_form_field'; |
394 | 394 | } |
395 | 395 | $classes .= ' ' . $field['classes']; |
@@ -428,15 +428,15 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | $with_tags = $args['conditional_check'] ? 3 : 2; |
431 | - if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
432 | - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
433 | - $tag = str_replace(']', '', $tag); |
|
434 | - $tags = explode(' ', $tag); |
|
435 | - if ( is_array($tags) ) { |
|
431 | + if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) { |
|
432 | + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] ); |
|
433 | + $tag = str_replace( ']', '', $tag ); |
|
434 | + $tags = explode( ' ', $tag ); |
|
435 | + if ( is_array( $tags ) ) { |
|
436 | 436 | $tag = $tags[0]; |
437 | 437 | } |
438 | 438 | } else { |
439 | - $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
439 | + $tag = $shortcodes[$with_tags - 1][$short_key]; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | return $tag; |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | |
481 | 481 | public static function show_single_option( $field ) { |
482 | 482 | $field_name = $field['name']; |
483 | - $html_id = self::get_html_id($field); |
|
483 | + $html_id = self::get_html_id( $field ); |
|
484 | 484 | foreach ( $field['options'] as $opt_key => $opt ) { |
485 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
486 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
485 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
486 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
487 | 487 | |
488 | 488 | // If this is an "Other" option, get the HTML for it |
489 | 489 | if ( self::is_other_opt( $opt_key ) ) { |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | public static function get_term_link( $tax_id ) { |
500 | - $tax = get_taxonomy($tax_id); |
|
500 | + $tax = get_taxonomy( $tax_id ); |
|
501 | 501 | if ( ! $tax ) { |
502 | 502 | return; |
503 | 503 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
507 | 507 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
508 | 508 | ); |
509 | - unset($tax); |
|
509 | + unset( $tax ); |
|
510 | 510 | |
511 | 511 | return $link; |
512 | 512 | } |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | $observed_value = wp_kses_post( $observed_value ); |
521 | 521 | $hide_opt = wp_kses_post( $hide_opt ); |
522 | 522 | |
523 | - if ( is_array($observed_value) ) { |
|
524 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
523 | + if ( is_array( $observed_value ) ) { |
|
524 | + return self::array_value_condition( $observed_value, $cond, $hide_opt ); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | $m = false; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | } else if ( $cond == '<' ) { |
535 | 535 | $m = $observed_value < $hide_opt; |
536 | 536 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
537 | - $m = stripos($observed_value, $hide_opt); |
|
537 | + $m = stripos( $observed_value, $hide_opt ); |
|
538 | 538 | if ( $cond == 'not LIKE' ) { |
539 | 539 | $m = ( $m === false ) ? true : false; |
540 | 540 | } else { |
@@ -547,23 +547,23 @@ discard block |
||
547 | 547 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
548 | 548 | $m = false; |
549 | 549 | if ( $cond == '==' ) { |
550 | - if ( is_array($hide_opt) ) { |
|
551 | - $m = array_intersect($hide_opt, $observed_value); |
|
552 | - $m = empty($m) ? false : true; |
|
550 | + if ( is_array( $hide_opt ) ) { |
|
551 | + $m = array_intersect( $hide_opt, $observed_value ); |
|
552 | + $m = empty( $m ) ? false : true; |
|
553 | 553 | } else { |
554 | - $m = in_array($hide_opt, $observed_value); |
|
554 | + $m = in_array( $hide_opt, $observed_value ); |
|
555 | 555 | } |
556 | 556 | } else if ( $cond == '!=' ) { |
557 | - $m = ! in_array($hide_opt, $observed_value); |
|
557 | + $m = ! in_array( $hide_opt, $observed_value ); |
|
558 | 558 | } else if ( $cond == '>' ) { |
559 | - $min = min($observed_value); |
|
559 | + $min = min( $observed_value ); |
|
560 | 560 | $m = $min > $hide_opt; |
561 | 561 | } else if ( $cond == '<' ) { |
562 | - $max = max($observed_value); |
|
562 | + $max = max( $observed_value ); |
|
563 | 563 | $m = $max < $hide_opt; |
564 | 564 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
565 | 565 | foreach ( $observed_value as $ob ) { |
566 | - $m = strpos($ob, $hide_opt); |
|
566 | + $m = strpos( $ob, $hide_opt ); |
|
567 | 567 | if ( $m !== false ) { |
568 | 568 | $m = true; |
569 | 569 | break; |
@@ -584,27 +584,27 @@ discard block |
||
584 | 584 | * @return string |
585 | 585 | */ |
586 | 586 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
587 | - if ( strpos($value, '[sitename]') !== false ) { |
|
587 | + if ( strpos( $value, '[sitename]' ) !== false ) { |
|
588 | 588 | $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
589 | - $value = str_replace('[sitename]', $new_value, $value); |
|
589 | + $value = str_replace( '[sitename]', $new_value, $value ); |
|
590 | 590 | } |
591 | 591 | |
592 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
593 | - $value = do_shortcode($value); |
|
592 | + $value = apply_filters( 'frm_content', $value, $form, $entry ); |
|
593 | + $value = do_shortcode( $value ); |
|
594 | 594 | |
595 | 595 | return $value; |
596 | 596 | } |
597 | 597 | |
598 | 598 | public static function get_shortcodes( $content, $form_id ) { |
599 | 599 | if ( FrmAppHelper::pro_is_installed() ) { |
600 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
600 | + return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
604 | 604 | |
605 | - $tagregexp = self::allowed_shortcodes($fields); |
|
605 | + $tagregexp = self::allowed_shortcodes( $fields ); |
|
606 | 606 | |
607 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
607 | + preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER ); |
|
608 | 608 | |
609 | 609 | return $matches; |
610 | 610 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $tagregexp[] = $field->field_key; |
623 | 623 | } |
624 | 624 | |
625 | - $tagregexp = implode('|', $tagregexp); |
|
625 | + $tagregexp = implode( '|', $tagregexp ); |
|
626 | 626 | return $tagregexp; |
627 | 627 | } |
628 | 628 | |
@@ -634,28 +634,28 @@ discard block |
||
634 | 634 | ); |
635 | 635 | |
636 | 636 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
637 | - $atts = shortcode_parse_atts( $shortcodes[3][ $short_key ] ); |
|
637 | + $atts = shortcode_parse_atts( $shortcodes[3][$short_key] ); |
|
638 | 638 | |
639 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
640 | - $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
|
641 | - $tags = explode(' ', $tag); |
|
642 | - if ( is_array($tags) ) { |
|
639 | + if ( ! empty( $shortcodes[3][$short_key] ) ) { |
|
640 | + $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] ); |
|
641 | + $tags = explode( ' ', $tag ); |
|
642 | + if ( is_array( $tags ) ) { |
|
643 | 643 | $tag = $tags[0]; |
644 | 644 | } |
645 | 645 | } else { |
646 | - $tag = $shortcodes[2][ $short_key ]; |
|
646 | + $tag = $shortcodes[2][$short_key]; |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | switch ( $tag ) { |
650 | 650 | case 'id': |
651 | 651 | case 'key': |
652 | 652 | case 'ip': |
653 | - $replace_with = $shortcode_values[ $tag ]; |
|
653 | + $replace_with = $shortcode_values[$tag]; |
|
654 | 654 | break; |
655 | 655 | |
656 | 656 | case 'user_agent': |
657 | 657 | case 'user-agent': |
658 | - $entry->description = maybe_unserialize($entry->description); |
|
658 | + $entry->description = maybe_unserialize( $entry->description ); |
|
659 | 659 | $replace_with = FrmEntryFormat::get_browser( $entry->description['browser'] ); |
660 | 660 | break; |
661 | 661 | |
@@ -663,25 +663,25 @@ discard block |
||
663 | 663 | case 'created-at': |
664 | 664 | case 'updated_at': |
665 | 665 | case 'updated-at': |
666 | - if ( isset($atts['format']) ) { |
|
666 | + if ( isset( $atts['format'] ) ) { |
|
667 | 667 | $time_format = ' '; |
668 | 668 | } else { |
669 | - $atts['format'] = get_option('date_format'); |
|
669 | + $atts['format'] = get_option( 'date_format' ); |
|
670 | 670 | $time_format = ''; |
671 | 671 | } |
672 | 672 | |
673 | - $this_tag = str_replace('-', '_', $tag); |
|
674 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
675 | - unset($this_tag); |
|
673 | + $this_tag = str_replace( '-', '_', $tag ); |
|
674 | + $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format ); |
|
675 | + unset( $this_tag ); |
|
676 | 676 | break; |
677 | 677 | |
678 | 678 | case 'created_by': |
679 | 679 | case 'created-by': |
680 | 680 | case 'updated_by': |
681 | 681 | case 'updated-by': |
682 | - $this_tag = str_replace('-', '_', $tag); |
|
682 | + $this_tag = str_replace( '-', '_', $tag ); |
|
683 | 683 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
684 | - unset($this_tag); |
|
684 | + unset( $this_tag ); |
|
685 | 685 | break; |
686 | 686 | |
687 | 687 | case 'admin_email': |
@@ -698,16 +698,16 @@ discard block |
||
698 | 698 | break; |
699 | 699 | } |
700 | 700 | |
701 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
701 | + $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
|
702 | 702 | |
703 | 703 | $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
704 | 704 | |
705 | 705 | $atts['entry_id'] = $entry->id; |
706 | 706 | $atts['entry_key'] = $entry->item_key; |
707 | 707 | |
708 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
708 | + if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) { |
|
709 | 709 | $replace_with = $field->name; |
710 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
710 | + } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) { |
|
711 | 711 | $replace_with = $field->description; |
712 | 712 | } else { |
713 | 713 | $string_value = $replace_with; |
@@ -722,15 +722,15 @@ discard block |
||
722 | 722 | } |
723 | 723 | } |
724 | 724 | |
725 | - unset($field); |
|
725 | + unset( $field ); |
|
726 | 726 | break; |
727 | 727 | } |
728 | 728 | |
729 | - if ( isset($replace_with) ) { |
|
730 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
729 | + if ( isset( $replace_with ) ) { |
|
730 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
731 | 731 | } |
732 | 732 | |
733 | - unset($atts, $conditional, $replace_with); |
|
733 | + unset( $atts, $conditional, $replace_with ); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | return $content; |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | $new_value = ''; |
747 | 747 | switch ( $tag ) { |
748 | 748 | case 'admin_email': |
749 | - $new_value = get_option('admin_email'); |
|
749 | + $new_value = get_option( 'admin_email' ); |
|
750 | 750 | break; |
751 | 751 | case 'siteurl': |
752 | 752 | $new_value = FrmAppHelper::site_url(); |
@@ -772,28 +772,28 @@ discard block |
||
772 | 772 | * @return string|array |
773 | 773 | */ |
774 | 774 | public static function process_get_shortcode( $atts, $return_array = false ) { |
775 | - if ( ! isset($atts['param']) ) { |
|
775 | + if ( ! isset( $atts['param'] ) ) { |
|
776 | 776 | return ''; |
777 | 777 | } |
778 | 778 | |
779 | - if ( strpos($atts['param'], '[') ) { |
|
780 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
781 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
779 | + if ( strpos( $atts['param'], '[' ) ) { |
|
780 | + $atts['param'] = str_replace( '[', '[', $atts['param'] ); |
|
781 | + $atts['param'] = str_replace( ']', ']', $atts['param'] ); |
|
782 | 782 | } |
783 | 783 | |
784 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
784 | + $new_value = FrmAppHelper::get_param( $atts['param'], '' ); |
|
785 | 785 | $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
786 | 786 | |
787 | 787 | if ( $new_value == '' ) { |
788 | - if ( ! isset($atts['prev_val']) ) { |
|
788 | + if ( ! isset( $atts['prev_val'] ) ) { |
|
789 | 789 | $atts['prev_val'] = ''; |
790 | 790 | } |
791 | 791 | |
792 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
792 | + $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val']; |
|
793 | 793 | } |
794 | 794 | |
795 | - if ( is_array($new_value) && ! $return_array ) { |
|
796 | - $new_value = implode(', ', $new_value); |
|
795 | + if ( is_array( $new_value ) && ! $return_array ) { |
|
796 | + $new_value = implode( ', ', $new_value ); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | return $new_value; |
@@ -806,12 +806,12 @@ discard block |
||
806 | 806 | $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts ); |
807 | 807 | |
808 | 808 | if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
809 | - $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
810 | - if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
811 | - if ( is_array($replace_with) ) { |
|
812 | - $replace_with = implode("\n", $replace_with); |
|
809 | + $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true; |
|
810 | + if ( apply_filters( 'frm_use_wpautop', $autop ) ) { |
|
811 | + if ( is_array( $replace_with ) ) { |
|
812 | + $replace_with = implode( "\n", $replace_with ); |
|
813 | 813 | } |
814 | - $replace_with = wpautop($replace_with); |
|
814 | + $replace_with = wpautop( $replace_with ); |
|
815 | 815 | } |
816 | 816 | unset( $autop ); |
817 | 817 | } else if ( is_array( $replace_with ) ) { |
@@ -833,14 +833,14 @@ discard block |
||
833 | 833 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
834 | 834 | |
835 | 835 | $field_types = array(); |
836 | - if ( in_array($type, $single_input) ) { |
|
836 | + if ( in_array( $type, $single_input ) ) { |
|
837 | 837 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
838 | - } else if ( in_array($type, $multiple_input) ) { |
|
838 | + } else if ( in_array( $type, $multiple_input ) ) { |
|
839 | 839 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
840 | - } else if ( in_array($type, $other_type) ) { |
|
840 | + } else if ( in_array( $type, $other_type ) ) { |
|
841 | 841 | self::field_types_for_input( $other_type, $field_selection, $field_types ); |
842 | - } else if ( isset( $field_selection[ $type ] ) ) { |
|
843 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
842 | + } else if ( isset( $field_selection[$type] ) ) { |
|
843 | + $field_types[$type] = $field_selection[$type]; |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | |
850 | 850 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
851 | 851 | foreach ( $inputs as $input ) { |
852 | - $field_types[ $input ] = $fields[ $input ]; |
|
853 | - unset($input); |
|
852 | + $field_types[$input] = $fields[$input]; |
|
853 | + unset( $input ); |
|
854 | 854 | } |
855 | 855 | } |
856 | 856 | |
@@ -895,21 +895,21 @@ discard block |
||
895 | 895 | // Check posted vals before checking saved values |
896 | 896 | |
897 | 897 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
898 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
898 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
899 | 899 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
900 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
900 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : ''; |
|
901 | 901 | } else { |
902 | - $other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ); |
|
902 | + $other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ); |
|
903 | 903 | } |
904 | 904 | return $other_val; |
905 | 905 | |
906 | - } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
906 | + } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
907 | 907 | // For normal fields |
908 | 908 | |
909 | 909 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
910 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
910 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : ''; |
|
911 | 911 | } else { |
912 | - $other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] ); |
|
912 | + $other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] ); |
|
913 | 913 | } |
914 | 914 | return $other_val; |
915 | 915 | } |
@@ -918,8 +918,8 @@ discard block |
||
918 | 918 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
919 | 919 | // Check if there is an "other" val in saved value and make sure the |
920 | 920 | // "other" val is not equal to the Other checkbox option |
921 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
922 | - $other_val = $field['value'][ $opt_key ]; |
|
921 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
922 | + $other_val = $field['value'][$opt_key]; |
|
923 | 923 | } |
924 | 924 | } else { |
925 | 925 | /** |
@@ -931,8 +931,8 @@ discard block |
||
931 | 931 | // Multi-select dropdowns - key is not preserved |
932 | 932 | if ( is_array( $field['value'] ) ) { |
933 | 933 | $o_key = array_search( $temp_val, $field['value'] ); |
934 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
935 | - unset( $field['value'][ $o_key ], $o_key ); |
|
934 | + if ( isset( $field['value'][$o_key] ) ) { |
|
935 | + unset( $field['value'][$o_key], $o_key ); |
|
936 | 936 | } |
937 | 937 | } else if ( $temp_val == $field['value'] ) { |
938 | 938 | // For radio and regular dropdowns |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | private static function set_other_name( $args, &$other_args ) { |
990 | 990 | //Set up name for other field |
991 | 991 | $other_args['name'] = str_replace( '[]', '', $args['field_name'] ); |
992 | - $other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']); |
|
992 | + $other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] ); |
|
993 | 993 | $other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']'; |
994 | 994 | |
995 | 995 | //Converts item_meta[field_id] => item_meta[other][field_id] and |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | // Count should only be greater than 3 if inside of a repeating section |
1016 | 1016 | if ( count( $temp_array ) > 3 ) { |
1017 | 1017 | $parent = str_replace( ']', '', $temp_array[1] ); |
1018 | - $pointer = str_replace( ']', '', $temp_array[2]); |
|
1018 | + $pointer = str_replace( ']', '', $temp_array[2] ); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | // Get text for "other" text field |
@@ -1134,15 +1134,15 @@ discard block |
||
1134 | 1134 | $replace_with[] = '[' . $new . ']'; |
1135 | 1135 | $replace[] = '[' . $old . ' '; |
1136 | 1136 | $replace_with[] = '[' . $new . ' '; |
1137 | - unset($old, $new); |
|
1137 | + unset( $old, $new ); |
|
1138 | 1138 | } |
1139 | 1139 | if ( is_array( $val ) ) { |
1140 | 1140 | foreach ( $val as $k => $v ) { |
1141 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1142 | - unset($k, $v); |
|
1141 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1142 | + unset( $k, $v ); |
|
1143 | 1143 | } |
1144 | 1144 | } else { |
1145 | - $val = str_replace($replace, $replace_with, $val); |
|
1145 | + $val = str_replace( $replace, $replace_with, $val ); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | return $val; |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | 'DC' => 'District of Columbia', |
1156 | 1156 | 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
1157 | 1157 | 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
1158 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
1158 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', |
|
1159 | 1159 | 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
1160 | 1160 | 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
1161 | 1161 | 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
@@ -1246,35 +1246,35 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
1249 | - $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
|
1249 | + $prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries(); |
|
1250 | 1250 | |
1251 | 1251 | $states = FrmFieldsHelper::get_us_states(); |
1252 | - $state_abv = array_keys($states); |
|
1253 | - sort($state_abv); |
|
1254 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1252 | + $state_abv = array_keys( $states ); |
|
1253 | + sort( $state_abv ); |
|
1254 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1255 | 1255 | |
1256 | - $states = array_values($states); |
|
1257 | - sort($states); |
|
1258 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1259 | - unset($state_abv, $states); |
|
1256 | + $states = array_values( $states ); |
|
1257 | + sort( $states ); |
|
1258 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1259 | + unset( $state_abv, $states ); |
|
1260 | 1260 | |
1261 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
1261 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
1262 | 1262 | __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
1263 | 1263 | __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
1264 | 1264 | __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
1265 | 1265 | ); |
1266 | 1266 | |
1267 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
1267 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
1268 | 1268 | __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
1269 | 1269 | __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
1270 | 1270 | ); |
1271 | 1271 | |
1272 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
1272 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
1273 | 1273 | __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
1274 | 1274 | __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
1275 | 1275 | ); |
1276 | 1276 | |
1277 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
1277 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
1278 | 1278 | __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
1279 | 1279 | __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
1280 | 1280 | ); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php if ( in_array( $field['type'], array( 'email', 'url', 'text' ) ) ) { ?> |
2 | -<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action('frm_field_input_html', $field) ?>/> |
|
2 | +<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>/> |
|
3 | 3 | <?php } else if ( $field['type'] == 'textarea' ) { ?> |
4 | 4 | <textarea name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php |
5 | 5 | if ( $field['max'] ) { |
6 | 6 | echo 'rows="' . esc_attr( $field['max'] ) . '" '; |
7 | 7 | } |
8 | -do_action('frm_field_input_html', $field); |
|
9 | -?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea> |
|
8 | +do_action( 'frm_field_input_html', $field ); |
|
9 | +?>><?php echo FrmAppHelper::esc_textarea( $field['value'] ) ?></textarea> |
|
10 | 10 | <?php |
11 | 11 | |
12 | 12 | } else if ( $field['type'] == 'radio' ) { |
@@ -17,29 +17,29 @@ discard block |
||
17 | 17 | <?php |
18 | 18 | } |
19 | 19 | |
20 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
20 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
21 | 21 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
22 | - } else if ( is_array($field['options']) ) { |
|
22 | + } else if ( is_array( $field['options'] ) ) { |
|
23 | 23 | foreach ( $field['options'] as $opt_key => $opt ) { |
24 | 24 | if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) { |
25 | 25 | continue; |
26 | 26 | } |
27 | 27 | |
28 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
29 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?> |
|
28 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
29 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); ?> |
|
30 | 30 | <div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php |
31 | 31 | |
32 | 32 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
33 | 33 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
34 | 34 | } |
35 | - $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' '; |
|
35 | + $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' '; |
|
36 | 36 | |
37 | 37 | $other_opt = false; |
38 | 38 | $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked ); |
39 | 39 | ?> |
40 | 40 | <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php |
41 | 41 | echo $checked; |
42 | - do_action('frm_field_input_html', $field); |
|
42 | + do_action( 'frm_field_input_html', $field ); |
|
43 | 43 | ?>/><?php |
44 | 44 | |
45 | 45 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
80 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
81 | 81 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
82 | 82 | } else if ( $field['options'] ) { |
83 | 83 | foreach ( $field['options'] as $opt_key => $opt ) { |
84 | - if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) { |
|
84 | + if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | |
88 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
89 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
90 | - $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : ''; |
|
88 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
89 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
90 | + $checked = FrmAppHelper::check_selected( $checked_values, $field_val ) ? ' checked="checked"' : ''; |
|
91 | 91 | |
92 | 92 | // Check if other opt, and get values for other field if needed |
93 | 93 | $other_opt = false; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
101 | 101 | } |
102 | 102 | |
103 | - ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php |
|
103 | + ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php |
|
104 | 104 | |
105 | 105 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
106 | 106 | echo ' ' . $opt . '</label>'; |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | } |
122 | 122 | } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) { |
123 | 123 | $frm_settings = FrmAppHelper::get_settings(); |
124 | - if ( ! empty($frm_settings->pubkey) ) { |
|
125 | - FrmFieldsHelper::display_recaptcha($field); |
|
124 | + if ( ! empty( $frm_settings->pubkey ) ) { |
|
125 | + FrmFieldsHelper::display_recaptcha( $field ); |
|
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) ); |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $read_only = false; |
4 | -if ( isset($field['post_field']) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) { |
|
4 | +if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) { |
|
5 | 5 | echo FrmProPost::get_category_dropdown( $field, array( 'location' => 'front', 'name' => $field_name, 'id' => $html_id ) ); |
6 | 6 | } else { |
7 | 7 | if ( FrmAppHelper::pro_is_installed() && FrmField::is_read_only( $field ) ) { |
8 | 8 | $read_only = true; |
9 | 9 | |
10 | 10 | echo FrmProDropdownFieldsController::get_hidden_fields_with_readonly_values( $field, $field_name, $html_id ); ?> |
11 | - <select <?php do_action('frm_field_input_html', $field) ?>> <?php |
|
11 | + <select <?php do_action( 'frm_field_input_html', $field ) ?>> <?php |
|
12 | 12 | |
13 | 13 | } else { ?> |
14 | - <select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action('frm_field_input_html', $field) ?>> |
|
14 | + <select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>> |
|
15 | 15 | <?php } |
16 | 16 | |
17 | 17 | $other_opt = $other_checked = false; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | } |
28 | 28 | ?> |
29 | - <option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo esc_html( $opt == '' ? ' ' : $opt ); ?></option> |
|
29 | + <option value="<?php echo esc_attr( $field_val ) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : ''; ?>><?php echo esc_html( $opt == '' ? ' ' : $opt ); ?></option> |
|
30 | 30 | <?php |
31 | 31 | } ?> |
32 | 32 | </select> |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( isset($field['post_field']) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) { |
|
3 | +if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' && FrmAppHelper::pro_is_installed() ) { |
|
4 | 4 | echo FrmProPost::get_category_dropdown( $field, array( 'name' => $field_name, 'id' => 'placeholder_id', 'location' => 'form_builder' ) ); |
5 | 5 | } else { ?> |
6 | 6 | <select name="<?php echo esc_attr( $field_name ) . ( FrmField::is_option_true( $field, 'multiple' ) ? '[]' : '' ); ?>" <?php |
7 | 7 | echo FrmField::is_option_true( $field, 'size' ) ? 'class="auto_width"' : ''; |
8 | 8 | echo FrmField::is_option_true( $field, 'multiple' ) ? ' multiple="multiple"' : ''; ?> > |
9 | 9 | <?php foreach ( $field['options'] as $opt_key => $opt ) { |
10 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
11 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
10 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
11 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
12 | 12 | $selected = ( $field['default_value'] == $field_val || FrmFieldsHelper::get_other_val( array( 'opt_key', 'field' ) ) ) ? ' selected="selected"' : ''; ?> |
13 | 13 | <option value="<?php echo esc_attr( $field_val ) ?>"<?php echo $selected ?>><?php echo esc_html( $opt ) ?> </option> |
14 | 14 | <?php } ?> |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | <?php |
27 | 27 | |
28 | 28 | if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { ?> |
29 | - <?php do_action('frm_add_multiple_opts_labels', $field); ?> |
|
30 | - <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count($field['options']) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
31 | - <?php FrmFieldsHelper::show_single_option($field); ?> |
|
29 | + <?php do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
30 | + <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
31 | + <?php FrmFieldsHelper::show_single_option( $field ); ?> |
|
32 | 32 | </ul> |
33 | 33 | <?php |
34 | 34 | } ?> |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php if ( in_array( $display['type'], array( 'text', 'website', 'email', 'url' ) ) ) { ?> |
2 | - <input type="text" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" value="<?php echo esc_attr( $field['default_value'] ); ?>" <?php echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '') . ';"' ) : ''; ?> class="dyn_default_value" /> |
|
2 | + <input type="text" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" value="<?php echo esc_attr( $field['default_value'] ); ?>" <?php echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : ''; ?> class="dyn_default_value" /> |
|
3 | 3 | <?php } else if ( $field['type'] == 'textarea' ) { ?> |
4 | 4 | <textarea name="<?php echo esc_attr( $field_name ) ?>" <?php |
5 | 5 | echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : ''; |
6 | - ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea(force_balance_tags($field['default_value'])); ?></textarea> |
|
6 | + ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea( force_balance_tags( $field['default_value'] ) ); ?></textarea> |
|
7 | 7 | |
8 | 8 | <?php |
9 | 9 | |
10 | 10 | } else if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
11 | - $field['default_value'] = maybe_unserialize($field['default_value']); |
|
12 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
11 | + $field['default_value'] = maybe_unserialize( $field['default_value'] ); |
|
12 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
13 | 13 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
14 | 14 | } else { |
15 | - do_action('frm_add_multiple_opts_labels', $field); ?> |
|
16 | - <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo (count($field['options']) > 10) ? ' frm_field_opts_list' : ''; ?>"> |
|
15 | + do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
16 | + <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
17 | 17 | <?php include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); ?> |
18 | 18 | </ul> |
19 | 19 | <?php |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | } else if ( $field['type'] == 'select' ) { |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/dropdown-field.php' ); |
23 | 23 | } else if ( $field['type'] == 'captcha' ) { |
24 | - if ( empty($frm_settings->pubkey) ) { ?> |
|
25 | - <div class="howto frm_no_captcha_text"><?php printf(__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>') ?></div> |
|
24 | + if ( empty( $frm_settings->pubkey ) ) { ?> |
|
25 | + <div class="howto frm_no_captcha_text"><?php printf( __( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Secret Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>' ) ?></div> |
|
26 | 26 | <?php |
27 | 27 | } ?> |
28 | 28 | <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ) ?>" class="recaptcha_placeholder" alt="reCaptcha"/> |