← All changes
|
Libs/adminify-framework/fields/checkbox/checkbox.php
+12
-12
4.2.21
→
4.0.3.7
View file →
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. |
| 2 | 2 | |
| 3 | -use PXLBSAdminify\Inc\Utils; | |
| 3 | +use WPAdminify\Inc\Utils; | |
| 4 | 4 | /** |
| 5 | 5 | * |
| 6 | 6 | * Field: checkbox |
| 7 | 7 | * |
| @@ -21,14 +21,14 @@ | ||
| 21 | 21 | $args = wp_parse_args( $this->field, array( |
| 22 | 22 | 'inline' => false, |
| 23 | 23 | 'query_args' => array(), |
| 24 | 24 | 'check_all' => false, |
| 25 | - 'check_all_text' => esc_html__( 'Check/Uncheck All', 'adminify' ), | |
| 25 | + 'check_all_text' => esc_html__( 'Check/Uncheck All' ), | |
| 26 | 26 | ) ); |
| 27 | 27 | |
| 28 | 28 | $inline_class = ( $args['inline'] ) ? ' class="adminify--inline-list"' : ''; |
| 29 | 29 | |
| 30 | - echo wp_kses_post( $this->field_before() ); | |
| 30 | + echo $this->field_before(); | |
| 31 | 31 | |
| 32 | 32 | if ( isset( $this->field['options'] ) ) { |
| 33 | 33 | |
| 34 | 34 | $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value ); |
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | $options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) ); |
| 37 | 37 | |
| 38 | 38 | if ( is_array( $options ) && ! empty( $options ) ) { |
| 39 | 39 | |
| 40 | - echo '<ul'. $inline_class .'>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- attribute value pre-escaped with esc_attr() where built. | |
| 40 | + echo '<ul'. $inline_class .'>'; | |
| 41 | 41 | |
| 42 | 42 | foreach ( $options as $option_key => $option_value ) { |
| 43 | 43 | |
| 44 | 44 | if ( is_array( $option_value ) && ! empty( $option_value ) ) { |
| @@ -49,10 +49,10 @@ | ||
| 49 | 49 | foreach ( $option_value as $sub_key => $sub_value ) { |
| 50 | 50 | $checked = ( in_array( $sub_key, $value ) ) ? ' checked' : ''; |
| 51 | 51 | echo '<li>'; |
| 52 | 52 | echo '<label>'; |
| 53 | - echo '<input type="checkbox" name="'. esc_attr( $this->field_name( '[]' ) ) .'" value="'. esc_attr( $sub_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- field_attributes() escapes each attribute via esc_attr() | |
| 54 | - echo '<span class="adminify--text">'. Utils::kses_custom( $sub_value ) .'</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. | |
| 53 | + echo '<input type="checkbox" name="'. esc_attr( $this->field_name( '[]' ) ) .'" value="'. esc_attr( $sub_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>'; | |
| 54 | + echo '<span class="adminify--text">'. Utils::wp_kses_custom( $sub_value ) .'</span>'; | |
| 55 | 55 | echo '</label>'; |
| 56 | 56 | echo '</li>'; |
| 57 | 57 | } |
| 58 | 58 | echo '</ul>'; |
| @@ -63,10 +63,10 @@ | ||
| 63 | 63 | $checked = ( in_array( $option_key, $value ) ) ? ' checked' : ''; |
| 64 | 64 | |
| 65 | 65 | echo '<li>'; |
| 66 | 66 | echo '<label>'; |
| 67 | - echo '<input type="checkbox" name="'. esc_attr( $this->field_name( '[]' ) ) .'" value="'. esc_attr( $option_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- field_attributes() escapes each attribute via esc_attr() | |
| 68 | - echo '<span class="adminify--text">'. Utils::kses_custom( $option_value ) .'</span>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. | |
| 67 | + echo '<input type="checkbox" name="'. esc_attr( $this->field_name( '[]' ) ) .'" value="'. esc_attr( $option_key ) .'"'. $this->field_attributes() . esc_attr( $checked ) .'/>'; | |
| 68 | + echo '<span class="adminify--text">'. Utils::wp_kses_custom( $option_value ) .'</span>'; | |
| 69 | 69 | echo '</label>'; |
| 70 | 70 | echo '</li>'; |
| 71 | 71 | |
| 72 | 72 | } |
| @@ -87,16 +87,16 @@ | ||
| 87 | 87 | |
| 88 | 88 | } else { |
| 89 | 89 | |
| 90 | 90 | echo '<label class="adminify-checkbox">'; |
| 91 | - echo '<input type="hidden" name="'. esc_attr( $this->field_name() ) .'" value="'. esc_attr( $this->value ) .'" class="adminify--input"'. $this->field_attributes() .'/>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- field_attributes() escapes each attribute via esc_attr() | |
| 92 | - echo '<input type="checkbox" name="_pseudo" class="adminify--checkbox"'. esc_attr( checked( $this->value, 1, false ) ) . $this->field_attributes() .'/>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- field_attributes() escapes each attribute via esc_attr() | |
| 93 | - echo ( ! empty( $this->field['label'] ) ) ? '<span class="adminify--text">'. Utils::kses_custom( $this->field['label'] ) .'</span>' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- kses_custom() is a wp_kses() wrapper; output already escaped. | |
| 91 | + echo '<input type="hidden" name="'. esc_attr( $this->field_name() ) .'" value="'. $this->value .'" class="adminify--input"'. $this->field_attributes() .'/>'; | |
| 92 | + echo '<input type="checkbox" name="_pseudo" class="adminify--checkbox"'. esc_attr( checked( $this->value, 1, false ) ) . $this->field_attributes() .'/>'; | |
| 93 | + echo ( ! empty( $this->field['label'] ) ) ? '<span class="adminify--text">'. Utils::wp_kses_custom( $this->field['label'] ) .'</span>' : ''; | |
| 94 | 94 | echo '</label>'; |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - echo wp_kses_post( $this->field_after() ); | |
| 98 | + echo $this->field_after(); | |
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | } |