| @@ -13,18 +13,17 @@ | ||
| 13 | 13 | die( 'You are not allowed to call this page directly.' ); |
| 14 | 14 | } |
| 15 | 15 | ?> |
| 16 | 16 | <?php |
| 17 | -$div_class = $args['div_class'] ?? false; | |
| 18 | -$show_labels = $args['show_labels'] ?? false; | |
| 19 | -$off_label = $args['off_label'] ?? ''; | |
| 20 | -$on_label = $args['on_label'] ?? 1; | |
| 21 | -$value = $args['value'] ?? $on_label; | |
| 22 | -$checked = isset( $args['checked'] ) && ( true === $args['checked'] || false !== strpos( $args['checked'], 'checked="checked"' ) ); | |
| 23 | -$disabled = ! empty( $args['disabled'] ); | |
| 24 | -$aria_checked = $checked ? 'true' : 'false'; | |
| 25 | -$input_html = $args['input_html'] ?? array(); | |
| 26 | - | |
| 17 | +$div_class = $args['div_class'] ?? false; | |
| 18 | +$show_labels = $args['show_labels'] ?? false; | |
| 19 | +$off_label = $args['off_label'] ?? ''; | |
| 20 | +$on_label = $args['on_label'] ?? 1; | |
| 21 | +$value = $args['value'] ?? $on_label; | |
| 22 | +$checked = isset( $args['checked'] ) && ( true === $args['checked'] || str_contains( $args['checked'], 'checked="checked"' ) ); | |
| 23 | +$disabled = ! empty( $args['disabled'] ); | |
| 24 | +$aria_checked = $checked ? 'true' : 'false'; | |
| 25 | +$input_html = $args['input_html'] ?? array(); | |
| 27 | 26 | $use_container = false; |
| 28 | 27 | |
| 29 | 28 | $div_params = array( |
| 30 | 29 | // This is important when the default style is !important as Pro styling may cause conflicts. |
| @@ -36,9 +35,9 @@ | ||
| 36 | 35 | $use_container = true; |
| 37 | 36 | $div_params['class'] = $div_class; |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | -if ( strpos( $name, '[' ) === false ) { | |
| 39 | +if ( ! str_contains( $name, '[' ) ) { | |
| 41 | 40 | $name .= '[]'; |
| 42 | 41 | } |
| 43 | 42 | |
| 44 | 43 | if ( $use_container ) { |
| @@ -77,8 +76,9 @@ | ||
| 77 | 76 | > |
| 78 | 77 | <span class="frm_toggle_slider"></span> |
| 79 | 78 | </span> |
| 80 | 79 | |
| 80 | + <?php // phpcs:ignore Universal.Operators.StrictComparisons ?> | |
| 81 | 81 | <?php if ( $show_labels && $on_label != 1 ) { ?> |
| 82 | 82 | <span class="frm_on_label frm_toggle_opt frm-leading-none"><?php FrmAppHelper::kses_echo( $on_label, 'all' ); ?></span> |
| 83 | 83 | <?php } ?> |
| 84 | 84 | </label> |