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