@@ -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,8 +7,8 @@ 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 | 14 | $values = self::get_default_field( $type ); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
| 26 | 26 | $values['field_options']['data_type'] = $setting; |
| 27 | 27 | } else { |
| 28 | - $values['field_options'][ $setting ] = 1; |
|
| 28 | + $values['field_options'][$setting] = 1; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | foreach ( $defaults as $opt => $default ) { |
| 130 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
| 130 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
| 131 | 131 | |
| 132 | 132 | if ( $check_post ) { |
| 133 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 133 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | unset( $opt, $default ); |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | * @param mixed $value |
| 174 | 174 | */ |
| 175 | 175 | private static function get_posted_field_setting( $setting, &$value ) { |
| 176 | - if ( isset( $_POST['field_options'][ $setting ] ) ) { |
|
| 177 | - $value = maybe_unserialize( $_POST['field_options'][ $setting ] ); |
|
| 176 | + if ( isset( $_POST['field_options'][$setting] ) ) { |
|
| 177 | + $value = maybe_unserialize( $_POST['field_options'][$setting] ); |
|
| 178 | 178 | if ( strpos( $setting, 'html' ) !== false ) { |
| 179 | 179 | // strip slashes from HTML but not regex |
| 180 | 180 | $value = stripslashes_deep( $value ); |
@@ -244,11 +244,11 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 246 | 246 | $values['form_id'] = $form_id; |
| 247 | - $values['options'] = maybe_serialize($field->options); |
|
| 248 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
| 247 | + $values['options'] = maybe_serialize( $field->options ); |
|
| 248 | + $values['default_value'] = maybe_serialize( $field->default_value ); |
|
| 249 | 249 | |
| 250 | 250 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 251 | - $values[ $col ] = $field->{$col}; |
|
| 251 | + $values[$col] = $field->{$col}; |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | $defaults = array( |
| 270 | 270 | 'unique_msg' => array( |
| 271 | 271 | 'full' => $default_settings['unique_msg'], |
| 272 | - 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ), |
|
| 272 | + 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ), |
|
| 273 | 273 | ), |
| 274 | 274 | 'invalid' => array( |
| 275 | 275 | 'full' => __( 'This field is invalid', 'formidable' ), |
| 276 | - 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ), |
|
| 276 | + 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ), |
|
| 277 | 277 | ), |
| 278 | 278 | 'blank' => array( |
| 279 | 279 | 'full' => $frm_settings->blank_msg, |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | 288 | $msg = FrmField::get_option( $field, $error ); |
| 289 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 289 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 290 | 290 | $msg = do_shortcode( $msg ); |
| 291 | 291 | return $msg; |
| 292 | 292 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $default_html = apply_filters( 'frm_other_custom_html', '', $type ); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
| 308 | + return apply_filters( 'frm_custom_html', $default_html, $type ); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | // Get string for Other text field, if needed |
| 422 | 422 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
| 423 | 423 | |
| 424 | - $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"' : ''; |
|
| 424 | + $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"' : ''; |
|
| 425 | 425 | |
| 426 | 426 | // If this is an "Other" option, get the HTML for it |
| 427 | 427 | if ( self::is_other_opt( $opt_key ) ) { |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | * @return string |
| 453 | 453 | */ |
| 454 | 454 | public static function get_term_link( $tax_id ) { |
| 455 | - $tax = get_taxonomy($tax_id); |
|
| 455 | + $tax = get_taxonomy( $tax_id ); |
|
| 456 | 456 | if ( ! $tax ) { |
| 457 | 457 | return ''; |
| 458 | 458 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
| 462 | 462 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
| 463 | 463 | ); |
| 464 | - unset($tax); |
|
| 464 | + unset( $tax ); |
|
| 465 | 465 | |
| 466 | 466 | return $link; |
| 467 | 467 | } |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | $hide_opt = self::get_value_for_comparision( $hide_opt ); |
| 471 | 471 | $observed_value = self::get_value_for_comparision( $observed_value ); |
| 472 | 472 | |
| 473 | - if ( is_array($observed_value) ) { |
|
| 474 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 473 | + if ( is_array( $observed_value ) ) { |
|
| 474 | + return self::array_value_condition( $observed_value, $cond, $hide_opt ); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | $m = false; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | } else if ( $cond == '<' ) { |
| 485 | 485 | $m = $observed_value < $hide_opt; |
| 486 | 486 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 487 | - $m = stripos($observed_value, $hide_opt); |
|
| 487 | + $m = stripos( $observed_value, $hide_opt ); |
|
| 488 | 488 | if ( $cond == 'not LIKE' ) { |
| 489 | 489 | $m = ( $m === false ) ? true : false; |
| 490 | 490 | } else { |
@@ -510,23 +510,23 @@ discard block |
||
| 510 | 510 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
| 511 | 511 | $m = false; |
| 512 | 512 | if ( $cond == '==' ) { |
| 513 | - if ( is_array($hide_opt) ) { |
|
| 514 | - $m = array_intersect($hide_opt, $observed_value); |
|
| 515 | - $m = empty($m) ? false : true; |
|
| 513 | + if ( is_array( $hide_opt ) ) { |
|
| 514 | + $m = array_intersect( $hide_opt, $observed_value ); |
|
| 515 | + $m = empty( $m ) ? false : true; |
|
| 516 | 516 | } else { |
| 517 | - $m = in_array($hide_opt, $observed_value); |
|
| 517 | + $m = in_array( $hide_opt, $observed_value ); |
|
| 518 | 518 | } |
| 519 | 519 | } else if ( $cond == '!=' ) { |
| 520 | - $m = ! in_array($hide_opt, $observed_value); |
|
| 520 | + $m = ! in_array( $hide_opt, $observed_value ); |
|
| 521 | 521 | } else if ( $cond == '>' ) { |
| 522 | - $min = min($observed_value); |
|
| 522 | + $min = min( $observed_value ); |
|
| 523 | 523 | $m = $min > $hide_opt; |
| 524 | 524 | } else if ( $cond == '<' ) { |
| 525 | - $max = max($observed_value); |
|
| 525 | + $max = max( $observed_value ); |
|
| 526 | 526 | $m = $max < $hide_opt; |
| 527 | 527 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 528 | 528 | foreach ( $observed_value as $ob ) { |
| 529 | - $m = strpos($ob, $hide_opt); |
|
| 529 | + $m = strpos( $ob, $hide_opt ); |
|
| 530 | 530 | if ( $m !== false ) { |
| 531 | 531 | $m = true; |
| 532 | 532 | break; |
@@ -547,20 +547,20 @@ discard block |
||
| 547 | 547 | * @return string |
| 548 | 548 | */ |
| 549 | 549 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
| 550 | - if ( strpos($value, '[sitename]') !== false ) { |
|
| 550 | + if ( strpos( $value, '[sitename]' ) !== false ) { |
|
| 551 | 551 | $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
| 552 | - $value = str_replace('[sitename]', $new_value, $value); |
|
| 552 | + $value = str_replace( '[sitename]', $new_value, $value ); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 556 | - $value = do_shortcode($value); |
|
| 555 | + $value = apply_filters( 'frm_content', $value, $form, $entry ); |
|
| 556 | + $value = do_shortcode( $value ); |
|
| 557 | 557 | |
| 558 | 558 | return $value; |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | public static function get_shortcodes( $content, $form_id ) { |
| 562 | 562 | if ( FrmAppHelper::pro_is_installed() ) { |
| 563 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 563 | + return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); |
|
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $fields = FrmField::getAll( array( |
@@ -568,9 +568,9 @@ discard block |
||
| 568 | 568 | 'fi.type not' => FrmField::no_save_fields(), |
| 569 | 569 | ) ); |
| 570 | 570 | |
| 571 | - $tagregexp = self::allowed_shortcodes($fields); |
|
| 571 | + $tagregexp = self::allowed_shortcodes( $fields ); |
|
| 572 | 572 | |
| 573 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 573 | + preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER ); |
|
| 574 | 574 | |
| 575 | 575 | return $matches; |
| 576 | 576 | } |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $tagregexp[] = $field->field_key; |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | - $tagregexp = implode('|', $tagregexp); |
|
| 586 | + $tagregexp = implode( '|', $tagregexp ); |
|
| 587 | 587 | return $tagregexp; |
| 588 | 588 | } |
| 589 | 589 | |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | continue; |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 596 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 597 | 597 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 598 | 598 | |
| 599 | 599 | $atts['entry'] = $entry; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | $replace_with = self::get_value_for_shortcode( $atts ); |
| 602 | 602 | |
| 603 | 603 | if ( $replace_with !== null ) { |
| 604 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 604 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | unset( $atts, $replace_with ); |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | |
| 629 | 629 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
| 630 | 630 | |
| 631 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 632 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 631 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 632 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 633 | 633 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
| 634 | 634 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 635 | 635 | } elseif ( $clean_tag == 'user_agent' ) { |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | if ( isset( $atts['format'] ) ) { |
| 659 | 659 | $time_format = ' '; |
| 660 | 660 | } else { |
| 661 | - $atts['format'] = get_option('date_format'); |
|
| 661 | + $atts['format'] = get_option( 'date_format' ); |
|
| 662 | 662 | $time_format = ''; |
| 663 | 663 | } |
| 664 | 664 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | $new_value = ''; |
| 713 | 713 | switch ( $tag ) { |
| 714 | 714 | case 'admin_email': |
| 715 | - $new_value = get_option('admin_email'); |
|
| 715 | + $new_value = get_option( 'admin_email' ); |
|
| 716 | 716 | break; |
| 717 | 717 | case 'siteurl': |
| 718 | 718 | $new_value = FrmAppHelper::site_url(); |
@@ -737,28 +737,28 @@ discard block |
||
| 737 | 737 | * @return string|array |
| 738 | 738 | */ |
| 739 | 739 | public static function process_get_shortcode( $atts, $return_array = false ) { |
| 740 | - if ( ! isset($atts['param']) ) { |
|
| 740 | + if ( ! isset( $atts['param'] ) ) { |
|
| 741 | 741 | return ''; |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | - if ( strpos($atts['param'], '[') ) { |
|
| 745 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 746 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 744 | + if ( strpos( $atts['param'], '[' ) ) { |
|
| 745 | + $atts['param'] = str_replace( '[', '[', $atts['param'] ); |
|
| 746 | + $atts['param'] = str_replace( ']', ']', $atts['param'] ); |
|
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | $new_value = FrmAppHelper::get_param( $atts['param'], '', 'get', 'sanitize_text_field' ); |
| 750 | 750 | $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
| 751 | 751 | |
| 752 | 752 | if ( $new_value == '' ) { |
| 753 | - if ( ! isset($atts['prev_val']) ) { |
|
| 753 | + if ( ! isset( $atts['prev_val'] ) ) { |
|
| 754 | 754 | $atts['prev_val'] = ''; |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 757 | + $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val']; |
|
| 758 | 758 | } |
| 759 | 759 | |
| 760 | - if ( is_array($new_value) && ! $return_array ) { |
|
| 761 | - $new_value = implode(', ', $new_value); |
|
| 760 | + if ( is_array( $new_value ) && ! $return_array ) { |
|
| 761 | + $new_value = implode( ', ', $new_value ); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | return $new_value; |
@@ -799,9 +799,9 @@ discard block |
||
| 799 | 799 | 'size' => 96, |
| 800 | 800 | ); |
| 801 | 801 | |
| 802 | - $args = wp_parse_args($args, $defaults); |
|
| 802 | + $args = wp_parse_args( $args, $defaults ); |
|
| 803 | 803 | |
| 804 | - $user = get_userdata($user_id); |
|
| 804 | + $user = get_userdata( $user_id ); |
|
| 805 | 805 | $info = ''; |
| 806 | 806 | |
| 807 | 807 | if ( $user ) { |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | } elseif ( $user_info == 'author_link' ) { |
| 811 | 811 | $info = get_author_posts_url( $user_id ); |
| 812 | 812 | } else { |
| 813 | - $info = isset($user->$user_info) ? $user->$user_info : ''; |
|
| 813 | + $info = isset( $user->$user_info ) ? $user->$user_info : ''; |
|
| 814 | 814 | } |
| 815 | 815 | |
| 816 | 816 | if ( 'display_name' === $user_info && empty( $info ) && ! $args['blank'] ) { |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | if ( $args['link'] ) { |
| 822 | - $info = '<a href="' . esc_url( admin_url('user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>'; |
|
| 822 | + $info = '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ) . '">' . $info . '</a>'; |
|
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | return $info; |
@@ -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 | |
@@ -897,21 +897,21 @@ discard block |
||
| 897 | 897 | // Check posted vals before checking saved values |
| 898 | 898 | |
| 899 | 899 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 900 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 900 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
| 901 | 901 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 902 | - $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 ] ) : ''; |
|
| 902 | + $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] ) : ''; |
|
| 903 | 903 | } else { |
| 904 | - $other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ); |
|
| 904 | + $other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ); |
|
| 905 | 905 | } |
| 906 | 906 | return $other_val; |
| 907 | 907 | |
| 908 | - } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 908 | + } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
| 909 | 909 | // For normal fields |
| 910 | 910 | |
| 911 | 911 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 912 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 912 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : ''; |
|
| 913 | 913 | } else { |
| 914 | - $other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] ); |
|
| 914 | + $other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] ); |
|
| 915 | 915 | } |
| 916 | 916 | return $other_val; |
| 917 | 917 | } |
@@ -920,8 +920,8 @@ discard block |
||
| 920 | 920 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
| 921 | 921 | // Check if there is an "other" val in saved value and make sure the |
| 922 | 922 | // "other" val is not equal to the Other checkbox option |
| 923 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 924 | - $other_val = $field['value'][ $opt_key ]; |
|
| 923 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 924 | + $other_val = $field['value'][$opt_key]; |
|
| 925 | 925 | } |
| 926 | 926 | } else { |
| 927 | 927 | /** |
@@ -933,8 +933,8 @@ discard block |
||
| 933 | 933 | // Multi-select dropdowns - key is not preserved |
| 934 | 934 | if ( is_array( $field['value'] ) ) { |
| 935 | 935 | $o_key = array_search( $temp_val, $field['value'] ); |
| 936 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 937 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 936 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 937 | + unset( $field['value'][$o_key], $o_key ); |
|
| 938 | 938 | } |
| 939 | 939 | } else if ( $temp_val == $field['value'] ) { |
| 940 | 940 | // For radio and regular dropdowns |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | private static function set_other_name( $args, &$other_args ) { |
| 992 | 992 | //Set up name for other field |
| 993 | 993 | $other_args['name'] = str_replace( '[]', '', $args['field_name'] ); |
| 994 | - $other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']); |
|
| 994 | + $other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] ); |
|
| 995 | 995 | $other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']'; |
| 996 | 996 | |
| 997 | 997 | //Converts item_meta[field_id] => item_meta[other][field_id] and |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | // Count should only be greater than 3 if inside of a repeating section |
| 1019 | 1019 | if ( count( $temp_array ) > 3 ) { |
| 1020 | 1020 | $parent = str_replace( ']', '', $temp_array[1] ); |
| 1021 | - $pointer = str_replace( ']', '', $temp_array[2]); |
|
| 1021 | + $pointer = str_replace( ']', '', $temp_array[2] ); |
|
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | // Get text for "other" text field |
@@ -1152,15 +1152,15 @@ discard block |
||
| 1152 | 1152 | $replace_with[] = '[' . $new . ']'; |
| 1153 | 1153 | $replace[] = '[' . $old . ' '; |
| 1154 | 1154 | $replace_with[] = '[' . $new . ' '; |
| 1155 | - unset($old, $new); |
|
| 1155 | + unset( $old, $new ); |
|
| 1156 | 1156 | } |
| 1157 | 1157 | if ( is_array( $val ) ) { |
| 1158 | 1158 | foreach ( $val as $k => $v ) { |
| 1159 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1160 | - unset($k, $v); |
|
| 1159 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1160 | + unset( $k, $v ); |
|
| 1161 | 1161 | } |
| 1162 | 1162 | } else { |
| 1163 | - $val = str_replace($replace, $replace_with, $val); |
|
| 1163 | + $val = str_replace( $replace, $replace_with, $val ); |
|
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | 1166 | return $val; |
@@ -1227,19 +1227,19 @@ discard block |
||
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | 1229 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1230 | - $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
|
| 1230 | + $prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries(); |
|
| 1231 | 1231 | |
| 1232 | 1232 | $states = FrmFieldsHelper::get_us_states(); |
| 1233 | - $state_abv = array_keys($states); |
|
| 1234 | - sort($state_abv); |
|
| 1235 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1233 | + $state_abv = array_keys( $states ); |
|
| 1234 | + sort( $state_abv ); |
|
| 1235 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1236 | 1236 | |
| 1237 | - $states = array_values($states); |
|
| 1238 | - sort($states); |
|
| 1239 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1240 | - unset($state_abv, $states); |
|
| 1237 | + $states = array_values( $states ); |
|
| 1238 | + sort( $states ); |
|
| 1239 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1240 | + unset( $state_abv, $states ); |
|
| 1241 | 1241 | |
| 1242 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
| 1242 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
| 1243 | 1243 | __( 'Under 18', 'formidable' ), |
| 1244 | 1244 | __( '18-24', 'formidable' ), |
| 1245 | 1245 | __( '25-34', 'formidable' ), |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | __( 'Prefer Not to Answer', 'formidable' ), |
| 1251 | 1251 | ); |
| 1252 | 1252 | |
| 1253 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
| 1253 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
| 1254 | 1254 | __( 'Very Satisfied', 'formidable' ), |
| 1255 | 1255 | __( 'Satisfied', 'formidable' ), |
| 1256 | 1256 | __( 'Neutral', 'formidable' ), |
@@ -1259,7 +1259,7 @@ discard block |
||
| 1259 | 1259 | __( 'N/A', 'formidable' ), |
| 1260 | 1260 | ); |
| 1261 | 1261 | |
| 1262 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
| 1262 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
| 1263 | 1263 | __( 'Very Important', 'formidable' ), |
| 1264 | 1264 | __( 'Important', 'formidable' ), |
| 1265 | 1265 | __( 'Neutral', 'formidable' ), |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | __( 'N/A', 'formidable' ), |
| 1269 | 1269 | ); |
| 1270 | 1270 | |
| 1271 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
| 1271 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
| 1272 | 1272 | __( 'Strongly Agree', 'formidable' ), |
| 1273 | 1273 | __( 'Agree', 'formidable' ), |
| 1274 | 1274 | __( 'Neutral', 'formidable' ), |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | |
| 62 | 62 | // validate the url format |
| 63 | 63 | if ( ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) { |
| 64 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 64 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $errors; |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * @param array $atts |
| 42 | 42 | */ |
| 43 | 43 | private function _set( $param, $atts ) { |
| 44 | - if ( isset( $atts[ $param ] ) ) { |
|
| 45 | - $this->{$param} = $atts[ $param ]; |
|
| 44 | + if ( isset( $atts[$param] ) ) { |
|
| 45 | + $this->{$param} = $atts[$param]; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | $exclude = array( 'field_obj', 'html' ); |
| 81 | 81 | |
| 82 | 82 | foreach ( $exclude as $ex ) { |
| 83 | - if ( isset( $atts[ $ex ] ) ) { |
|
| 84 | - unset( $this->pass_args[ $ex ] ); |
|
| 83 | + if ( isset( $atts[$ex] ) ) { |
|
| 84 | + unset( $this->pass_args[$ex] ); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | * @param array $set |
| 94 | 94 | */ |
| 95 | 95 | private function set_from_field( $atts, $set ) { |
| 96 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
| 97 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
| 96 | + if ( isset( $atts[$set['param']] ) ) { |
|
| 97 | + $this->{$set['param']} = $atts[$set['param']]; |
|
| 98 | 98 | } else { |
| 99 | 99 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
| 100 | 100 | } |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | $this->html = str_replace( 'field_[key]', $this->html_id, $this->html ); |
| 141 | 141 | |
| 142 | 142 | //replace [key] |
| 143 | - $this->html = str_replace( '[key]', $this->field_obj->get_field_column('field_key'), $this->html ); |
|
| 143 | + $this->html = str_replace( '[key]', $this->field_obj->get_field_column( 'field_key' ), $this->html ); |
|
| 144 | 144 | |
| 145 | 145 | //replace [field_name] |
| 146 | - $this->html = str_replace('[field_name]', $this->field_obj->get_field_column('name'), $this->html ); |
|
| 146 | + $this->html = str_replace( '[field_name]', $this->field_obj->get_field_column( 'name' ), $this->html ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * @since 3.0 |
| 151 | 151 | */ |
| 152 | 152 | private function replace_required_label_shortcode() { |
| 153 | - $required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column('required_indicator') : ''; |
|
| 153 | + $required = FrmField::is_required( $this->field_obj->get_field() ) ? $this->field_obj->get_field_column( 'required_indicator' ) : ''; |
|
| 154 | 154 | FrmShortcodeHelper::remove_inline_conditions( ! empty( $required ), 'required_label', $required, $this->html ); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | private function replace_description_shortcode() { |
| 175 | 175 | $this->maybe_add_description_id(); |
| 176 | - $description = $this->field_obj->get_field_column('description'); |
|
| 176 | + $description = $this->field_obj->get_field_column( 'description' ); |
|
| 177 | 177 | FrmShortcodeHelper::remove_inline_conditions( ( $description && $description != '' ), 'description', $description, $this->html ); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @since 3.0 |
| 184 | 184 | */ |
| 185 | 185 | private function maybe_add_description_id() { |
| 186 | - $description = $this->field_obj->get_field_column('description'); |
|
| 186 | + $description = $this->field_obj->get_field_column( 'description' ); |
|
| 187 | 187 | if ( $description != '' ) { |
| 188 | 188 | |
| 189 | 189 | preg_match_all( '/(\[if\s+description\])(.*?)(\[\/if\s+description\])/mis', $this->html, $inner_html ); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @since 3.0 |
| 202 | 202 | */ |
| 203 | 203 | private function replace_error_shortcode() { |
| 204 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
| 204 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
| 205 | 205 | FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html ); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $this->html .= "\n"; |
| 238 | 238 | |
| 239 | 239 | // Stop html filtering on confirmation field to prevent loop |
| 240 | - if ( $this->field_obj->get_field_column('conf_field') != 'stop' ) { |
|
| 240 | + if ( $this->field_obj->get_field_column( 'conf_field' ) != 'stop' ) { |
|
| 241 | 241 | $this->filter_for_more_shortcodes(); |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | * @since 3.0 |
| 275 | 275 | */ |
| 276 | 276 | private function replace_shortcodes_with_atts() { |
| 277 | - preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 277 | + preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
|
| 278 | 278 | |
| 279 | 279 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 280 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 280 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 281 | 281 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 282 | 282 | |
| 283 | 283 | $replace_with = ''; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
| 291 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | private function prepare_input_shortcode_atts( $shortcode_atts ) { |
| 311 | 311 | if ( isset( $shortcode_atts['opt'] ) ) { |
| 312 | - $shortcode_atts['opt']--; |
|
| 312 | + $shortcode_atts['opt'] --; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $field_class = isset( $shortcode_atts['class'] ) ? $shortcode_atts['class'] : ''; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | private function add_class_to_label() { |
| 334 | 334 | $label_class = $this->field_obj->get_label_class(); |
| 335 | 335 | $this->html = str_replace( '[label_position]', $label_class, $this->html ); |
| 336 | - if ( $this->field_obj->get_field_column('label') == 'inside' && $this->field_obj->get_field_column('value') != '' ) { |
|
| 336 | + if ( $this->field_obj->get_field_column( 'label' ) == 'inside' && $this->field_obj->get_field_column( 'value' ) != '' ) { |
|
| 337 | 337 | $this->html = str_replace( 'frm_primary_label', 'frm_primary_label frm_visible', $this->html ); |
| 338 | 338 | } |
| 339 | 339 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | private function add_field_div_classes() { |
| 357 | 357 | $classes = $this->get_field_div_classes(); |
| 358 | 358 | |
| 359 | - if ( $this->field_obj->get_field_column('type') == 'html' && strpos( $this->html, '[error_class]' ) === false ) { |
|
| 359 | + if ( $this->field_obj->get_field_column( 'type' ) == 'html' && strpos( $this->html, '[error_class]' ) === false ) { |
|
| 360 | 360 | // there is no error_class shortcode for HTML fields |
| 361 | 361 | $this->html = str_replace( 'class="frm_form_field', 'class="frm_form_field ' . $classes, $this->html ); |
| 362 | 362 | } |
@@ -373,18 +373,18 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | private function get_field_div_classes() { |
| 375 | 375 | // Add error class |
| 376 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
| 376 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
| 377 | 377 | |
| 378 | 378 | // Add label position class |
| 379 | 379 | $settings = $this->field_obj->display_field_settings(); |
| 380 | 380 | if ( isset( $settings['label_position'] ) && $settings['label_position'] ) { |
| 381 | - $classes .= ' frm_' . $this->field_obj->get_field_column('label') . '_container'; |
|
| 381 | + $classes .= ' frm_' . $this->field_obj->get_field_column( 'label' ) . '_container'; |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | // Add CSS layout classes |
| 385 | - $extra_classes = $this->field_obj->get_field_column('classes'); |
|
| 385 | + $extra_classes = $this->field_obj->get_field_column( 'classes' ); |
|
| 386 | 386 | if ( ! empty( $extra_classes ) ) { |
| 387 | - if ( ! strpos( $this->html, 'frm_form_field ') ) { |
|
| 387 | + if ( ! strpos( $this->html, 'frm_form_field ' ) ) { |
|
| 388 | 388 | $classes .= ' frm_form_field'; |
| 389 | 389 | } |
| 390 | 390 | $classes .= ' ' . $extra_classes; |