PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
← All changes | admin/views/sp-framework/fields/select/select.php +20 -41 2.4.212.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 select fields file.
4 4 *
5 - * @package Smart_Post_Show
6 - * @subpackage Smart_Post_Show/admin
5 + * Field: select
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 -if ( ! class_exists( 'SP_PC_Field_select' ) ) {
14 - /**
15 - * SP_PC_Field_select
16 - */
10 +if ( ! class_exists( 'SP_PC_Field_select' ) ) {
17 11 class SP_PC_Field_select extends SP_PC_Fields {
18 12
19 13 /**
20 14 * The select field constructor.
@@ -50,14 +44,12 @@
50 44 );
51 45
52 46 $this->value = ( is_array( $this->value ) ) ? $this->value : array_filter( (array) $this->value );
53 47
54 - echo wp_kses_post( $this->field_before() );
48 + echo $this->field_before();
55 49
56 50 if ( isset( $this->field['options'] ) ) {
57 51
58 - $multiple_type = isset( $this->field['multiple_type'] ) ? $this->field['multiple_type'] : false;
59 -
60 52 if ( ! empty( $args['ajax'] ) ) {
61 53 $args['settings']['data']['type'] = $args['options'];
62 54 $args['settings']['data']['nonce'] = wp_create_nonce( 'spf_chosen_ajax_nonce' );
63 55 if ( ! empty( $args['query_args'] ) ) {
@@ -74,68 +66,55 @@
74 66 $field_class = ( $args['chosen'] ) ? ' class="spf-chosen' . $chosen_rtl . $chosen_sortable . $chosen_ajax . '"' : '';
75 67 $field_name = $this->field_name( $multiple_name );
76 68 $field_attr = $this->field_attributes();
77 69 $maybe_options = $this->field['options'];
78 - $field_unique = $this->unique;
70 + $field_unique = $this->unique;
79 71 $chosen_data_attr = ( $args['chosen'] && ! empty( $args['settings'] ) ) ? ' data-chosen-settings="' . esc_attr( json_encode( $args['settings'] ) ) . '"' : '';
80 72 if ( is_string( $maybe_options ) && ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) {
81 73 $options = $this->field_wp_query_data_title( $maybe_options, $this->value );
82 74 } elseif ( is_string( $maybe_options ) ) {
83 - $options = $this->field_data( $maybe_options, false, $args['query_args'], $field_unique );
75 + $options = $this->field_data( $maybe_options, false, $args['query_args'], $field_unique);
84 76 } else {
85 77 $options = $maybe_options;
86 78 }
87 - if ( ( is_array( $options ) && ! empty( $options ) ) || ( ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) ) {
79 + if( ( is_array( $options ) && ! empty( $options ) ) || ( ! empty( $args['chosen'] ) && ! empty( $args['ajax'] ) ) ) {
88 80 if ( ! empty( $args['chosen'] ) && ! empty( $args['multiple'] ) ) {
89 - echo '<select name="' . esc_attr( $field_name ) . '" class="spf-hidden-select spf-hidden"' . wp_kses_post( $multiple_attr . $field_attr ) . '>';
81 + echo '<select name="' . $field_name . '" class="spf-hidden-select spf-hidden"' . $multiple_attr . $field_attr . '>';
90 82 foreach ( $this->value as $option_key ) {
91 - echo '<option value="' . esc_attr( $option_key ) . '" selected>' . esc_html( $option_key ) . '</option>';
83 + echo '<option value="' . $option_key . '" selected>' . $option_key . '</option>';
92 84 }
93 85 echo '</select>';
94 86 $field_name = '_pseudo';
95 87 $field_attr = '';
96 88 }
97 - echo '<select name="' . esc_attr( $field_name ) . '"' . wp_kses_post( $field_class . $multiple_attr . $placeholder_attr . $field_attr . $chosen_data_attr ) . '>';
89 + echo '<select name="' . $field_name . '"' . $field_class . $multiple_attr . $placeholder_attr . $field_attr . $chosen_data_attr . '>';
98 90 if ( $args['placeholder'] && empty( $args['multiple'] ) ) {
99 91 if ( ! empty( $args['chosen'] ) ) {
100 92 echo '<option value=""></option>';
101 93 } else {
102 - echo '<option value="">' . esc_html( $args['placeholder'] ) . '</option>';
94 + echo '<option value="">' . $args['placeholder'] . '</option>';
103 95 }
104 96 }
105 - if ( $multiple_type ) {
106 - $options = array_merge(
107 - $options,
108 - array(
109 - 'multiple_post_type' => __( 'Multiple Post Types (Pro)', 'post-carousel' ),
110 - )
111 - );
112 - }
113 97 foreach ( $options as $option_key => $option ) {
114 98 if ( is_array( $option ) && ! empty( $option ) ) {
115 - echo '<optgroup label="' . esc_attr( $option_key ) . '">';
99 + echo '<optgroup label="' . $option_key . '">';
116 100 foreach ( $option as $sub_key => $sub_value ) {
117 101 $selected = ( in_array( $sub_key, $this->value ) ) ? ' selected' : '';
118 - echo '<option value="' . esc_attr( $sub_key ) . '" ' . esc_attr( $selected ) . '>' . wp_kses_post( $sub_value ) . '</option>';
102 + echo '<option value="' . $sub_key . '" ' . $selected . '>' . $sub_value . '</option>';
119 103 }
120 104 echo '</optgroup>';
121 105 } else {
122 106 $selected = ( in_array( $option_key, $this->value ) ) ? ' selected' : '';
123 - echo '<option value="' . esc_attr( $option_key ) . '" ' . esc_attr( $selected ) . '>' . wp_kses_post( $option ) . '</option>';
107 + echo '<option value="' . $option_key . '" ' . $selected . '>' . $option . '</option>';
124 108 }
125 109 }
126 110 echo '</select>';
127 111 } else {
128 - 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' );
112 + echo ( ! empty( $this->field['empty_message'] ) ) ? $this->field['empty_message'] : esc_html__( 'No data provided for this option type.', 'smart-post-show' );
129 113 }
130 114 }
131 - echo wp_kses_post( $this->field_after() );
115 + echo $this->field_after();
132 116 }
133 - /**
134 - * Enqueue UI Sortable.
135 - *
136 - * @return void
137 - */
138 117 public function enqueue() {
139 118 if ( ! wp_script_is( 'jquery-ui-sortable' ) ) {
140 119 wp_enqueue_script( 'jquery-ui-sortable' );
141 120 }