PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 4.0.2
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v4.0.2
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
post-carousel / admin / views / sp-framework / fields / border / border.php

border.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 4.0.2, at admin/views/sp-framework/fields/border/border.php

202 lines 8.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The framework border fields file.
4 *
5 * @package Smart_Post_Show
6 * @subpackage Smart_Post_Show/admin
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 die;
11 } // Cannot access directly.
12
13 if ( ! class_exists( 'SP_PC_Field_border' ) ) {
14 /**
15 * SP_PC_Field_border
16 */
17 class SP_PC_Field_border extends SP_PC_Fields {
18 /**
19 * Field constructor.
20 *
21 * @param array $field The field type.
22 * @param string $value The values of the field.
23 * @param string $unique The unique ID for the field.
24 * @param string $where To where show the output CSS.
25 * @param string $parent The parent args.
26 */
27 public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
28 parent::__construct( $field, $value, $unique, $where, $parent );
29 }
30
31 /**
32 * Render method.
33 *
34 * @return void
35 */
36 public function render() {
37
38 $args = wp_parse_args(
39 $this->field,
40 array(
41 'top_icon' => '<i class="fa fa-long-arrow-up"></i>',
42 'left_icon' => '<i class="fa fa-long-arrow-left"></i>',
43 'bottom_icon' => '<i class="fa fa-long-arrow-down"></i>',
44 'right_icon' => '<i class="fa fa-long-arrow-right"></i>',
45 'all_icon' => '<i class="sps-icon-border"></i>',
46 'top_placeholder' => esc_html__( 'top', 'post-carousel' ),
47 'right_placeholder' => esc_html__( 'right', 'post-carousel' ),
48 'bottom_placeholder' => esc_html__( 'bottom', 'post-carousel' ),
49 'left_placeholder' => esc_html__( 'left', 'post-carousel' ),
50 'all_placeholder' => esc_html__( 'all', 'post-carousel' ),
51 'top' => true,
52 'left' => true,
53 'bottom' => true,
54 'right' => true,
55 'all' => false,
56 'color' => true,
57 'style' => true,
58 'unit' => 'px',
59 'min' => '0',
60 'hover_color' => false,
61 'border_radius' => false,
62 'show_units' => false,
63 )
64 );
65
66 $default_value = array(
67 'top' => '',
68 'right' => '',
69 'bottom' => '',
70 'left' => '',
71 'color' => '',
72 'hover_color' => '',
73 'border_radius' => '',
74 'style' => 'solid',
75 'all' => '',
76 'min' => '',
77 );
78
79 $border_props = array(
80 'solid' => esc_html__( 'Solid', 'post-carousel' ),
81 'dashed' => esc_html__( 'Dashed', 'post-carousel' ),
82 'dotted' => esc_html__( 'Dotted', 'post-carousel' ),
83 'double' => esc_html__( 'Double', 'post-carousel' ),
84 'inset' => esc_html__( 'Inset', 'post-carousel' ),
85 'outset' => esc_html__( 'Outset', 'post-carousel' ),
86 'groove' => esc_html__( 'Groove', 'post-carousel' ),
87 'ridge' => esc_html__( 'ridge', 'post-carousel' ),
88 'none' => esc_html__( 'None', 'post-carousel' ),
89 );
90
91 $default_value = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_value ) : $default_value;
92
93 $value = wp_parse_args( $this->value, $default_value );
94
95 echo wp_kses_post( $this->field_before() );
96
97 echo '<div class="spf--inputs">';
98 $min = ( isset( $args['min'] ) ) ? ' min="' . $args['min'] . '"' : '';
99
100 if ( ! empty( $args['all'] ) ) {
101
102 $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : '';
103
104 echo '<div class="spf--border">';
105 echo '<div class="spf--title">' . esc_html__( 'Width', 'post-carousel' ) . '</div>';
106 echo '<div class="spf--input">';
107 echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args['all_icon'] ) . '</span>' : '';
108 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-input-number spf--is-unit" />';
109 echo ( ! empty( $args['unit'] ) ) ? '<span class="spf--label spf--unit">' . esc_html( $args['unit'] ) . '</span>' : '';
110 echo '</div>';
111 echo '</div>';
112
113 } else {
114
115 $properties = array();
116
117 foreach ( array( 'top', 'right', 'bottom', 'left' ) as $prop ) {
118 if ( ! empty( $args[ $prop ] ) ) {
119 $properties[] = $prop;
120 }
121 }
122
123 $properties = ( array( 'right', 'left' ) === $properties ) ? array_reverse( $properties ) : $properties;
124
125 foreach ( $properties as $property ) {
126
127 $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : '';
128
129 echo '<div class="spf--input">';
130 echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : '';
131 echo '<input type="number" name="' . esc_attr( $this->field_name( '[' . $property . ']' ) ) . '" value="' . esc_attr( $value[ $property ] ) . '"' . wp_kses_post( $placeholder . $min ) . ' class="spf-input-number spf--is-unit" />';
132 echo ( ! empty( $args['unit'] ) ) ? '<span class="spf--label spf--unit">' . esc_html( $args['unit'] ) . '</span>' : '';
133 echo '</div>';
134
135 }
136 }
137
138 if ( ! empty( $args['style'] ) ) {
139 echo '<div class="spf--border">';
140 echo '<div class="spf--title">' . esc_html__( 'Style', 'post-carousel' ) . '</div>';
141 echo '<div class="spf--input">';
142 echo '<select name="' . esc_attr( $this->field_name( '[style]' ) ) . '">';
143 foreach ( $border_props as $border_prop_key => $border_prop_value ) {
144 $selected = ( $value['style'] === $border_prop_key ) ? ' selected' : '';
145 echo '<option value="' . esc_attr( $border_prop_key ) . '"' . esc_attr( $selected ) . '>' . esc_html( $border_prop_value ) . '</option>';
146 }
147 echo '</select>';
148 echo '</div>';
149 echo '</div>';
150 }
151 echo '</div>';
152 if ( ! empty( $args['color'] ) ) {
153 $default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="' . esc_attr( $default_value['color'] ) . '"' : '';
154 echo '<div class="spf--color">';
155 echo '<div class="spf-field-color">';
156 echo '<div class="spf--title">' . esc_html__( 'Color', 'post-carousel' ) . '</div>';
157 echo '<input type="text" name="' . esc_attr( $this->field_name( '[color]' ) ) . '" value="' . esc_attr( $value['color'] ) . '" class="spf-color"' . wp_kses_post( $default_color_attr ) . ' />';
158 echo '</div>';
159 echo '</div>';
160 }
161 if ( ! empty( $args['hover_color'] ) ) {
162 $default_color_attr = ( ! empty( $default_value['hover_color'] ) ) ? ' data-default-color="' . esc_attr( $default_value['hover_color'] ) . '"' : '';
163 echo '<div class="spf--color">';
164 echo '<div class="spf-field-color">';
165 echo '<div class="spf--title">' . esc_html__( 'Hover Color', 'post-carousel' ) . '</div>';
166 echo '<input type="text" name="' . esc_attr( $this->field_name( '[hover_color]' ) ) . '" value="' . esc_attr( $value['hover_color'] ) . '" class="spf-color"' . wp_kses_post( $default_color_attr ) . ' />';
167 echo '</div>';
168 echo '</div>';
169 }
170
171 if ( ! empty( $args['border_radius'] ) ) {
172
173 $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? $args['all_placeholder'] : '';
174 echo '<div class="spf--color border-radius">';
175 echo '<div class="spf--title">' . esc_html__( 'Radius', 'post-carousel' ) . '</div>';
176 echo '<div class="spf--input">';
177 echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon"><i class="sps-icon-radius-01"></i></span>' : '';
178 echo '<input type="number" name="' . esc_attr( $this->field_name( '[border_radius]' ) ) . '" value="' . esc_attr( $value['border_radius'] ) . '" placeholder="' . esc_attr( $placeholder ) . '" class="spf-input-number spf--is-unit" step="any" />';
179 if ( $args['show_units'] && ( $args['units'] ) > 1 ) {
180 echo '<div class="spf--input spf--border-select">';
181 echo '<select name="' . esc_attr( $this->field_name( '[unit]' ) ) . '">';
182 foreach ( $args['units'] as $unit ) {
183 $selected = ( $value['unit'] === $unit ) ? ' selected' : '';
184 echo '<option value="' . esc_attr( $unit ) . '"' . esc_attr( $selected ) . '>' . esc_attr( $unit ) . '</option>';
185 }
186 echo '</select>';
187 echo '</div>';
188 } else {
189 echo ( ! empty( $args['unit'] ) ) ? '<span class="spf--label spf--unit">' . esc_attr( $args['unit'] ) . '</span>' : '';
190
191 }
192 echo '</div></div>';
193
194 }
195
196 echo '<div class="clear"></div>';
197
198 echo wp_kses_post( $this->field_after() );
199 }
200 }
201 }
202