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/column/column.php +65 -27 2.4.132.2.10 View file →
@@ -1,13 +1,5 @@
1 -<?php
2 -/**
3 - * The framework column fields file.
4 - *
5 - * @package Smart_Post_Show
6 - * @subpackage Smart_Post_Show/admin
7 - */
8 -
9 -if ( ! defined( 'ABSPATH' ) ) {
1 +<?php if ( ! defined( 'ABSPATH' ) ) {
10 2 die; } // Cannot access directly.
11 3 /**
12 4 *
13 5 * Field: column
@@ -50,20 +42,20 @@
50 42 'tablet_icon' => '<i class="fa fa-tablet"></i>',
51 43 'mobile_landscape_icon' => '<i class="fa fa-mobile"></i>',
52 44 'mobile_icon' => '<i class="fa fa-mobile"></i>',
53 45 'all_icon' => '<i class="fa fa-arrows"></i>',
54 - 'lg_desktop_placeholder' => esc_html__( 'Large Desktop', 'post-carousel' ),
55 - 'desktop_placeholder' => esc_html__( 'Desktop', 'post-carousel' ),
56 - 'tablet_placeholder' => esc_html__( 'Tablet', 'post-carousel' ),
57 - 'mobile_landscape_placeholder' => esc_html__( 'Mobile Landscape', 'post-carousel' ),
58 - 'mobile_placeholder' => esc_html__( 'Mobile', 'post-carousel' ),
59 - 'all_placeholder' => esc_html__( 'all', 'post-carousel' ),
46 + 'lg_desktop_placeholder' => esc_html__( 'Large Desktop', 'smart-post-show' ),
47 + 'desktop_placeholder' => esc_html__( 'Desktop', 'smart-post-show' ),
48 + 'tablet_placeholder' => esc_html__( 'Tablet', 'smart-post-show' ),
49 + 'mobile_landscape_placeholder' => esc_html__( 'Mobile Landscape', 'smart-post-show' ),
50 + 'mobile_placeholder' => esc_html__( 'Mobile', 'smart-post-show' ),
51 + 'all_placeholder' => esc_html__( 'all', 'smart-post-show' ),
60 52 'lg_desktop' => true,
61 53 'desktop' => true,
62 54 'tablet' => true,
63 55 'mobile_landscape' => true,
64 56 'mobile' => true,
65 - 'min' => '1',
57 + 'min' => '0',
66 58 'unit' => false,
67 59 'all' => false,
68 60 'units' => array( 'px', '%', 'em' ),
69 61 )
@@ -84,9 +76,9 @@
84 76 $value = wp_parse_args( $this->value, $default_values );
85 77 $unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : '';
86 78 $is_unit = ( ! empty( $unit ) ) ? ' spf--is-unit' : '';
87 79
88 - echo wp_kses_post( $this->field_before() );
80 + echo $this->field_before();
89 81
90 82 echo '<div class="spf--inputs">';
91 83
92 84 $min = ( isset( $args['min'] ) ) ? ' min="' . $args['min'] . '"' : '';
@@ -94,11 +86,11 @@
94 86
95 87 $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : '';
96 88
97 89 echo '<div class="spf--input">';
98 - echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args['all_icon'] ) . '</span>' : '';
99 - echo '<input type="number" name="' . esc_attr( $this->field_name( '[all]' ) ) . '" value="' . esc_attr( $value['all'] ) . '"' . wp_kses_post( $placeholder ) . wp_kses_post( $min ) . ' class="spf-number" required/>';
100 - echo ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? '<span class="spf--label spf--unit">' . esc_html( $args['units'][0] ) . '</span>' : '';
90 + echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon">' . $args['all_icon'] . '</span>' : '';
91 + echo '<input type="number" name="' . $this->field_name( '[all]' ) . '" value="' . $value['all'] . '"' . $placeholder . $min . ' class="spf-number" />';
92 + echo ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? '<span class="spf--label spf--unit">' . $args['units'][0] . '</span>' : '';
101 93 echo '</div>';
102 94
103 95 } else {
104 96
@@ -109,9 +101,9 @@
109 101 $properties[] = $prop;
110 102 }
111 103 }
112 104
113 - $properties = ( array( 'tablet', 'mobile' ) === $properties ) ? array_reverse( $properties ) : $properties;
105 + $properties = ( $properties === array( 'tablet', 'mobile' ) ) ? array_reverse( $properties ) : $properties;
114 106
115 107 foreach ( $properties as $property ) {
116 108
117 109 $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
@@ -116,11 +108,11 @@
116 108
117 109 $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
118 110
119 111 echo '<div class="spf--input">';
120 - echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : '';
121 - echo '<input type="number" name="' . esc_attr( $this->field_name( '[' . $property . ']' ) ) . '" value="' . esc_attr( $value[ $property ] ) . '"' . wp_kses_post( $placeholder ) . wp_kses_post( $min ) . ' class="spf-number" required/>';
122 - echo ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? '<span class="spf--label spf--unit">' . esc_html( $args['units'][0] ) . '</span>' : '';
112 + echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spf--label spf--icon">' . $args[ $property . '_icon' ] . '</span>' : '';
113 + echo '<input type="number" name="' . $this->field_name( '[' . $property . ']' ) . '" value="' . $value[ $property ] . '"' . $placeholder . $min . ' class="spf-number" />';
114 + echo ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? '<span class="spf--label spf--unit">' . $args['units'][0] . '</span>' : '';
123 115 echo '</div>';
124 116
125 117 }
126 118 }
@@ -127,12 +119,12 @@
127 119
128 120 if ( ! empty( $args['unit'] ) && count( $args['units'] ) > 1 ) {
129 121 echo '<div class="spf--input">';
130 122
131 - echo '<select name="' . esc_attr( $this->field_name( '[unit]' ) ) . '">';
123 + echo '<select name="' . $this->field_name( '[unit]' ) . '">';
132 124 foreach ( $args['units'] as $unit ) {
133 125 $selected = ( $value['unit'] === $unit ) ? ' selected' : '';
134 - echo '<option value="' . esc_attr( $unit ) . '"' . esc_attr( $selected ) . '>' . esc_html( $unit ) . '</option>';
126 + echo '<option value="' . $unit . '"' . $selected . '>' . $unit . '</option>';
135 127 }
136 128 echo '</select>';
137 129 echo '</div>';
138 130 }
@@ -138,9 +130,55 @@
138 130 }
139 131
140 132 echo '</div>';
141 133
142 - echo wp_kses_post( $this->field_after() );
134 + echo $this->field_after();
143 135
144 136 }
137 +
138 + /**
139 + * The output function.
140 + *
141 + * @return void
142 + */
143 + public function output() {
144 +
145 + $output = '';
146 + $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output'];
147 + $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : '';
148 + $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px';
149 +
150 + $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'padding';
151 + $mode = ( $mode === 'relative' || $mode === 'absolute' || $mode === 'none' ) ? '' : $mode;
152 + $mode = ( ! empty( $mode ) ) ? $mode . '-' : '';
153 +
154 + if ( ! empty( $this->field['all'] ) && isset( $this->value['all'] ) && $this->value['all'] !== '' ) {
155 +
156 + $output = $element . '{';
157 + $output .= $mode . 'lg_desktop:' . $this->value['all'] . $unit . $important . ';';
158 + $output .= $mode . 'desktop:' . $this->value['all'] . $unit . $important . ';';
159 + $output .= $mode . 'tablet:' . $this->value['all'] . $unit . $important . ';';
160 + $output .= $mode . 'mobile_landscape:' . $this->value['all'] . $unit . $important . ';';
161 + $output .= $mode . 'mobile:' . $this->value['all'] . $unit . $important . ';';
162 + $output .= '}';
163 +
164 + } else {
165 +
166 + $lg_desktop = ( isset( $this->value['lg_desktop'] ) && $this->value['lg_desktop'] !== '' ) ? $mode . 'lg_desktop:' . $this->value['lg_desktop'] . $unit . $important . ';' : '';
167 + $desktop = ( isset( $this->value['desktop'] ) && $this->value['desktop'] !== '' ) ? $mode . 'desktop:' . $this->value['desktop'] . $unit . $important . ';' : '';
168 + $tablet = ( isset( $this->value['tablet'] ) && $this->value['tablet'] !== '' ) ? $mode . 'tablet:' . $this->value['tablet'] . $unit . $important . ';' : '';
169 + $mobile_landscape = ( isset( $this->value['mobile_landscape'] ) && $this->value['mobile_landscape'] !== '' ) ? $mode . 'mobile_landscape:' . $this->value['mobile_landscape'] . $unit . $important . ';' : '';
170 + $mobile = ( isset( $this->value['mobile'] ) && $this->value['mobile'] !== '' ) ? $mode . 'mobile:' . $this->value['mobile'] . $unit . $important . ';' : '';
171 +
172 + if ( $lg_desktop !== '' || $desktop !== '' || $tablet !== '' || $mobile_landscape !== '' || $mobile !== '' ) {
173 + $output = $element . '{' . $lg_desktop . $desktop . $tablet . $mobile_landscape . $mobile . '}';
174 + }
175 + }
176 +
177 + $this->parent->output_css .= $output;
178 +
179 + return $output;
180 +
181 + }
182 +
145 183 }
146 184 }