| @@ -13,17 +13,18 @@ | ||
| 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'] || str_contains( $args['checked'], 'checked="checked"' ) ); | |
| 23 | -$disabled = ! empty( $args['disabled'] ); | |
| 24 | -$aria_checked = $checked ? 'true' : 'false'; | |
| 25 | -$input_html = $args['input_html'] ?? array(); | |
| 17 | +$div_class = isset( $args['div_class'] ) ? $args['div_class'] : false; | |
| 18 | +$show_labels = isset( $args['show_labels'] ) ? $args['show_labels'] : false; | |
| 19 | +$off_label = isset( $args['off_label'] ) ? $args['off_label'] : ''; | |
| 20 | +$on_label = isset( $args['on_label'] ) ? $args['on_label'] : 1; | |
| 21 | +$value = isset( $args['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 = isset( $args['input_html'] ) ? $args['input_html'] : array(); | |
| 26 | + | |
| 26 | 27 | $use_container = false; |
| 27 | 28 | |
| 28 | 29 | $div_params = array( |
| 29 | 30 | // This is important when the default style is !important as Pro styling may cause conflicts. |
| @@ -29,15 +30,14 @@ | ||
| 29 | 30 | // This is important when the default style is !important as Pro styling may cause conflicts. |
| 30 | 31 | // It uses --toggle-on-color so just set the variable. |
| 31 | 32 | 'style' => '--toggle-on-color:var(--primary-color);', |
| 32 | 33 | ); |
| 33 | - | |
| 34 | 34 | if ( $div_class ) { |
| 35 | 35 | $use_container = true; |
| 36 | 36 | $div_params['class'] = $div_class; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -if ( ! str_contains( $name, '[' ) ) { | |
| 39 | +if ( strpos( $name, '[' ) === false ) { | |
| 40 | 40 | $name .= '[]'; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | if ( $use_container ) { |
| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | } |
| 49 | 49 | ?> |
| 50 | 50 | <label class="frm_toggle_block" <?php FrmAppHelper::array_to_html_params( $div_params, true ); ?>> |
| 51 | 51 | <?php if ( $show_labels && $off_label ) { ?> |
| 52 | - <span class="frm_off_label frm_toggle_opt frm-leading-none"><?php echo esc_html( $off_label ); ?></span> | |
| 52 | + <span class="frm_off_label frm_toggle_opt"><?php echo esc_html( $off_label ); ?></span> | |
| 53 | 53 | <?php } ?> |
| 54 | 54 | |
| 55 | 55 | <input type="checkbox" name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $value ); ?>" |
| 56 | 56 | <?php checked( $checked, true ); ?> |
| @@ -76,11 +76,10 @@ | ||
| 76 | 76 | > |
| 77 | 77 | <span class="frm_toggle_slider"></span> |
| 78 | 78 | </span> |
| 79 | 79 | |
| 80 | - <?php // phpcs:ignore Universal.Operators.StrictComparisons ?> | |
| 81 | 80 | <?php if ( $show_labels && $on_label != 1 ) { ?> |
| 82 | - <span class="frm_on_label frm_toggle_opt frm-leading-none"><?php FrmAppHelper::kses_echo( $on_label, 'all' ); ?></span> | |
| 81 | + <span class="frm_on_label frm_toggle_opt"><?php FrmAppHelper::kses_echo( $on_label, 'all' ); ?></span> | |
| 83 | 82 | <?php } ?> |
| 84 | 83 | </label> |
| 85 | 84 | <?php if ( $use_container ) { ?> |
| 86 | 85 | </div> |