← All changes
|
admin/views/sp-framework/fields/dimensions_advanced/dimensions_advanced.php
+45
-54
2.4.11
→
2.2.10
View file →
| @@ -28,14 +28,10 @@ | ||
| 28 | 28 | public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) { |
| 29 | 29 | parent::__construct( $field, $value, $unique, $where, $parent ); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - /** | |
| 33 | - * The render method. | |
| 34 | - * | |
| 35 | - * @return void | |
| 36 | - */ | |
| 37 | 32 | public function render() { |
| 33 | + | |
| 38 | 34 | $args = wp_parse_args( |
| 39 | 35 | $this->field, |
| 40 | 36 | array( |
| 41 | 37 | 'top_icon' => '<i class="fa fa-long-arrow-up"></i>', |
| @@ -42,13 +38,13 @@ | ||
| 42 | 38 | 'right_icon' => '<i class="fa fa-long-arrow-right"></i>', |
| 43 | 39 | 'left_icon' => '<i class="fa fa-long-arrow-left"></i>', |
| 44 | 40 | 'bottom_icon' => '<i class="fa fa-long-arrow-down"></i>', |
| 45 | 41 | 'all_icon' => '<i class="fa fa-arrows"></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' ), | |
| 42 | + 'top_placeholder' => esc_html__( 'top', 'smart-post-show' ), | |
| 43 | + 'right_placeholder' => esc_html__( 'right', 'smart-post-show' ), | |
| 44 | + 'bottom_placeholder' => esc_html__( 'bottom', 'smart-post-show' ), | |
| 45 | + 'left_placeholder' => esc_html__( 'left', 'smart-post-show' ), | |
| 46 | + 'all_placeholder' => esc_html__( 'all', 'smart-post-show' ), | |
| 51 | 47 | 'top' => true, |
| 52 | 48 | 'left' => true, |
| 53 | 49 | 'bottom' => true, |
| 54 | 50 | 'right' => true, |
| @@ -73,17 +69,17 @@ | ||
| 73 | 69 | 'unit' => 'px', |
| 74 | 70 | ); |
| 75 | 71 | |
| 76 | 72 | $border_props = array( |
| 77 | - 'solid' => esc_html__( 'Solid', 'post-carousel' ), | |
| 78 | - 'dashed' => esc_html__( 'Dashed', 'post-carousel' ), | |
| 79 | - 'dotted' => esc_html__( 'Dotted', 'post-carousel' ), | |
| 80 | - 'double' => esc_html__( 'Double', 'post-carousel' ), | |
| 81 | - 'inset' => esc_html__( 'Inset', 'post-carousel' ), | |
| 82 | - 'outset' => esc_html__( 'Outset', 'post-carousel' ), | |
| 83 | - 'groove' => esc_html__( 'Groove', 'post-carousel' ), | |
| 84 | - 'ridge' => esc_html__( 'ridge', 'post-carousel' ), | |
| 85 | - 'none' => esc_html__( 'None', 'post-carousel' ), | |
| 73 | + 'solid' => esc_html__( 'Solid', 'smart-post-show' ), | |
| 74 | + 'dashed' => esc_html__( 'Dashed', 'smart-post-show' ), | |
| 75 | + 'dotted' => esc_html__( 'Dotted', 'smart-post-show' ), | |
| 76 | + 'double' => esc_html__( 'Double', 'smart-post-show' ), | |
| 77 | + 'inset' => esc_html__( 'Inset', 'smart-post-show' ), | |
| 78 | + 'outset' => esc_html__( 'Outset', 'smart-post-show' ), | |
| 79 | + 'groove' => esc_html__( 'Groove', 'smart-post-show' ), | |
| 80 | + 'ridge' => esc_html__( 'ridge', 'smart-post-show' ), | |
| 81 | + 'none' => esc_html__( 'None', 'smart-post-show' ), | |
| 86 | 82 | ); |
| 87 | 83 | |
| 88 | 84 | $default_values = ( ! empty( $this->field['default'] ) ) ? wp_parse_args( $this->field['default'], $default_values ) : $default_values; |
| 89 | 85 | |
| @@ -90,9 +86,9 @@ | ||
| 90 | 86 | $value = wp_parse_args( $this->value, $default_values ); |
| 91 | 87 | $unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : ''; |
| 92 | 88 | $is_unit = ( ! empty( $unit ) ) ? ' spf--is-unit' : ''; |
| 93 | 89 | |
| 94 | - echo wp_kses_post( $this->field_before() ); | |
| 90 | + echo $this->field_before(); | |
| 95 | 91 | |
| 96 | 92 | $min = ( isset( $args['min'] ) ) ? ' min="' . $args['min'] . '"' : ''; |
| 97 | 93 | |
| 98 | 94 | echo '<div class="spf--inputs">'; |
| @@ -100,11 +96,11 @@ | ||
| 100 | 96 | |
| 101 | 97 | $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : ''; |
| 102 | 98 | |
| 103 | 99 | echo '<div class="spf--input">'; |
| 104 | - echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args['all_icon'] ) . '</span>' : ''; | |
| 105 | - echo '<input type="number" name="' . esc_attr( $this->field_name( '[all]' ) ) . '" value="' . esc_attr( $value['all'] ) . '"' . wp_kses_post( $placeholder . $min ) . ' class="spf-input-number' . esc_attr( $is_unit ) . '" />'; | |
| 106 | - echo ( $unit ) ? '<span class="spf--label spf--unit">' . esc_html( $args['units'][0] ) . '</span>' : ''; | |
| 100 | + echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon">' . $args['all_icon'] . '</span>' : ''; | |
| 101 | + echo '<input type="number" name="' . $this->field_name( '[all]' ) . '" value="' . $value['all'] . '"' . $placeholder . $min . ' class="spf-input-number' . $is_unit . '" />'; | |
| 102 | + echo ( $unit ) ? '<span class="spf--label spf--unit">' . $args['units'][0] . '</span>' : ''; | |
| 107 | 103 | echo '</div>'; |
| 108 | 104 | |
| 109 | 105 | } else { |
| 110 | 106 | |
| @@ -115,9 +111,9 @@ | ||
| 115 | 111 | $properties[] = $prop; |
| 116 | 112 | } |
| 117 | 113 | } |
| 118 | 114 | |
| 119 | - $properties = ( array( 'right', 'left' ) === $properties ) ? array_reverse( $properties ) : $properties; | |
| 115 | + $properties = ( $properties === array( 'right', 'left' ) ) ? array_reverse( $properties ) : $properties; | |
| 120 | 116 | |
| 121 | 117 | foreach ( $properties as $property ) { |
| 122 | 118 | |
| 123 | 119 | $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : ''; |
| @@ -122,11 +118,11 @@ | ||
| 122 | 118 | |
| 123 | 119 | $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : ''; |
| 124 | 120 | |
| 125 | 121 | echo '<div class="spf--input">'; |
| 126 | - echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : ''; | |
| 127 | - 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' . esc_attr( $is_unit ) . '" />'; | |
| 128 | - echo ( $unit ) ? '<span class="spf--label spf--unit">' . esc_html( $args['units'][0] ) . '</span>' : ''; | |
| 122 | + echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spf--label spf--icon">' . $args[ $property . '_icon' ] . '</span>' : ''; | |
| 123 | + echo '<input type="number" name="' . $this->field_name( '[' . $property . ']' ) . '" value="' . $value[ $property ] . '"' . $placeholder . $min . ' class="spf-input-number' . $is_unit . '" />'; | |
| 124 | + echo ( $unit ) ? '<span class="spf--label spf--unit">' . $args['units'][0] . '</span>' : ''; | |
| 129 | 125 | echo '</div>'; |
| 130 | 126 | |
| 131 | 127 | } |
| 132 | 128 | } |
| @@ -132,12 +128,12 @@ | ||
| 132 | 128 | } |
| 133 | 129 | |
| 134 | 130 | if ( ! empty( $args['style'] ) ) { |
| 135 | 131 | echo '<div class="spf--input">'; |
| 136 | - echo '<select name="' . esc_attr( $this->field_name( '[style]' ) ) . '">'; | |
| 132 | + echo '<select name="' . $this->field_name( '[style]' ) . '">'; | |
| 137 | 133 | foreach ( $args['styles'] as $style_prop ) { |
| 138 | 134 | $selected = ( $value['style'] === $style_prop ) ? ' selected' : ''; |
| 139 | - echo '<option value="' . esc_attr( $style_prop ) . '"' . esc_attr( $selected ) . '>' . wp_kses_post( $style_prop ) . '</option>'; | |
| 135 | + echo '<option value="' . $style_prop . '"' . $selected . '>' . $style_prop . '</option>'; | |
| 140 | 136 | } |
| 141 | 137 | echo '</select>'; |
| 142 | 138 | echo '</div>'; |
| 143 | 139 | } |
| @@ -144,23 +140,18 @@ | ||
| 144 | 140 | |
| 145 | 141 | if ( ! empty( $args['color'] ) ) { |
| 146 | 142 | $default_color_attr = ( ! empty( $default_values['color'] ) ) ? ' data-default-color="' . $default_values['color'] . '"' : ''; |
| 147 | 143 | echo '<div class="spf--left spf-field-color">'; |
| 148 | - 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 ) . ' />'; | |
| 144 | + echo '<input type="text" name="' . $this->field_name( '[color]' ) . '" value="' . $value['color'] . '" class="spf-color"' . $default_color_attr . ' />'; | |
| 149 | 145 | echo '</div>'; |
| 150 | 146 | } |
| 151 | 147 | |
| 152 | 148 | echo '</div>'; |
| 153 | 149 | |
| 154 | - echo wp_kses_post( $this->field_after() ); | |
| 150 | + echo $this->field_after(); | |
| 155 | 151 | |
| 156 | 152 | } |
| 157 | 153 | |
| 158 | - /** | |
| 159 | - * The output. | |
| 160 | - * | |
| 161 | - * @return mixed | |
| 162 | - */ | |
| 163 | 154 | public function output() { |
| 164 | 155 | |
| 165 | 156 | $output = ''; |
| 166 | 157 | $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px'; |
| @@ -167,33 +158,33 @@ | ||
| 167 | 158 | $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : ''; |
| 168 | 159 | $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output']; |
| 169 | 160 | |
| 170 | 161 | // properties. |
| 171 | - $top = ( isset( $this->value['top'] ) && '' !== $this->value['top'] ) ? $this->value['top'] : ''; | |
| 172 | - $right = ( isset( $this->value['right'] ) && '' !== $this->value['right'] ) ? $this->value['right'] : ''; | |
| 173 | - $bottom = ( isset( $this->value['bottom'] ) && '' !== $this->value['bottom'] ) ? $this->value['bottom'] : ''; | |
| 174 | - $left = ( isset( $this->value['left'] ) && '' !== $this->value['left'] ) ? $this->value['left'] : ''; | |
| 175 | - $style = ( isset( $this->value['style'] ) && '' !== $this->value['style'] ) ? $this->value['style'] : ''; | |
| 176 | - $color = ( isset( $this->value['color'] ) && '' !== $this->value['color'] ) ? $this->value['color'] : ''; | |
| 177 | - $all = ( isset( $this->value['all'] ) && '' !== $this->value['all'] ) ? $this->value['all'] : ''; | |
| 162 | + $top = ( isset( $this->value['top'] ) && $this->value['top'] !== '' ) ? $this->value['top'] : ''; | |
| 163 | + $right = ( isset( $this->value['right'] ) && $this->value['right'] !== '' ) ? $this->value['right'] : ''; | |
| 164 | + $bottom = ( isset( $this->value['bottom'] ) && $this->value['bottom'] !== '' ) ? $this->value['bottom'] : ''; | |
| 165 | + $left = ( isset( $this->value['left'] ) && $this->value['left'] !== '' ) ? $this->value['left'] : ''; | |
| 166 | + $style = ( isset( $this->value['style'] ) && $this->value['style'] !== '' ) ? $this->value['style'] : ''; | |
| 167 | + $color = ( isset( $this->value['color'] ) && $this->value['color'] !== '' ) ? $this->value['color'] : ''; | |
| 168 | + $all = ( isset( $this->value['all'] ) && $this->value['all'] !== '' ) ? $this->value['all'] : ''; | |
| 178 | 169 | |
| 179 | - if ( ! empty( $this->field['all'] ) && ( '' !== $all || '' !== $color ) ) { | |
| 170 | + if ( ! empty( $this->field['all'] ) && ( $all !== '' || $color !== '' ) ) { | |
| 180 | 171 | |
| 181 | 172 | $output = $element . '{'; |
| 182 | - $output .= ( '' !== $all ) ? 'border-width:' . $all . $unit . $important . ';' : ''; | |
| 183 | - $output .= ( '' !== $color ) ? 'border-color:' . $color . $important . ';' : ''; | |
| 184 | - $output .= ( '' !== $style ) ? 'border-style:' . $style . $important . ';' : ''; | |
| 173 | + $output .= ( $all !== '' ) ? 'border-width:' . $all . $unit . $important . ';' : ''; | |
| 174 | + $output .= ( $color !== '' ) ? 'border-color:' . $color . $important . ';' : ''; | |
| 175 | + $output .= ( $style !== '' ) ? 'border-style:' . $style . $important . ';' : ''; | |
| 185 | 176 | $output .= '}'; |
| 186 | 177 | |
| 187 | - } elseif ( '' !== $top || '' !== $right || '' !== $bottom || '' !== $left || '' !== $color ) { | |
| 178 | + } elseif ( $top !== '' || $right !== '' || $bottom !== '' || $left !== '' || $color !== '' ) { | |
| 188 | 179 | |
| 189 | 180 | $output = $element . '{'; |
| 190 | - $output .= ( '' !== $top ) ? 'border-top-width:' . $top . $unit . $important . ';' : ''; | |
| 191 | - $output .= ( '' !== $right ) ? 'border-right-width:' . $right . $unit . $important . ';' : ''; | |
| 192 | - $output .= ( '' !== $bottom ) ? 'border-bottom-width:' . $bottom . $unit . $important . ';' : ''; | |
| 193 | - $output .= ( '' !== $left ) ? 'border-left-width:' . $left . $unit . $important . ';' : ''; | |
| 194 | - $output .= ( '' !== $color ) ? 'border-color:' . $color . $important . ';' : ''; | |
| 195 | - $output .= ( '' !== $style ) ? 'border-style:' . $style . $important . ';' : ''; | |
| 181 | + $output .= ( $top !== '' ) ? 'border-top-width:' . $top . $unit . $important . ';' : ''; | |
| 182 | + $output .= ( $right !== '' ) ? 'border-right-width:' . $right . $unit . $important . ';' : ''; | |
| 183 | + $output .= ( $bottom !== '' ) ? 'border-bottom-width:' . $bottom . $unit . $important . ';' : ''; | |
| 184 | + $output .= ( $left !== '' ) ? 'border-left-width:' . $left . $unit . $important . ';' : ''; | |
| 185 | + $output .= ( $color !== '' ) ? 'border-color:' . $color . $important . ';' : ''; | |
| 186 | + $output .= ( $style !== '' ) ? 'border-style:' . $style . $important . ';' : ''; | |
| 196 | 187 | $output .= '}'; |
| 197 | 188 | |
| 198 | 189 | } |
| 199 | 190 | |