← All changes
|
admin/views/sp-framework/fields/spacing/spacing.php
+23
-28
2.4.10
→
2.2.10
View file →
| @@ -37,13 +37,13 @@ | ||
| 37 | 37 | 'right_icon' => '<i class="fa fa-long-arrow-right"></i>', |
| 38 | 38 | 'bottom_icon' => '<i class="fa fa-long-arrow-down"></i>', |
| 39 | 39 | 'left_icon' => '<i class="fa fa-long-arrow-left"></i>', |
| 40 | 40 | 'all_icon' => '<i class="fa fa-arrows"></i>', |
| 41 | - 'top_placeholder' => esc_html__( 'top', 'post-carousel' ), | |
| 42 | - 'right_placeholder' => esc_html__( 'right', 'post-carousel' ), | |
| 43 | - 'bottom_placeholder' => esc_html__( 'bottom', 'post-carousel' ), | |
| 44 | - 'left_placeholder' => esc_html__( 'left', 'post-carousel' ), | |
| 45 | - 'all_placeholder' => esc_html__( 'all', 'post-carousel' ), | |
| 41 | + 'top_placeholder' => esc_html__( 'top', 'smart-post-show' ), | |
| 42 | + 'right_placeholder' => esc_html__( 'right', 'smart-post-show' ), | |
| 43 | + 'bottom_placeholder' => esc_html__( 'bottom', 'smart-post-show' ), | |
| 44 | + 'left_placeholder' => esc_html__( 'left', 'smart-post-show' ), | |
| 45 | + 'all_placeholder' => esc_html__( 'all', 'smart-post-show' ), | |
| 46 | 46 | 'top' => true, |
| 47 | 47 | 'left' => true, |
| 48 | 48 | 'bottom' => true, |
| 49 | 49 | 'right' => true, |
| @@ -68,9 +68,9 @@ | ||
| 68 | 68 | $value = wp_parse_args( $this->value, $default_values ); |
| 69 | 69 | $unit = ( count( $args['units'] ) === 1 && ! empty( $args['unit'] ) ) ? $args['units'][0] : ''; |
| 70 | 70 | $is_unit = ( ! empty( $unit ) ) ? ' spf--is-unit' : ''; |
| 71 | 71 | |
| 72 | - echo wp_kses_post( $this->field_before() ); | |
| 72 | + echo $this->field_before(); | |
| 73 | 73 | |
| 74 | 74 | $min = ( isset( $args['min'] ) ) ? ' min="' . $args['min'] . '"' : ''; |
| 75 | 75 | |
| 76 | 76 | echo '<div class="spf--inputs">'; |
| @@ -79,11 +79,11 @@ | ||
| 79 | 79 | |
| 80 | 80 | $placeholder = ( ! empty( $args['all_placeholder'] ) ) ? ' placeholder="' . $args['all_placeholder'] . '"' : ''; |
| 81 | 81 | |
| 82 | 82 | echo '<div class="spf--input">'; |
| 83 | - echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args['all_icon'] ) . '</span>' : ''; | |
| 84 | - 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 ) . '" />'; | |
| 85 | - echo ( $unit ) ? '<span class="spf--label spf--unit">' . wp_kses_post( $args['units'][0] ) . '</span>' : ''; | |
| 83 | + echo ( ! empty( $args['all_icon'] ) ) ? '<span class="spf--label spf--icon">' . $args['all_icon'] . '</span>' : ''; | |
| 84 | + echo '<input type="number" name="' . $this->field_name( '[all]' ) . '" value="' . $value['all'] . '"' . $placeholder . $min . ' class="spf-input-number' . $is_unit . '" />'; | |
| 85 | + echo ( $unit ) ? '<span class="spf--label spf--unit">' . $args['units'][0] . '</span>' : ''; | |
| 86 | 86 | echo '</div>'; |
| 87 | 87 | |
| 88 | 88 | } else { |
| 89 | 89 | |
| @@ -94,9 +94,9 @@ | ||
| 94 | 94 | $properties[] = $prop; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $properties = ( array( 'right', 'left' ) === $properties ) ? array_reverse( $properties ) : $properties; | |
| 98 | + $properties = ( $properties === array( 'right', 'left' ) ) ? array_reverse( $properties ) : $properties; | |
| 99 | 99 | |
| 100 | 100 | foreach ( $properties as $property ) { |
| 101 | 101 | |
| 102 | 102 | $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : ''; |
| @@ -101,11 +101,11 @@ | ||
| 101 | 101 | |
| 102 | 102 | $placeholder = ( ! empty( $args[ $property . '_placeholder' ] ) ) ? ' placeholder="' . $args[ $property . '_placeholder' ] . '"' : ''; |
| 103 | 103 | |
| 104 | 104 | echo '<div class="spf--input">'; |
| 105 | - echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spf--label spf--icon">' . wp_kses_post( $args[ $property . '_icon' ] ) . '</span>' : ''; | |
| 106 | - 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 ) . '" />'; | |
| 107 | - echo ( $unit ) ? '<span class="spf--label spf--unit">' . wp_kses_post( $args['units'][0] ) . '</span>' : ''; | |
| 105 | + echo ( ! empty( $args[ $property . '_icon' ] ) ) ? '<span class="spf--label spf--icon">' . $args[ $property . '_icon' ] . '</span>' : ''; | |
| 106 | + echo '<input type="number" name="' . $this->field_name( '[' . $property . ']' ) . '" value="' . $value[ $property ] . '"' . $placeholder . $min . ' class="spf-input-number' . $is_unit . '" />'; | |
| 107 | + echo ( $unit ) ? '<span class="spf--label spf--unit">' . $args['units'][0] . '</span>' : ''; | |
| 108 | 108 | echo '</div>'; |
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | } |
| @@ -111,12 +111,12 @@ | ||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if ( ! empty( $args['unit'] ) && ! empty( $args['show_units'] ) && count( $args['units'] ) > 1 ) { |
| 114 | 114 | echo '<div class="spf--input">'; |
| 115 | - echo '<select name="' . esc_attr( $this->field_name( '[unit]' ) ) . '">'; | |
| 115 | + echo '<select name="' . $this->field_name( '[unit]' ) . '">'; | |
| 116 | 116 | foreach ( $args['units'] as $unit ) { |
| 117 | 117 | $selected = ( $value['unit'] === $unit ) ? ' selected' : ''; |
| 118 | - echo '<option value="' . esc_attr( $unit ) . '"' . esc_attr( $selected ) . '>' . esc_html( $unit ) . '</option>'; | |
| 118 | + echo '<option value="' . $unit . '"' . $selected . '>' . $unit . '</option>'; | |
| 119 | 119 | } |
| 120 | 120 | echo '</select>'; |
| 121 | 121 | echo '</div>'; |
| 122 | 122 | } |
| @@ -122,17 +122,12 @@ | ||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | echo '</div>'; |
| 125 | 125 | |
| 126 | - echo wp_kses_post( $this->field_after() ); | |
| 126 | + echo $this->field_after(); | |
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - /** | |
| 131 | - * The output. | |
| 132 | - * | |
| 133 | - * @return mixed | |
| 134 | - */ | |
| 135 | 130 | public function output() { |
| 136 | 131 | |
| 137 | 132 | $output = ''; |
| 138 | 133 | $element = ( is_array( $this->field['output'] ) ) ? join( ',', $this->field['output'] ) : $this->field['output']; |
| @@ -139,12 +134,12 @@ | ||
| 139 | 134 | $important = ( ! empty( $this->field['output_important'] ) ) ? '!important' : ''; |
| 140 | 135 | $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : 'px'; |
| 141 | 136 | |
| 142 | 137 | $mode = ( ! empty( $this->field['output_mode'] ) ) ? $this->field['output_mode'] : 'padding'; |
| 143 | - $mode = ( 'relative' === $mode || 'absolute' === $mode || 'none' === $mode ) ? '' : $mode; | |
| 138 | + $mode = ( $mode === 'relative' || $mode === 'absolute' || $mode === 'none' ) ? '' : $mode; | |
| 144 | 139 | $mode = ( ! empty( $mode ) ) ? $mode . '-' : ''; |
| 145 | 140 | |
| 146 | - if ( ! empty( $this->field['all'] ) && isset( $this->value['all'] ) && '' !== $this->value['all'] ) { | |
| 141 | + if ( ! empty( $this->field['all'] ) && isset( $this->value['all'] ) && $this->value['all'] !== '' ) { | |
| 147 | 142 | |
| 148 | 143 | $output = $element . '{'; |
| 149 | 144 | $output .= $mode . 'top:' . $this->value['all'] . $unit . $important . ';'; |
| 150 | 145 | $output .= $mode . 'right:' . $this->value['all'] . $unit . $important . ';'; |
| @@ -153,14 +148,14 @@ | ||
| 153 | 148 | $output .= '}'; |
| 154 | 149 | |
| 155 | 150 | } else { |
| 156 | 151 | |
| 157 | - $top = ( isset( $this->value['top'] ) && '' !== $this->value['top'] ) ? $mode . 'top:' . $this->value['top'] . $unit . $important . ';' : ''; | |
| 158 | - $right = ( isset( $this->value['right'] ) && '' !== $this->value['right'] ) ? $mode . 'right:' . $this->value['right'] . $unit . $important . ';' : ''; | |
| 159 | - $bottom = ( isset( $this->value['bottom'] ) && '' !== $this->value['bottom'] ) ? $mode . 'bottom:' . $this->value['bottom'] . $unit . $important . ';' : ''; | |
| 160 | - $left = ( isset( $this->value['left'] ) && '' !== $this->value['left'] ) ? $mode . 'left:' . $this->value['left'] . $unit . $important . ';' : ''; | |
| 152 | + $top = ( isset( $this->value['top'] ) && $this->value['top'] !== '' ) ? $mode . 'top:' . $this->value['top'] . $unit . $important . ';' : ''; | |
| 153 | + $right = ( isset( $this->value['right'] ) && $this->value['right'] !== '' ) ? $mode . 'right:' . $this->value['right'] . $unit . $important . ';' : ''; | |
| 154 | + $bottom = ( isset( $this->value['bottom'] ) && $this->value['bottom'] !== '' ) ? $mode . 'bottom:' . $this->value['bottom'] . $unit . $important . ';' : ''; | |
| 155 | + $left = ( isset( $this->value['left'] ) && $this->value['left'] !== '' ) ? $mode . 'left:' . $this->value['left'] . $unit . $important . ';' : ''; | |
| 161 | 156 | |
| 162 | - if ( '' !== $top || '' !== $right || '' !== $bottom || '' !== $left ) { | |
| 157 | + if ( $top !== '' || $right !== '' || $bottom !== '' || $left !== '' ) { | |
| 163 | 158 | $output = $element . '{' . $top . $right . $bottom . $left . '}'; |
| 164 | 159 | } |
| 165 | 160 | } |
| 166 | 161 | |