@@ -76,10 +76,10 @@ |
||
| 76 | 76 | foreach ( $pro_fields as $field_key => $field_type ) { |
| 77 | 77 | |
| 78 | 78 | if ( isset( $field_type['section'] ) ) { |
| 79 | - if ( ! isset( $field_sections[ $field_type['section'] ] ) ) { |
|
| 80 | - $field_sections[ $field_type['section'] ] = array(); |
|
| 79 | + if ( ! isset( $field_sections[$field_type['section']] ) ) { |
|
| 80 | + $field_sections[$field_type['section']] = array(); |
|
| 81 | 81 | } |
| 82 | - $field_sections[ $field_type['section'] ][ $field_key ] = $field_type; |
|
| 82 | + $field_sections[$field_type['section']][$field_key] = $field_type; |
|
| 83 | 83 | continue; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | 'fill' => '#4d4d4d', |
| 249 | 249 | 'orange' => '#f05a24', |
| 250 | 250 | ); |
| 251 | - $atts = array_merge( $defaults, $atts ); |
|
| 251 | + $atts = array_merge( $defaults, $atts ); |
|
| 252 | 252 | |
| 253 | 253 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '"> |
| 254 | 254 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | * @return string |
| 537 | 537 | */ |
| 538 | 538 | public static function get_server_value( $value ) { |
| 539 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
| 539 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | /** |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | $ip = ''; |
| 571 | 571 | |
| 572 | 572 | foreach ( $ip_options as $key ) { |
| 573 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
| 573 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
| 574 | 574 | continue; |
| 575 | 575 | } |
| 576 | 576 | |
@@ -639,10 +639,10 @@ discard block |
||
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | if ( $src === 'get' ) { |
| 642 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
| 643 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 642 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
| 643 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 644 | 644 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 645 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
| 645 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
| 646 | 646 | } |
| 647 | 647 | self::sanitize_value( $sanitize, $value ); |
| 648 | 648 | } else { |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | $p = trim( $p, ']' ); |
| 666 | - $value = isset( $value[ $p ] ) ? $value[ $p ] : $default; |
|
| 666 | + $value = isset( $value[$p] ) ? $value[$p] : $default; |
|
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
@@ -728,26 +728,26 @@ discard block |
||
| 728 | 728 | 'sanitize' => 'sanitize_text_field', |
| 729 | 729 | 'serialized' => false, |
| 730 | 730 | ); |
| 731 | - $args = wp_parse_args( $args, $defaults ); |
|
| 731 | + $args = wp_parse_args( $args, $defaults ); |
|
| 732 | 732 | |
| 733 | 733 | $value = $args['default']; |
| 734 | 734 | if ( $args['type'] === 'get' ) { |
| 735 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
| 735 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
| 736 | 736 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 737 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
| 737 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
| 738 | 738 | } |
| 739 | 739 | } elseif ( $args['type'] === 'post' ) { |
| 740 | - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 740 | + if ( isset( $_POST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 741 | 741 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 742 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
| 742 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
| 743 | 743 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
| 744 | 744 | self::unserialize_or_decode( $value ); |
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | - } elseif ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
| 747 | + } elseif ( isset( $_REQUEST[$args['param']] ) ) { |
|
| 748 | 748 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 749 | 749 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 750 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
| 750 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | self::sanitize_value( $args['sanitize'], $value ); |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | if ( is_array( $value ) ) { |
| 795 | 795 | $temp_values = $value; |
| 796 | 796 | foreach ( $temp_values as $k => $v ) { |
| 797 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
| 797 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
| 798 | 798 | } |
| 799 | 799 | return; |
| 800 | 800 | } |
@@ -805,8 +805,8 @@ discard block |
||
| 805 | 805 | public static function sanitize_request( $sanitize_method, &$values ) { |
| 806 | 806 | $temp_values = $values; |
| 807 | 807 | foreach ( $temp_values as $k => $val ) { |
| 808 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
| 809 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
| 808 | + if ( isset( $sanitize_method[$k] ) ) { |
|
| 809 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
| 810 | 810 | } |
| 811 | 811 | } |
| 812 | 812 | } |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | if ( is_array( $value ) ) { |
| 867 | 867 | $temp_values = $value; |
| 868 | 868 | foreach ( $temp_values as $k => $v ) { |
| 869 | - self::decode_specialchars( $value[ $k ] ); |
|
| 869 | + self::decode_specialchars( $value[$k] ); |
|
| 870 | 870 | } |
| 871 | 871 | } else { |
| 872 | 872 | self::decode_amp( $value ); |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | * @return array |
| 1002 | 1002 | */ |
| 1003 | 1003 | public static function add_allowed_submit_button_tags( $allowed_html ) { |
| 1004 | - $allowed_html['input'] = array( |
|
| 1004 | + $allowed_html['input'] = array( |
|
| 1005 | 1005 | 'type' => true, |
| 1006 | 1006 | 'value' => true, |
| 1007 | 1007 | 'formnovalidate' => true, |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | $allowed_html = $html; |
| 1025 | 1025 | } elseif ( ! empty( $allowed ) ) { |
| 1026 | 1026 | foreach ( (array) $allowed as $a ) { |
| 1027 | - $allowed_html[ $a ] = isset( $html[ $a ] ) ? $html[ $a ] : array(); |
|
| 1027 | + $allowed_html[$a] = isset( $html[$a] ) ? $html[$a] : array(); |
|
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | 1030 | |
@@ -1208,8 +1208,8 @@ discard block |
||
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | global $wp_query; |
| 1211 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
| 1212 | - $value = $wp_query->query_vars[ $param ]; |
|
| 1211 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
| 1212 | + $value = $wp_query->query_vars[$param]; |
|
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | return $value; |
@@ -1240,9 +1240,9 @@ discard block |
||
| 1240 | 1240 | 'frm_keyalt_icon' => 'frm_key_icon', |
| 1241 | 1241 | 'frm_keyalt_solid_icon' => 'frm_key_solid_icon', |
| 1242 | 1242 | ); |
| 1243 | - if ( isset( $deprecated[ $icon ] ) ) { |
|
| 1244 | - $icon = $deprecated[ $icon ]; |
|
| 1245 | - $class = str_replace( $icon, $deprecated[ $icon ], $class ); |
|
| 1243 | + if ( isset( $deprecated[$icon] ) ) { |
|
| 1244 | + $icon = $deprecated[$icon]; |
|
| 1245 | + $class = str_replace( $icon, $deprecated[$icon], $class ); |
|
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | if ( $icon === $class ) { |
@@ -1364,7 +1364,7 @@ discard block |
||
| 1364 | 1364 | * @return string|void |
| 1365 | 1365 | */ |
| 1366 | 1366 | public static function array_to_html_params( $atts, $echo = false ) { |
| 1367 | - $callback = function () use ( $atts ) { |
|
| 1367 | + $callback = function() use ( $atts ) { |
|
| 1368 | 1368 | if ( $atts ) { |
| 1369 | 1369 | foreach ( $atts as $key => $value ) { |
| 1370 | 1370 | echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
@@ -1542,7 +1542,7 @@ discard block |
||
| 1542 | 1542 | 'value' => false, |
| 1543 | 1543 | 'class' => '', |
| 1544 | 1544 | ); |
| 1545 | - $atts = array_merge( $defaults, $atts ); |
|
| 1545 | + $atts = array_merge( $defaults, $atts ); |
|
| 1546 | 1546 | |
| 1547 | 1547 | if ( $atts['input_id'] === 'template' && empty( $atts['tosearch'] ) ) { |
| 1548 | 1548 | $atts['tosearch'] = 'frm-card'; |
@@ -1618,7 +1618,7 @@ discard block |
||
| 1618 | 1618 | 'new_file_path' => self::plugin_path() . '/js', |
| 1619 | 1619 | ) |
| 1620 | 1620 | ); |
| 1621 | - $new_file = new FrmCreateFile( $file_atts ); |
|
| 1621 | + $new_file = new FrmCreateFile( $file_atts ); |
|
| 1622 | 1622 | |
| 1623 | 1623 | $files = array( |
| 1624 | 1624 | self::plugin_path() . '/js/formidable.min.js', |
@@ -1832,8 +1832,8 @@ discard block |
||
| 1832 | 1832 | */ |
| 1833 | 1833 | private static function get_dropdown_value_and_label_from_option( $option, $key, $args ) { |
| 1834 | 1834 | if ( is_array( $option ) ) { |
| 1835 | - $value = isset( $option[ $args['value_key'] ] ) ? $option[ $args['value_key'] ] : ''; |
|
| 1836 | - $label = isset( $option[ $args['label_key'] ] ) ? $option[ $args['label_key'] ] : ''; |
|
| 1835 | + $value = isset( $option[$args['value_key']] ) ? $option[$args['value_key']] : ''; |
|
| 1836 | + $label = isset( $option[$args['label_key']] ) ? $option[$args['label_key']] : ''; |
|
| 1837 | 1837 | } else { |
| 1838 | 1838 | $value = $key; |
| 1839 | 1839 | $label = $option; |
@@ -2216,8 +2216,8 @@ discard block |
||
| 2216 | 2216 | return $error; |
| 2217 | 2217 | } |
| 2218 | 2218 | |
| 2219 | - $nonce_value = $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
| 2220 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 2219 | + $nonce_value = $_REQUEST && isset( $_REQUEST[$nonce_name] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
| 2220 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 2221 | 2221 | $frm_settings = self::get_settings(); |
| 2222 | 2222 | $error = $frm_settings->admin_permission; |
| 2223 | 2223 | } |
@@ -2253,7 +2253,7 @@ discard block |
||
| 2253 | 2253 | } else { |
| 2254 | 2254 | foreach ( $value as $k => $v ) { |
| 2255 | 2255 | if ( ! is_array( $v ) ) { |
| 2256 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
| 2256 | + $value[$k] = call_user_func( $original_function, $v ); |
|
| 2257 | 2257 | } |
| 2258 | 2258 | } |
| 2259 | 2259 | } |
@@ -2294,7 +2294,7 @@ discard block |
||
| 2294 | 2294 | if ( is_array( $value ) ) { |
| 2295 | 2295 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
| 2296 | 2296 | } elseif ( $keys === 'keep' ) { |
| 2297 | - $return[ $key ] = $value; |
|
| 2297 | + $return[$key] = $value; |
|
| 2298 | 2298 | } else { |
| 2299 | 2299 | $return[] = $value; |
| 2300 | 2300 | } |
@@ -2369,11 +2369,11 @@ discard block |
||
| 2369 | 2369 | } |
| 2370 | 2370 | |
| 2371 | 2371 | $ver = $default; |
| 2372 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
| 2372 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
| 2373 | 2373 | return $ver; |
| 2374 | 2374 | } |
| 2375 | 2375 | |
| 2376 | - $query = $wp_scripts->registered[ $handle ]; |
|
| 2376 | + $query = $wp_scripts->registered[$handle]; |
|
| 2377 | 2377 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
| 2378 | 2378 | $ver = $query->ver; |
| 2379 | 2379 | } |
@@ -2389,7 +2389,7 @@ discard block |
||
| 2389 | 2389 | * @return string|null |
| 2390 | 2390 | */ |
| 2391 | 2391 | public static function js_redirect( $url, $echo = false ) { |
| 2392 | - $callback = function () use ( $url ) { |
|
| 2392 | + $callback = function() use ( $url ) { |
|
| 2393 | 2393 | echo '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>'; |
| 2394 | 2394 | }; |
| 2395 | 2395 | return self::clip( $callback, $echo ); |
@@ -2484,7 +2484,7 @@ discard block |
||
| 2484 | 2484 | $suffix = 2; |
| 2485 | 2485 | do { |
| 2486 | 2486 | $key_check = $key . $separator . $suffix; |
| 2487 | - ++$suffix; |
|
| 2487 | + ++ $suffix; |
|
| 2488 | 2488 | } while ( in_array( $key_check, $similar_keys, true ) ); |
| 2489 | 2489 | |
| 2490 | 2490 | $key = $key_check; |
@@ -2594,7 +2594,7 @@ discard block |
||
| 2594 | 2594 | |
| 2595 | 2595 | foreach ( array( 'name', 'description' ) as $var ) { |
| 2596 | 2596 | $default_val = isset( $record->{$var} ) ? $record->{$var} : ''; |
| 2597 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 2597 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 2598 | 2598 | unset( $var, $default_val ); |
| 2599 | 2599 | } |
| 2600 | 2600 | |
@@ -2650,9 +2650,9 @@ discard block |
||
| 2650 | 2650 | $meta_value = FrmEntryMeta::get_meta_value( $record, $field->id ); |
| 2651 | 2651 | }//end if |
| 2652 | 2652 | |
| 2653 | - $field_type = isset( $post_values['field_options'][ 'type_' . $field->id ] ) ? $post_values['field_options'][ 'type_' . $field->id ] : $field->type; |
|
| 2654 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
| 2655 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
| 2653 | + $field_type = isset( $post_values['field_options']['type_' . $field->id] ) ? $post_values['field_options']['type_' . $field->id] : $field->type; |
|
| 2654 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
| 2655 | + $new_value = $post_values['item_meta'][$field->id]; |
|
| 2656 | 2656 | self::unserialize_or_decode( $new_value ); |
| 2657 | 2657 | } else { |
| 2658 | 2658 | $new_value = $meta_value; |
@@ -2673,7 +2673,7 @@ discard block |
||
| 2673 | 2673 | |
| 2674 | 2674 | $field_array = array_merge( (array) $field->field_options, $field_array ); |
| 2675 | 2675 | |
| 2676 | - $values['fields'][ $field->id ] = $field_array; |
|
| 2676 | + $values['fields'][$field->id] = $field_array; |
|
| 2677 | 2677 | } |
| 2678 | 2678 | |
| 2679 | 2679 | /** |
@@ -2723,11 +2723,11 @@ discard block |
||
| 2723 | 2723 | } |
| 2724 | 2724 | |
| 2725 | 2725 | foreach ( $form->options as $opt => $value ) { |
| 2726 | - if ( isset( $post_values[ $opt ] ) ) { |
|
| 2727 | - $values[ $opt ] = $post_values[ $opt ]; |
|
| 2728 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
| 2726 | + if ( isset( $post_values[$opt] ) ) { |
|
| 2727 | + $values[$opt] = $post_values[$opt]; |
|
| 2728 | + self::unserialize_or_decode( $values[$opt] ); |
|
| 2729 | 2729 | } else { |
| 2730 | - $values[ $opt ] = $value; |
|
| 2730 | + $values[$opt] = $value; |
|
| 2731 | 2731 | } |
| 2732 | 2732 | } |
| 2733 | 2733 | |
@@ -2741,8 +2741,8 @@ discard block |
||
| 2741 | 2741 | $form_defaults = FrmFormsHelper::get_default_opts(); |
| 2742 | 2742 | |
| 2743 | 2743 | foreach ( $form_defaults as $opt => $default ) { |
| 2744 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
| 2745 | - $values[ $opt ] = $post_values && isset( $post_values['options'][ $opt ] ) ? $post_values['options'][ $opt ] : $default; |
|
| 2744 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
| 2745 | + $values[$opt] = $post_values && isset( $post_values['options'][$opt] ) ? $post_values['options'][$opt] : $default; |
|
| 2746 | 2746 | } |
| 2747 | 2747 | |
| 2748 | 2748 | unset( $opt, $default ); |
@@ -2753,8 +2753,8 @@ discard block |
||
| 2753 | 2753 | } |
| 2754 | 2754 | |
| 2755 | 2755 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
| 2756 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
| 2757 | - $values[ $h . '_html' ] = ( isset( $post_values['options'][ $h . '_html' ] ) ? $post_values['options'][ $h . '_html' ] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 2756 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
| 2757 | + $values[$h . '_html'] = ( isset( $post_values['options'][$h . '_html'] ) ? $post_values['options'][$h . '_html'] : FrmFormsHelper::get_default_html( $h ) ); |
|
| 2758 | 2758 | } |
| 2759 | 2759 | unset( $h ); |
| 2760 | 2760 | } |
@@ -2949,25 +2949,25 @@ discard block |
||
| 2949 | 2949 | if ( ! is_numeric( $levels ) ) { |
| 2950 | 2950 | // Show time in specified unit. |
| 2951 | 2951 | $levels = self::get_unit( $levels ); |
| 2952 | - if ( isset( $time_strings[ $levels ] ) ) { |
|
| 2952 | + if ( isset( $time_strings[$levels] ) ) { |
|
| 2953 | 2953 | $diff = array( |
| 2954 | 2954 | $levels => self::time_format( $levels, $diff ), |
| 2955 | 2955 | ); |
| 2956 | 2956 | $time_strings = array( |
| 2957 | - $levels => $time_strings[ $levels ], |
|
| 2957 | + $levels => $time_strings[$levels], |
|
| 2958 | 2958 | ); |
| 2959 | 2959 | } |
| 2960 | 2960 | $levels = 1; |
| 2961 | 2961 | } |
| 2962 | 2962 | |
| 2963 | 2963 | foreach ( $time_strings as $k => $v ) { |
| 2964 | - if ( isset( $diff[ $k ] ) && $diff[ $k ] ) { |
|
| 2965 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
| 2966 | - } elseif ( isset( $diff[ $k ] ) && count( $time_strings ) === 1 ) { |
|
| 2964 | + if ( isset( $diff[$k] ) && $diff[$k] ) { |
|
| 2965 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
| 2966 | + } elseif ( isset( $diff[$k] ) && count( $time_strings ) === 1 ) { |
|
| 2967 | 2967 | // Account for 0. |
| 2968 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . $v[1]; |
|
| 2968 | + $time_strings[$k] = $diff[$k] . ' ' . $v[1]; |
|
| 2969 | 2969 | } else { |
| 2970 | - unset( $time_strings[ $k ] ); |
|
| 2970 | + unset( $time_strings[$k] ); |
|
| 2971 | 2971 | } |
| 2972 | 2972 | } |
| 2973 | 2973 | |
@@ -2986,8 +2986,8 @@ discard block |
||
| 2986 | 2986 | 'y' => 'y', |
| 2987 | 2987 | 'd' => 'days', |
| 2988 | 2988 | ); |
| 2989 | - if ( isset( $return[ $unit ] ) ) { |
|
| 2990 | - return $diff[ $return[ $unit ] ]; |
|
| 2989 | + if ( isset( $return[$unit] ) ) { |
|
| 2990 | + return $diff[$return[$unit]]; |
|
| 2991 | 2991 | } |
| 2992 | 2992 | |
| 2993 | 2993 | $total = $diff['days'] * self::convert_time( 'd', $unit ); |
@@ -2995,11 +2995,11 @@ discard block |
||
| 2995 | 2995 | $times = array( 'h', 'i', 's' ); |
| 2996 | 2996 | |
| 2997 | 2997 | foreach ( $times as $time ) { |
| 2998 | - if ( ! isset( $diff[ $time ] ) ) { |
|
| 2998 | + if ( ! isset( $diff[$time] ) ) { |
|
| 2999 | 2999 | continue; |
| 3000 | 3000 | } |
| 3001 | 3001 | |
| 3002 | - $total += $diff[ $time ] * self::convert_time( $time, $unit ); |
|
| 3002 | + $total += $diff[$time] * self::convert_time( $time, $unit ); |
|
| 3003 | 3003 | } |
| 3004 | 3004 | |
| 3005 | 3005 | return floor( $total ); |
@@ -3019,7 +3019,7 @@ discard block |
||
| 3019 | 3019 | 'y' => DAY_IN_SECONDS * 365.25, |
| 3020 | 3020 | ); |
| 3021 | 3021 | |
| 3022 | - return $convert[ $from ] / $convert[ $to ]; |
|
| 3022 | + return $convert[$from] / $convert[$to]; |
|
| 3023 | 3023 | } |
| 3024 | 3024 | |
| 3025 | 3025 | /** |
@@ -3027,7 +3027,7 @@ discard block |
||
| 3027 | 3027 | */ |
| 3028 | 3028 | private static function get_unit( $unit ) { |
| 3029 | 3029 | $units = self::get_time_strings(); |
| 3030 | - if ( isset( $units[ $unit ] ) || is_numeric( $unit ) ) { |
|
| 3030 | + if ( isset( $units[$unit] ) || is_numeric( $unit ) ) { |
|
| 3031 | 3031 | return $unit; |
| 3032 | 3032 | } |
| 3033 | 3033 | |
@@ -3143,17 +3143,17 @@ discard block |
||
| 3143 | 3143 | |
| 3144 | 3144 | case 1: |
| 3145 | 3145 | $l2 = $name; |
| 3146 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
| 3146 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
| 3147 | 3147 | break; |
| 3148 | 3148 | |
| 3149 | 3149 | case 2: |
| 3150 | 3150 | $l3 = $name; |
| 3151 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
| 3151 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
| 3152 | 3152 | break; |
| 3153 | 3153 | |
| 3154 | 3154 | case 3: |
| 3155 | 3155 | $l4 = $name; |
| 3156 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
| 3156 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
| 3157 | 3157 | } |
| 3158 | 3158 | |
| 3159 | 3159 | unset( $this_val, $n ); |
@@ -3172,8 +3172,8 @@ discard block |
||
| 3172 | 3172 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
| 3173 | 3173 | if ( $name == '' ) { |
| 3174 | 3174 | $vars[] = $val; |
| 3175 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
| 3176 | - $vars[ $l1 ] = $val; |
|
| 3175 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
| 3176 | + $vars[$l1] = $val; |
|
| 3177 | 3177 | } |
| 3178 | 3178 | } |
| 3179 | 3179 | |
@@ -3190,7 +3190,7 @@ discard block |
||
| 3190 | 3190 | 'new_tab' => __( 'This option will open the link in a new browser tab. Please note that some popup blockers may prevent this from happening, in which case the link will be displayed.', 'formidable' ), |
| 3191 | 3191 | ); |
| 3192 | 3192 | |
| 3193 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
| 3193 | + if ( ! isset( $tooltips[$name] ) ) { |
|
| 3194 | 3194 | return; |
| 3195 | 3195 | } |
| 3196 | 3196 | |
@@ -3200,7 +3200,7 @@ discard block |
||
| 3200 | 3200 | echo ' class="frm_help"'; |
| 3201 | 3201 | } |
| 3202 | 3202 | |
| 3203 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
| 3203 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
| 3204 | 3204 | |
| 3205 | 3205 | if ( 'open' != $class ) { |
| 3206 | 3206 | echo '"'; |
@@ -3259,13 +3259,13 @@ discard block |
||
| 3259 | 3259 | } |
| 3260 | 3260 | |
| 3261 | 3261 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
| 3262 | - if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { |
|
| 3262 | + if ( ! isset( $post_content[$key] ) || is_numeric( $val ) ) { |
|
| 3263 | 3263 | return; |
| 3264 | 3264 | } |
| 3265 | 3265 | |
| 3266 | 3266 | if ( is_array( $val ) ) { |
| 3267 | 3267 | foreach ( $val as $k1 => $v1 ) { |
| 3268 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
| 3268 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
| 3269 | 3269 | unset( $k1, $v1 ); |
| 3270 | 3270 | } |
| 3271 | 3271 | } else { |
@@ -3273,7 +3273,7 @@ discard block |
||
| 3273 | 3273 | $val = stripslashes( $val ); |
| 3274 | 3274 | |
| 3275 | 3275 | // Add backslashes before double quotes and forward slashes only |
| 3276 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
| 3276 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
| 3277 | 3277 | } |
| 3278 | 3278 | } |
| 3279 | 3279 | |
@@ -3394,14 +3394,14 @@ discard block |
||
| 3394 | 3394 | continue; |
| 3395 | 3395 | } |
| 3396 | 3396 | $key = $input['name']; |
| 3397 | - if ( isset( $formatted[ $key ] ) ) { |
|
| 3398 | - if ( is_array( $formatted[ $key ] ) ) { |
|
| 3399 | - $formatted[ $key ][] = $input['value']; |
|
| 3397 | + if ( isset( $formatted[$key] ) ) { |
|
| 3398 | + if ( is_array( $formatted[$key] ) ) { |
|
| 3399 | + $formatted[$key][] = $input['value']; |
|
| 3400 | 3400 | } else { |
| 3401 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
| 3401 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
| 3402 | 3402 | } |
| 3403 | 3403 | } else { |
| 3404 | - $formatted[ $key ] = $input['value']; |
|
| 3404 | + $formatted[$key] = $input['value']; |
|
| 3405 | 3405 | } |
| 3406 | 3406 | } |
| 3407 | 3407 | |
@@ -4103,8 +4103,8 @@ discard block |
||
| 4103 | 4103 | } |
| 4104 | 4104 | |
| 4105 | 4105 | foreach ( $keys as $key ) { |
| 4106 | - if ( isset( $values[ $key ] ) ) { |
|
| 4107 | - $values[ $key ] = self::kses( $values[ $key ], 'all' ); |
|
| 4106 | + if ( isset( $values[$key] ) ) { |
|
| 4107 | + $values[$key] = self::kses( $values[$key], 'all' ); |
|
| 4108 | 4108 | } |
| 4109 | 4109 | } |
| 4110 | 4110 | |
@@ -4169,7 +4169,7 @@ discard block |
||
| 4169 | 4169 | 'role', |
| 4170 | 4170 | 'style', |
| 4171 | 4171 | ); |
| 4172 | - $safe = in_array( $key, $safe_keys, true ); |
|
| 4172 | + $safe = in_array( $key, $safe_keys, true ); |
|
| 4173 | 4173 | }//end if |
| 4174 | 4174 | |
| 4175 | 4175 | /** |
@@ -4308,7 +4308,7 @@ discard block |
||
| 4308 | 4308 | return 0; |
| 4309 | 4309 | } |
| 4310 | 4310 | |
| 4311 | - return strlen( $parts[ count( $parts ) - 1 ] ); |
|
| 4311 | + return strlen( $parts[count( $parts ) - 1] ); |
|
| 4312 | 4312 | } |
| 4313 | 4313 | |
| 4314 | 4314 | /** |
@@ -4328,7 +4328,7 @@ discard block |
||
| 4328 | 4328 | |
| 4329 | 4329 | add_filter( |
| 4330 | 4330 | 'option_gmt_offset', |
| 4331 | - function ( $offset ) { |
|
| 4331 | + function( $offset ) { |
|
| 4332 | 4332 | if ( ! is_string( $offset ) || is_numeric( $offset ) ) { |
| 4333 | 4333 | // Leave a valid value alone. |
| 4334 | 4334 | return $offset; |
@@ -4425,7 +4425,7 @@ discard block |
||
| 4425 | 4425 | return; |
| 4426 | 4426 | } |
| 4427 | 4427 | |
| 4428 | - $ajax_callback = function () use ( $option ) { |
|
| 4428 | + $ajax_callback = function() use ( $option ) { |
|
| 4429 | 4429 | self::dismiss_warning_message( $option ); |
| 4430 | 4430 | }; |
| 4431 | 4431 | |
@@ -4435,7 +4435,7 @@ discard block |
||
| 4435 | 4435 | |
| 4436 | 4436 | add_filter( |
| 4437 | 4437 | 'frm_message_list', |
| 4438 | - function ( $show_messages ) use ( $message, $option ) { |
|
| 4438 | + function( $show_messages ) use ( $message, $option ) { |
|
| 4439 | 4439 | if ( get_option( $option, false ) ) { |
| 4440 | 4440 | return $show_messages; |
| 4441 | 4441 | } |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | $field_val = ''; |
| 157 | 157 | if ( is_object( $this->field ) ) { |
| 158 | 158 | $field_val = $this->field->{$column}; |
| 159 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 160 | - $field_val = $this->field[ $column ]; |
|
| 159 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 160 | + $field_val = $this->field[$column]; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | return $field_val; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | if ( is_object( $this->field ) ) { |
| 172 | 172 | $this->field->{$column} = $value; |
| 173 | 173 | } elseif ( is_array( $this->field ) ) { |
| 174 | - $this->field[ $column ] = $value; |
|
| 174 | + $this->field[$column] = $value; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | printf( |
| 631 | 631 | /* translators: %s: Field type */ |
| 632 | 632 | esc_html__( '%s Options', 'formidable' ), |
| 633 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 633 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 634 | 634 | ); |
| 635 | 635 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon', array( 'aria-hidden' => 'true' ) ); |
| 636 | 636 | ?> |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | * New field |
| 731 | 731 | */ |
| 732 | 732 | public function get_new_field_defaults() { |
| 733 | - $field = array( |
|
| 733 | + $field = array( |
|
| 734 | 734 | 'name' => $this->get_new_field_name(), |
| 735 | 735 | 'description' => '', |
| 736 | 736 | 'type' => $this->type, |
@@ -761,8 +761,8 @@ discard block |
||
| 761 | 761 | |
| 762 | 762 | $fields = array_merge( $fields, $pro_fields ); |
| 763 | 763 | |
| 764 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 765 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 764 | + if ( isset( $fields[$this->type] ) ) { |
|
| 765 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | return $name; |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | * @return array |
| 780 | 780 | */ |
| 781 | 781 | public function get_default_field_options() { |
| 782 | - $opts = array( |
|
| 782 | + $opts = array( |
|
| 783 | 783 | 'size' => '', |
| 784 | 784 | 'max' => '', |
| 785 | 785 | 'label' => '', |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | * @return void |
| 1024 | 1024 | */ |
| 1025 | 1025 | public function set_aria_invalid_error( &$shortcode_atts, $args ) { |
| 1026 | - $shortcode_atts['aria-invalid'] = isset( $args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
| 1026 | + $shortcode_atts['aria-invalid'] = isset( $args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | /** |
@@ -1183,11 +1183,11 @@ discard block |
||
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | $options = array_values( $this->field['options'] ); |
| 1186 | - if ( ! isset( $options[ $opt ] ) ) { |
|
| 1186 | + if ( ! isset( $options[$opt] ) ) { |
|
| 1187 | 1187 | return $hidden; |
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | - $option = $options[ $opt ]; |
|
| 1190 | + $option = $options[$opt]; |
|
| 1191 | 1191 | if ( is_array( $option ) ) { |
| 1192 | 1192 | $option = $option['value']; |
| 1193 | 1193 | } |
@@ -1251,8 +1251,8 @@ discard block |
||
| 1251 | 1251 | $selected = $values['field_value']; |
| 1252 | 1252 | |
| 1253 | 1253 | if ( isset( $values['combo_name'] ) ) { |
| 1254 | - $options = $options[ $values['combo_name'] ]; |
|
| 1255 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 1254 | + $options = $options[$values['combo_name']]; |
|
| 1255 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | $input = $this->select_tag( $values ); |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | } |
| 1308 | 1308 | |
| 1309 | 1309 | protected function fill_display_field_values( $args = array() ) { |
| 1310 | - $defaults = array( |
|
| 1310 | + $defaults = array( |
|
| 1311 | 1311 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1312 | 1312 | 'field_id' => $this->get_field_column( 'id' ), |
| 1313 | 1313 | 'field_plus_id' => '', |
@@ -1364,7 +1364,7 @@ discard block |
||
| 1364 | 1364 | } |
| 1365 | 1365 | } |
| 1366 | 1366 | |
| 1367 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1367 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1368 | 1368 | if ( $error_comes_first ) { |
| 1369 | 1369 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1370 | 1370 | } else { |
@@ -1442,11 +1442,11 @@ discard block |
||
| 1442 | 1442 | |
| 1443 | 1443 | $field_id = $this->get_field_column( 'id' ); |
| 1444 | 1444 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1445 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1445 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1446 | 1446 | return false; |
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1449 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1450 | 1450 | return $already_validated_this_value; |
| 1451 | 1451 | } |
| 1452 | 1452 | |
@@ -1471,7 +1471,7 @@ discard block |
||
| 1471 | 1471 | private function value_validated_as_unique( $value ) { |
| 1472 | 1472 | global $frm_validated_unique_values; |
| 1473 | 1473 | $field_id = $this->get_field_column( 'id' ); |
| 1474 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1474 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | 1477 | /** |
@@ -1516,8 +1516,8 @@ discard block |
||
| 1516 | 1516 | $value = $this->prepare_display_value( $value, $atts ); |
| 1517 | 1517 | |
| 1518 | 1518 | if ( is_array( $value ) ) { |
| 1519 | - if ( ! empty( $atts['show'] ) && isset( $value[ $atts['show'] ] ) ) { |
|
| 1520 | - $value = $value[ $atts['show'] ]; |
|
| 1519 | + if ( ! empty( $atts['show'] ) && isset( $value[$atts['show']] ) ) { |
|
| 1520 | + $value = $value[$atts['show']]; |
|
| 1521 | 1521 | } elseif ( empty( $atts['return_array'] ) ) { |
| 1522 | 1522 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 1523 | 1523 | $value = FrmAppHelper::safe_implode( $sep, $value ); |
@@ -1647,8 +1647,8 @@ discard block |
||
| 1647 | 1647 | $saved_entries = $atts['ids']; |
| 1648 | 1648 | $new_value = array(); |
| 1649 | 1649 | foreach ( (array) $value as $old_child_id ) { |
| 1650 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1651 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1650 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1651 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1652 | 1652 | } |
| 1653 | 1653 | } |
| 1654 | 1654 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $_GET['page'] = 'formidable'; |
| 27 | 27 | |
| 28 | - $values = array( |
|
| 28 | + $values = array( |
|
| 29 | 29 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 30 | 30 | 'doing_ajax' => true, |
| 31 | 31 | ); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | ob_start(); |
| 50 | 50 | self::load_single_field( $field, $values ); |
| 51 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
| 51 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
| 52 | 52 | ob_end_clean(); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | foreach ( $opts as $opt_key => $opt ) { |
| 264 | 264 | if ( strpos( $opt, '|' ) !== false ) { |
| 265 | 265 | $vals = explode( '|', $opt ); |
| 266 | - $opts[ $opt_key ] = array( |
|
| 266 | + $opts[$opt_key] = array( |
|
| 267 | 267 | 'label' => trim( $vals[0] ), |
| 268 | 268 | 'value' => trim( $vals[1] ), |
| 269 | 269 | ); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $other_array = array(); |
| 279 | 279 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 280 | 280 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 281 | - $other_array[ $opt_key ] = $opt; |
|
| 281 | + $other_array[$opt_key] = $opt; |
|
| 282 | 282 | } |
| 283 | 283 | unset( $opt_key, $opt ); |
| 284 | 284 | } |
@@ -321,18 +321,18 @@ discard block |
||
| 321 | 321 | $frm_settings = FrmAppHelper::get_settings(); |
| 322 | 322 | $field_types = FrmFieldTypeOptionData::get_field_types( $field['type'] ); |
| 323 | 323 | |
| 324 | - if ( ! isset( $all_field_types[ $field['type'] ] ) ) { |
|
| 324 | + if ( ! isset( $all_field_types[$field['type']] ) ) { |
|
| 325 | 325 | // Add fallback for an add-on field type that has been deactivated. |
| 326 | - $all_field_types[ $field['type'] ] = array( |
|
| 326 | + $all_field_types[$field['type']] = array( |
|
| 327 | 327 | 'name' => ucfirst( $field['type'] ), |
| 328 | 328 | 'icon' => 'frm_icon_font frm_pencil_icon', |
| 329 | 329 | ); |
| 330 | - } elseif ( ! is_array( $all_field_types[ $field['type'] ] ) ) { |
|
| 330 | + } elseif ( ! is_array( $all_field_types[$field['type']] ) ) { |
|
| 331 | 331 | // Fallback for fields added in a more basic way. |
| 332 | - FrmFormsHelper::prepare_field_type( $all_field_types[ $field['type'] ] ); |
|
| 332 | + FrmFormsHelper::prepare_field_type( $all_field_types[$field['type']] ); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - $type_name = $all_field_types[ $field['type'] ]['name']; |
|
| 335 | + $type_name = $all_field_types[$field['type']]['name']; |
|
| 336 | 336 | if ( $field['type'] === 'divider' && FrmField::is_option_true( $field, 'repeat' ) ) { |
| 337 | 337 | $type_name = $all_field_types['divider|repeat']['name']; |
| 338 | 338 | } |
@@ -409,14 +409,14 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | if ( FrmAppHelper::pro_is_connected() ) { |
| 411 | 411 | foreach ( $settings as $type ) { |
| 412 | - if ( ! empty( $field[ $type ] ) ) { |
|
| 412 | + if ( ! empty( $field[$type] ) ) { |
|
| 413 | 413 | $active = $type; |
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - $types[ $active ]['class'] .= ' current'; |
|
| 419 | - $types[ $active ]['current'] = true; |
|
| 418 | + $types[$active]['class'] .= ' current'; |
|
| 419 | + $types[$active]['current'] = true; |
|
| 420 | 420 | |
| 421 | 421 | return $types; |
| 422 | 422 | } |
@@ -434,8 +434,8 @@ discard block |
||
| 434 | 434 | 'website' => 'url', |
| 435 | 435 | 'image' => 'url', |
| 436 | 436 | ); |
| 437 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 438 | - $type = $type_switch[ $type ]; |
|
| 437 | + if ( isset( $type_switch[$type] ) ) { |
|
| 438 | + $type = $type_switch[$type]; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | $pro_fields = FrmField::pro_field_selection(); |
@@ -590,11 +590,11 @@ discard block |
||
| 590 | 590 | // include "col" for valid html |
| 591 | 591 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 592 | 592 | |
| 593 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 593 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 594 | 594 | return; |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 597 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 598 | 598 | |
| 599 | 599 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 600 | 600 | } |
@@ -827,11 +827,11 @@ discard block |
||
| 827 | 827 | private static function get_form_for_js_validation( $field ) { |
| 828 | 828 | global $frm_vars; |
| 829 | 829 | if ( ! empty( $frm_vars['js_validate_forms'] ) ) { |
| 830 | - if ( isset( $frm_vars['js_validate_forms'][ $field['form_id'] ] ) ) { |
|
| 831 | - return $frm_vars['js_validate_forms'][ $field['form_id'] ]; |
|
| 830 | + if ( isset( $frm_vars['js_validate_forms'][$field['form_id']] ) ) { |
|
| 831 | + return $frm_vars['js_validate_forms'][$field['form_id']]; |
|
| 832 | 832 | } |
| 833 | - if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][ $field['parent_form_id'] ] ) ) { |
|
| 834 | - return $frm_vars['js_validate_forms'][ $field['parent_form_id'] ]; |
|
| 833 | + if ( ! empty( $field['parent_form_id'] ) && isset( $frm_vars['js_validate_forms'][$field['parent_form_id']] ) ) { |
|
| 834 | + return $frm_vars['js_validate_forms'][$field['parent_form_id']]; |
|
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | 837 | return false; |
@@ -918,13 +918,13 @@ discard block |
||
| 918 | 918 | foreach ( $field['shortcodes'] as $k => $v ) { |
| 919 | 919 | if ( isset( $field['subfield_name'] ) && 0 === strpos( $k, 'aria-invalid' ) ) { |
| 920 | 920 | $subfield_name = $field['subfield_name']; |
| 921 | - if ( ! isset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ) ) { |
|
| 921 | + if ( ! isset( $field['shortcodes']['aria-invalid-' . $subfield_name] ) ) { |
|
| 922 | 922 | continue; |
| 923 | 923 | } |
| 924 | 924 | // Change the key to the correct aria-invalid value so that $add_html is set correctly for the current subfield of a combo field. |
| 925 | 925 | $k = 'aria-invalid'; |
| 926 | - $v = $field['shortcodes'][ 'aria-invalid-' . $subfield_name ]; |
|
| 927 | - unset( $field['shortcodes'][ 'aria-invalid-' . $subfield_name ] ); |
|
| 926 | + $v = $field['shortcodes']['aria-invalid-' . $subfield_name]; |
|
| 927 | + unset( $field['shortcodes']['aria-invalid-' . $subfield_name] ); |
|
| 928 | 928 | } |
| 929 | 929 | if ( 'opt' === $k || ! self::should_allow_input_attribute( $k ) ) { |
| 930 | 930 | continue; |
@@ -932,10 +932,10 @@ discard block |
||
| 932 | 932 | |
| 933 | 933 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 934 | 934 | $add_html[] = $v; |
| 935 | - } elseif ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 936 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 935 | + } elseif ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 936 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 937 | 937 | } else { |
| 938 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 938 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 939 | 939 | } |
| 940 | 940 | |
| 941 | 941 | unset( $k, $v ); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | <?php esc_html_e( 'Content', 'formidable' ); ?> |
| 9 | 9 | </label> |
| 10 | 10 | <?php |
| 11 | - $e_args = array( |
|
| 11 | + $e_args = array( |
|
| 12 | 12 | 'textarea_name' => 'field_options[description_' . absint( $field['id'] ) . ']', |
| 13 | 13 | 'textarea_rows' => 7, |
| 14 | 14 | ); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | ?> |
| 41 | 41 | <p class="frm6 frm_form_field"> |
| 42 | 42 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 43 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 43 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 44 | 44 | </label> |
| 45 | 45 | <span class="frm-with-right-icon"> |
| 46 | 46 | <?php |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | type="text" |
| 56 | 56 | name="<?php echo esc_attr( $input_name ); ?>" |
| 57 | 57 | id="<?php echo esc_attr( $input_id ); ?>" |
| 58 | - value="<?php echo esc_attr( isset( $default_value[ $sub_field['name'] ] ) ? $default_value[ $sub_field['name'] ] : '' ); ?>" |
|
| 58 | + value="<?php echo esc_attr( isset( $default_value[$sub_field['name']] ) ? $default_value[$sub_field['name']] : '' ); ?>" |
|
| 59 | 59 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
| 60 | 60 | data-changeatt="value" |
| 61 | 61 | /> |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | ?> |
| 73 | 73 | <p class="frm6 frm_form_field"> |
| 74 | 74 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 75 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 75 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 76 | 76 | </label> |
| 77 | 77 | <input |
| 78 | 78 | type="text" |
| 79 | 79 | name="<?php echo esc_attr( $input_name ); ?>" |
| 80 | 80 | id="<?php echo esc_attr( $input_id ); ?>" |
| 81 | - value="<?php echo esc_attr( isset( $input_value[ $sub_field['name'] ] ) ? $input_value[ $sub_field['name'] ] : '' ); ?>" |
|
| 81 | + value="<?php echo esc_attr( isset( $input_value[$sub_field['name']] ) ? $input_value[$sub_field['name']] : '' ); ?>" |
|
| 82 | 82 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
| 83 | 83 | data-changeatt="<?php echo esc_attr( $option ); ?>" |
| 84 | 84 | /> |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ?> |
| 95 | 95 | <p class="frm_form_field frm-flex-col"> |
| 96 | 96 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 97 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 97 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 98 | 98 | </label> |
| 99 | 99 | <textarea |
| 100 | 100 | name="<?php echo esc_attr( $input_name ); ?>" |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | if ( FrmAppHelper::pro_is_connected() && ! is_callable( array( 'FrmProHtmlHelper', 'echo_radio_group' ) ) ) { |
| 190 | 190 | switch ( $type ) { |
| 191 | 191 | case 'calc': |
| 192 | - $default_value_type['data'] = array( |
|
| 192 | + $default_value_type['data'] = array( |
|
| 193 | 193 | 'show' => '#calc-for-{id}', |
| 194 | 194 | 'disable' => '#default-value-for-{id}', |
| 195 | 195 | ); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | 218 | foreach ( $default_value_type['data'] as $data_key => $data_value ) { |
| 219 | - $toggle_args['input_html'][ 'data-' . $data_key ] = $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' ); |
|
| 219 | + $toggle_args['input_html']['data-' . $data_key] = $data_value . ( substr( $data_value, -1 ) === '-' ? $field['id'] : '' ); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | ?> |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | wp_enqueue_script( 'formidable_settings' ); |
| 29 | 29 | return FrmAppHelper::clip( |
| 30 | 30 | // @phpstan-ignore-next-line |
| 31 | - function () use ( $id, $name, $args ) { |
|
| 31 | + function() use ( $id, $name, $args ) { |
|
| 32 | 32 | require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php'; |
| 33 | 33 | }, |
| 34 | 34 | isset( $args['echo'] ) ? $args['echo'] : false |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $input_number_attrs = array_merge( |
|
| 100 | + $input_number_attrs = array_merge( |
|
| 101 | 101 | $args['input_number_attrs'], |
| 102 | 102 | array( |
| 103 | 103 | 'type' => ! empty( $selected_unit ) ? 'number' : 'text', |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | if ( in_array( $type, array( 'data', 'lookup' ), true ) ) { |
| 39 | 39 | $values['field_options']['data_type'] = $setting; |
| 40 | 40 | } else { |
| 41 | - $values['field_options'][ $setting ] = 1; |
|
| 41 | + $values['field_options'][$setting] = 1; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | foreach ( $defaults as $opt => $default ) { |
| 175 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
| 175 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
| 176 | 176 | |
| 177 | 177 | if ( $check_post ) { |
| 178 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 178 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | return self::$context_is_safe_to_load_field_options_from_request_data; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $function = function () { |
|
| 195 | + $function = function() { |
|
| 196 | 196 | if ( ! FrmAppHelper::is_admin_page() ) { |
| 197 | 197 | return false; |
| 198 | 198 | } |
@@ -300,12 +300,12 @@ discard block |
||
| 300 | 300 | * @param mixed $value |
| 301 | 301 | */ |
| 302 | 302 | private static function get_posted_field_setting( $setting, &$value ) { |
| 303 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 303 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 304 | 304 | return; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if ( strpos( $setting, 'html' ) !== false ) { |
| 308 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 308 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 309 | 309 | |
| 310 | 310 | // Conditionally strip script tags if the user sending $_POST data is not allowed to use unfiltered HTML. |
| 311 | 311 | if ( ! FrmAppHelper::allow_unfiltered_html() ) { |
@@ -313,9 +313,9 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
| 315 | 315 | // TODO: Remove stripslashes on output, and use on input only. |
| 316 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 316 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 317 | 317 | } else { |
| 318 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 318 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 319 | 319 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
| 389 | 389 | |
| 390 | 390 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 391 | - $values[ $col ] = $field->{$col}; |
|
| 391 | + $values[$col] = $field->{$col}; |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | ); |
| 427 | 427 | |
| 428 | 428 | $msg = FrmField::get_option( $field, $error ); |
| 429 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 429 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 430 | 430 | $msg = do_shortcode( $msg ); |
| 431 | 431 | |
| 432 | 432 | $msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field ); |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | 'inside_class' => 'inside', |
| 697 | 697 | 'dismiss-icon' => true, |
| 698 | 698 | ); |
| 699 | - $args = array_merge( $defaults, $args ); |
|
| 699 | + $args = array_merge( $defaults, $args ); |
|
| 700 | 700 | |
| 701 | 701 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php'; |
| 702 | 702 | } |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | continue; |
| 935 | 935 | } |
| 936 | 936 | |
| 937 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 937 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 938 | 938 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 939 | 939 | |
| 940 | 940 | $atts['entry'] = $entry; |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | if ( $replace_with !== null ) { |
| 945 | 945 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
| 946 | 946 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 947 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 947 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | unset( $atts, $replace_with ); |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
| 963 | 963 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
| 964 | 964 | foreach ( $included_atts as $included_att ) { |
| 965 | - if ( '0' === $atts[ $included_att ] ) { |
|
| 965 | + if ( '0' === $atts[$included_att] ) { |
|
| 966 | 966 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
| 967 | 967 | continue; |
| 968 | 968 | } |
@@ -1040,8 +1040,8 @@ discard block |
||
| 1040 | 1040 | |
| 1041 | 1041 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get', 'default-email', 'default-from-email' ); |
| 1042 | 1042 | |
| 1043 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 1044 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 1043 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 1044 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 1045 | 1045 | } elseif ( in_array( $atts['tag'], $dynamic_default, true ) ) { |
| 1046 | 1046 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 1047 | 1047 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1265,8 +1265,8 @@ discard block |
||
| 1265 | 1265 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 1266 | 1266 | } elseif ( in_array( $type, $multiple_input, true ) ) { |
| 1267 | 1267 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 1268 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 1269 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 1268 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 1269 | + $field_types[$type] = $field_selection[$type]; |
|
| 1270 | 1270 | } |
| 1271 | 1271 | |
| 1272 | 1272 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | foreach ( $inputs as $input ) { |
| 1309 | 1309 | // This may not be set if a field type was removed using the frm_available_fields or frm_pro_available_fields filters. |
| 1310 | 1310 | if ( array_key_exists( $input, $fields ) ) { |
| 1311 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 1311 | + $field_types[$input] = $fields[$input]; |
|
| 1312 | 1312 | } |
| 1313 | 1313 | unset( $input ); |
| 1314 | 1314 | } |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | 'parent' => false, |
| 1342 | 1342 | 'pointer' => false, |
| 1343 | 1343 | ); |
| 1344 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1344 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1345 | 1345 | |
| 1346 | 1346 | $opt_key = $args['opt_key']; |
| 1347 | 1347 | $field = $args['field']; |
@@ -1357,25 +1357,25 @@ discard block |
||
| 1357 | 1357 | |
| 1358 | 1358 | // Check posted vals before checking saved values |
| 1359 | 1359 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1360 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1360 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1361 | 1361 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1362 | 1362 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1363 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1363 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1364 | 1364 | } else { |
| 1365 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1365 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | return $other_val; |
| 1369 | 1369 | } |
| 1370 | 1370 | |
| 1371 | - if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1371 | + if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1372 | 1372 | // For normal fields |
| 1373 | 1373 | |
| 1374 | 1374 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1375 | 1375 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1376 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1376 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1377 | 1377 | } else { |
| 1378 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1378 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | return $other_val; |
@@ -1385,8 +1385,8 @@ discard block |
||
| 1385 | 1385 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
| 1386 | 1386 | // Check if there is an "other" val in saved value and make sure the |
| 1387 | 1387 | // "other" val is not equal to the Other checkbox option |
| 1388 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1389 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1388 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1389 | + $other_val = $field['value'][$opt_key]; |
|
| 1390 | 1390 | } |
| 1391 | 1391 | } else { |
| 1392 | 1392 | /** |
@@ -1398,8 +1398,8 @@ discard block |
||
| 1398 | 1398 | // Multi-select dropdowns - key is not preserved |
| 1399 | 1399 | if ( is_array( $field['value'] ) ) { |
| 1400 | 1400 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1401 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1402 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1401 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1402 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1403 | 1403 | } |
| 1404 | 1404 | } elseif ( $temp_val == $field['value'] ) { |
| 1405 | 1405 | // For radio and regular dropdowns |
@@ -1610,11 +1610,11 @@ discard block |
||
| 1610 | 1610 | foreach ( $val as $k => $v ) { |
| 1611 | 1611 | if ( is_string( $v ) ) { |
| 1612 | 1612 | if ( 'custom_html' === $k ) { |
| 1613 | - $val[ $k ] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1613 | + $val[$k] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1614 | 1614 | unset( $k, $v ); |
| 1615 | 1615 | continue; |
| 1616 | 1616 | } |
| 1617 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1617 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1618 | 1618 | unset( $k, $v ); |
| 1619 | 1619 | } |
| 1620 | 1620 | } |
@@ -1643,8 +1643,8 @@ discard block |
||
| 1643 | 1643 | if ( false === $index ) { |
| 1644 | 1644 | continue; |
| 1645 | 1645 | } |
| 1646 | - unset( $replace[ $index ] ); |
|
| 1647 | - unset( $replace_with[ $index ] ); |
|
| 1646 | + unset( $replace[$index] ); |
|
| 1647 | + unset( $replace_with[$index] ); |
|
| 1648 | 1648 | } |
| 1649 | 1649 | $value = str_replace( $replace, $replace_with, $value ); |
| 1650 | 1650 | return $value; |
@@ -1992,7 +1992,7 @@ discard block |
||
| 1992 | 1992 | $countries['class'] = 'frm-countries-opts'; |
| 1993 | 1993 | } |
| 1994 | 1994 | |
| 1995 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
| 1995 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
| 1996 | 1996 | |
| 1997 | 1997 | // State abv. |
| 1998 | 1998 | $states = self::get_us_states(); |
@@ -2002,7 +2002,7 @@ discard block |
||
| 2002 | 2002 | $state_abv['class'] = 'frm-state-abv-opts'; |
| 2003 | 2003 | } |
| 2004 | 2004 | |
| 2005 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 2005 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 2006 | 2006 | |
| 2007 | 2007 | // States. |
| 2008 | 2008 | $states = array_values( $states ); |
@@ -2011,7 +2011,7 @@ discard block |
||
| 2011 | 2011 | $states['class'] = 'frm-states-opts'; |
| 2012 | 2012 | } |
| 2013 | 2013 | |
| 2014 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 2014 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 2015 | 2015 | unset( $state_abv, $states ); |
| 2016 | 2016 | |
| 2017 | 2017 | // Age. |
@@ -2029,7 +2029,7 @@ discard block |
||
| 2029 | 2029 | $ages['class'] = 'frm-age-opts'; |
| 2030 | 2030 | } |
| 2031 | 2031 | |
| 2032 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
| 2032 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
| 2033 | 2033 | |
| 2034 | 2034 | // Satisfaction. |
| 2035 | 2035 | $satisfaction = array( |
@@ -2044,7 +2044,7 @@ discard block |
||
| 2044 | 2044 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
| 2045 | 2045 | } |
| 2046 | 2046 | |
| 2047 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
| 2047 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
| 2048 | 2048 | |
| 2049 | 2049 | // Importance. |
| 2050 | 2050 | $importance = array( |
@@ -2059,7 +2059,7 @@ discard block |
||
| 2059 | 2059 | $importance['class'] = 'frm-importance-opts'; |
| 2060 | 2060 | } |
| 2061 | 2061 | |
| 2062 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
| 2062 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
| 2063 | 2063 | |
| 2064 | 2064 | // Agreement. |
| 2065 | 2065 | $agreement = array( |
@@ -2074,7 +2074,7 @@ discard block |
||
| 2074 | 2074 | $agreement['class'] = 'frm-agreement-opts'; |
| 2075 | 2075 | } |
| 2076 | 2076 | |
| 2077 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
| 2077 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
| 2078 | 2078 | |
| 2079 | 2079 | // Likely. |
| 2080 | 2080 | $likely = array( |
@@ -2089,7 +2089,7 @@ discard block |
||
| 2089 | 2089 | $likely['class'] = 'frm-likely-opts'; |
| 2090 | 2090 | } |
| 2091 | 2091 | |
| 2092 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
| 2092 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
| 2093 | 2093 | |
| 2094 | 2094 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 2095 | 2095 | } |
@@ -2310,16 +2310,16 @@ discard block |
||
| 2310 | 2310 | */ |
| 2311 | 2311 | private static function fill_image_setting_options( $options, &$args ) { |
| 2312 | 2312 | foreach ( $options as $key => $option ) { |
| 2313 | - $args['options'][ $key ] = $option; |
|
| 2313 | + $args['options'][$key] = $option; |
|
| 2314 | 2314 | |
| 2315 | 2315 | if ( ! empty( $option['addon'] ) ) { |
| 2316 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2316 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2317 | 2317 | } |
| 2318 | 2318 | |
| 2319 | - unset( $args['options'][ $key ]['addon'] ); |
|
| 2319 | + unset( $args['options'][$key]['addon'] ); |
|
| 2320 | 2320 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2321 | 2321 | foreach ( $fill as $f ) { |
| 2322 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
| 2322 | + unset( $args['options'][$key][$f], $f ); |
|
| 2323 | 2323 | } |
| 2324 | 2324 | } |
| 2325 | 2325 | } |
@@ -2340,8 +2340,8 @@ discard block |
||
| 2340 | 2340 | |
| 2341 | 2341 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2342 | 2342 | foreach ( $fill as $f ) { |
| 2343 | - if ( isset( $option[ $f ] ) ) { |
|
| 2344 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
| 2343 | + if ( isset( $option[$f] ) ) { |
|
| 2344 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
| 2345 | 2345 | } |
| 2346 | 2346 | } |
| 2347 | 2347 | |
@@ -2407,7 +2407,7 @@ discard block |
||
| 2407 | 2407 | |
| 2408 | 2408 | return array_filter( |
| 2409 | 2409 | $rows, |
| 2410 | - function ( $row ) { |
|
| 2410 | + function( $row ) { |
|
| 2411 | 2411 | FrmAppHelper::unserialize_or_decode( $row->field_options ); |
| 2412 | 2412 | return is_array( $row->field_options ) && ! empty( $row->field_options['draft'] ); |
| 2413 | 2413 | } |
@@ -2470,7 +2470,7 @@ discard block |
||
| 2470 | 2470 | if ( empty( $attributes['data-fid'] ) ) { |
| 2471 | 2471 | unset( $data['plugin-status'] ); |
| 2472 | 2472 | foreach ( $data as $key => $value ) { |
| 2473 | - $attributes[ 'data-' . $key ] = $value; |
|
| 2473 | + $attributes['data-' . $key] = $value; |
|
| 2474 | 2474 | } |
| 2475 | 2475 | } |
| 2476 | 2476 | |