← All changes
|
admin/views/sp-framework/fields/checkbox/checkbox.php
+17
-23
2.4.20
→
2.2.10
View file →
| @@ -1,20 +1,14 @@ | ||
| 1 | -<?php | |
| 1 | +<?php if ( ! defined( 'ABSPATH' ) ) { | |
| 2 | + die; } // Cannot access directly. | |
| 2 | 3 | /** |
| 3 | - * The framework checkbox fields file. | |
| 4 | 4 | * |
| 5 | - * @package Smart_Post_Show | |
| 6 | - * @subpackage Smart_Post_Show/admin | |
| 5 | + * Field: checkbox | |
| 6 | + * | |
| 7 | + * @since 1.0.0 | |
| 8 | + * @version 1.0.0 | |
| 7 | 9 | */ |
| 8 | - | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | - die; | |
| 11 | -} // Cannot access directly. | |
| 12 | - | |
| 13 | 10 | if ( ! class_exists( 'SP_PC_Field_checkbox' ) ) { |
| 14 | - /** | |
| 15 | - * SP_PC_Field_checkbox | |
| 16 | - */ | |
| 17 | 11 | class SP_PC_Field_checkbox extends SP_PC_Fields { |
| 18 | 12 | |
| 19 | 13 | /** |
| 20 | 14 | * The checkbox field constructor. |
| @@ -38,9 +32,9 @@ | ||
| 38 | 32 | |
| 39 | 33 | $args = wp_parse_args( |
| 40 | 34 | $this->field, |
| 41 | 35 | array( |
| 42 | - 'inline' => false, | |
| 36 | + 'inline' => false, | |
| 43 | 37 | 'query_args' => array(), |
| 44 | 38 | ) |
| 45 | 39 | ); |
| 46 | 40 | |
| @@ -45,9 +39,9 @@ | ||
| 45 | 39 | ); |
| 46 | 40 | |
| 47 | 41 | $inline_class = ( $args['inline'] ) ? ' class="spf--inline-list"' : ''; |
| 48 | 42 | |
| 49 | - echo wp_kses_post( $this->field_before() ); | |
| 43 | + echo $this->field_before(); | |
| 50 | 44 | |
| 51 | 45 | if ( isset( $this->field['options'] ) ) { |
| 52 | 46 | |
| 53 | 47 | $value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value ); |
| @@ -55,18 +49,18 @@ | ||
| 55 | 49 | $options = ( is_array( $options ) ) ? $options : array_filter( $this->field_data( $options, false, $args['query_args'] ) ); |
| 56 | 50 | |
| 57 | 51 | if ( is_array( $options ) && ! empty( $options ) ) { |
| 58 | 52 | |
| 59 | - echo '<ul' . wp_kses_post( $inline_class ) . '>'; | |
| 53 | + echo '<ul' . $inline_class . '>'; | |
| 60 | 54 | foreach ( $options as $option_key => $pcp_metabox_value ) { |
| 61 | 55 | if ( is_array( $pcp_metabox_value ) && ! empty( $pcp_metabox_value ) ) { |
| 62 | 56 | |
| 63 | 57 | echo '<li>'; |
| 64 | 58 | echo '<ul>'; |
| 65 | - echo '<li><strong>' . esc_html( $option_key ) . '</strong></li>'; | |
| 59 | + echo '<li><strong>' . $option_key . '</strong></li>'; | |
| 66 | 60 | foreach ( $pcp_metabox_value as $sub_key => $sub_value ) { |
| 67 | 61 | $checked = ( in_array( $sub_key, $value ) ) ? ' checked' : ''; |
| 68 | - echo '<li><label><input type="checkbox" name="' . esc_attr( $this->field_name( '[]' ) ) . '" value="' . esc_attr( $sub_key ) . '"' . wp_kses_post( $this->field_attributes() ) . esc_attr( $checked ) . '/> ' . esc_html( $sub_value ) . '</label></li>'; | |
| 62 | + echo '<li><label><input type="checkbox" name="' . $this->field_name( '[]' ) . '" value="' . $sub_key . '"' . $this->field_attributes() . $checked . '/> ' . $sub_value . '</label></li>'; | |
| 69 | 63 | } |
| 70 | 64 | echo '</ul>'; |
| 71 | 65 | echo '</li>'; |
| 72 | 66 | |
| @@ -72,9 +66,9 @@ | ||
| 72 | 66 | |
| 73 | 67 | } else { |
| 74 | 68 | |
| 75 | 69 | $checked = ( in_array( $option_key, $value ) ) ? ' checked' : ''; |
| 76 | - echo '<li><label><input type="checkbox" name="' . esc_attr( $this->field_name( '[]' ) ) . '" value="' . esc_attr( $option_key ) . '"' . wp_kses_post( $this->field_attributes() ) . esc_attr( $checked ) . '/> ' . esc_html( $pcp_metabox_value ) . '</label></li>'; | |
| 70 | + echo '<li><label><input type="checkbox" name="' . $this->field_name( '[]' ) . '" value="' . $option_key . '"' . $this->field_attributes() . $checked . '/> ' . $pcp_metabox_value . '</label></li>'; | |
| 77 | 71 | |
| 78 | 72 | } |
| 79 | 73 | } |
| 80 | 74 | echo '</ul>'; |
| @@ -80,20 +74,20 @@ | ||
| 80 | 74 | echo '</ul>'; |
| 81 | 75 | |
| 82 | 76 | } else { |
| 83 | 77 | |
| 84 | - echo ( esc_html( ! empty( $this->field['empty_message'] ) ) ) ? esc_html( $this->field['empty_message'] ) : esc_html__( 'No data provided for this option type.', 'post-carousel' ); | |
| 78 | + echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'smart-post-show' ); | |
| 85 | 79 | |
| 86 | 80 | } |
| 87 | 81 | } else { |
| 88 | 82 | echo '<label class="spf-checkbox">'; |
| 89 | - echo '<input type="hidden" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $this->value ) . '" class="spf--input"' . wp_kses_post( $this->field_attributes() ) . '/>'; | |
| 90 | - echo '<input type="checkbox" name="_pseudo" class="spf--checkbox"' . checked( $this->value, 1, false ) . '/>'; | |
| 91 | - echo ( ! empty( $this->field['label'] ) ) ? ' ' . esc_html( $this->field['label'] ) : ''; | |
| 83 | + echo '<input type="hidden" name="' . $this->field_name() . '" value="' . $this->value . '" class="spf--input"' . $this->field_attributes() . '/>'; | |
| 84 | + echo '<input type="checkbox" name="_pseudo" class="spf--checkbox"'. checked( $this->value, 1, false ) .'/>'; | |
| 85 | + echo ( ! empty( $this->field['label'] ) ) ? ' ' . $this->field['label'] : ''; | |
| 92 | 86 | echo '</label>'; |
| 93 | 87 | } |
| 94 | 88 | |
| 95 | - echo wp_kses_post( $this->field_after() ); | |
| 89 | + echo $this->field_after(); | |
| 96 | 90 | |
| 97 | 91 | } |
| 98 | 92 | |
| 99 | 93 | } |