← All changes
|
admin/views/sp-framework/fields/typography/typography.php
+101
-132
2.4.10
→
2.2.10
View file →
| @@ -17,14 +17,11 @@ | ||
| 17 | 17 | public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) { |
| 18 | 18 | parent::__construct( $field, $value, $unique, $where, $parent ); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - /** | |
| 22 | - * Render method. | |
| 23 | - */ | |
| 24 | 21 | public function render() { |
| 25 | 22 | |
| 26 | - echo wp_kses_post( $this->field_before() ); | |
| 23 | + echo $this->field_before(); | |
| 27 | 24 | |
| 28 | 25 | $args = wp_parse_args( |
| 29 | 26 | $this->field, |
| 30 | 27 | array( |
| @@ -87,9 +84,9 @@ | ||
| 87 | 84 | $this->value = wp_parse_args( $this->value, $default_value ); |
| 88 | 85 | $this->chosen = $args['chosen']; |
| 89 | 86 | $chosen_class = ( $this->chosen ) ? ' spf--chosen' : ''; |
| 90 | 87 | |
| 91 | - echo '<div class="spf--typography' . esc_attr( $chosen_class ) . '" data-unit="' . esc_attr( $args['unit'] ) . '" data-exclude="' . esc_attr( $args['exclude'] ) . '">'; | |
| 88 | + echo '<div class="spf--typography' . $chosen_class . '" data-unit="' . $args['unit'] . '" data-exclude="' . $args['exclude'] . '">'; | |
| 92 | 89 | |
| 93 | 90 | echo '<div class="spf--blocks spf--blocks-selects">'; |
| 94 | 91 | |
| 95 | 92 | // |
| @@ -95,10 +92,10 @@ | ||
| 95 | 92 | // |
| 96 | 93 | // Font Family. |
| 97 | 94 | if ( ! empty( $args['font_family'] ) ) { |
| 98 | 95 | echo '<div class="spf--block">'; |
| 99 | - echo '<div class="spf--title">' . esc_html__( 'Font Family', 'post-carousel' ) . '</div>'; | |
| 100 | - echo $this->create_select( array( $this->value['font-family'] => $this->value['font-family'] ), 'font-family', esc_html__( 'Select a font', 'post-carousel' ) ); | |
| 96 | + echo '<div class="spf--title">' . esc_html__( 'Font Family', 'smart-post-show' ) . '</div>'; | |
| 97 | + echo $this->create_select( array( $this->value['font-family'] => $this->value['font-family'] ), 'font-family', esc_html__( 'Select a font', 'smart-post-show' ) ); | |
| 101 | 98 | echo '</div>'; |
| 102 | 99 | } |
| 103 | 100 | |
| 104 | 101 | // |
| @@ -104,9 +101,9 @@ | ||
| 104 | 101 | // |
| 105 | 102 | // Backup Font Family. |
| 106 | 103 | if ( ! empty( $args['backup_font_family'] ) ) { |
| 107 | 104 | echo '<div class="spf--block spf--block-backup-font-family hidden">'; |
| 108 | - echo '<div class="spf--title">' . esc_html__( 'Backup Font Family', 'post-carousel' ) . '</div>'; | |
| 105 | + echo '<div class="spf--title">' . esc_html__( 'Backup Font Family', 'smart-post-show' ) . '</div>'; | |
| 109 | 106 | echo $this->create_select( |
| 110 | 107 | apply_filters( |
| 111 | 108 | 'spf_field_typography_backup_font_family', |
| 112 | 109 | array( |
| @@ -124,9 +121,9 @@ | ||
| 124 | 121 | 'Palatino Linotype', |
| 125 | 122 | ) |
| 126 | 123 | ), |
| 127 | 124 | 'backup-font-family', |
| 128 | - esc_html__( 'Default', 'post-carousel' ) | |
| 125 | + esc_html__( 'Default', 'smart-post-show' ) | |
| 129 | 126 | ); |
| 130 | 127 | echo '</div>'; |
| 131 | 128 | } |
| 132 | 129 | |
| @@ -136,24 +133,24 @@ | ||
| 136 | 133 | |
| 137 | 134 | // |
| 138 | 135 | // Font Style Select. |
| 139 | 136 | echo '<div class="spf--block spf--block-font-style hidden">'; |
| 140 | - echo '<div class="spf--title">' . esc_html__( 'Font Style', 'post-carousel' ) . '</div>'; | |
| 137 | + echo '<div class="spf--title">' . esc_html__( 'Font Style', 'smart-post-show' ) . '</div>'; | |
| 141 | 138 | echo '<select class="spf--font-style-select" data-placeholder="Default">'; |
| 142 | - echo '<option value="">' . ( wp_kses_post( ! $this->chosen ) ? esc_html__( 'Default', 'post-carousel' ) : '' ) . '</option>'; | |
| 139 | + echo '<option value="">' . ( ! $this->chosen ? esc_html__( 'Default', 'smart-post-show' ) : '' ) . '</option>'; | |
| 143 | 140 | if ( ! empty( $this->value['font-weight'] ) || ! empty( $this->value['font-style'] ) ) { |
| 144 | - echo '<option value="' . esc_attr( strtolower( $this->value['font-weight'] . $this->value['font-style'] ) ) . '" selected></option>'; | |
| 141 | + echo '<option value="' . strtolower( $this->value['font-weight'] . $this->value['font-style'] ) . '" selected></option>'; | |
| 145 | 142 | } |
| 146 | 143 | echo '</select>'; |
| 147 | - echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[font-weight]' ) ) . '" class="spf--font-weight" value="' . esc_attr( $this->value['font-weight'] ) . '" />'; | |
| 148 | - echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[font-style]' ) ) . '" class="spf--font-style" value="' . esc_attr( $this->value['font-style'] ) . '" />'; | |
| 144 | + echo '<input type="hidden" name="' . $this->field_name( '[font-weight]' ) . '" class="spf--font-weight" value="' . $this->value['font-weight'] . '" />'; | |
| 145 | + echo '<input type="hidden" name="' . $this->field_name( '[font-style]' ) . '" class="spf--font-style" value="' . $this->value['font-style'] . '" />'; | |
| 149 | 146 | |
| 150 | 147 | // |
| 151 | 148 | // Extra Font Style Select. |
| 152 | 149 | if ( ! empty( $args['extra_styles'] ) ) { |
| 153 | 150 | echo '<div class="spf--block-extra-styles hidden">'; |
| 154 | - echo ( ! $this->chosen ) ? '<div class="spf--title">' . esc_html__( 'Load Extra Styles', 'post-carousel' ) . '</div>' : ''; | |
| 155 | - $placeholder = ( $this->chosen ) ? esc_html__( 'Load Extra Styles', 'post-carousel' ) : esc_html__( 'Default', 'post-carousel' ); | |
| 151 | + echo ( ! $this->chosen ) ? '<div class="spf--title">' . esc_html__( 'Load Extra Styles', 'smart-post-show' ) . '</div>' : ''; | |
| 152 | + $placeholder = ( $this->chosen ) ? esc_html__( 'Load Extra Styles', 'smart-post-show' ) : esc_html__( 'Default', 'smart-post-show' ); | |
| 156 | 153 | echo $this->create_select( $this->value['extra-styles'], 'extra-styles', $placeholder, true ); |
| 157 | 154 | echo '</div>'; |
| 158 | 155 | } |
| 159 | 156 | |
| @@ -164,11 +161,11 @@ | ||
| 164 | 161 | // |
| 165 | 162 | // Subset. |
| 166 | 163 | if ( ! empty( $args['subset'] ) ) { |
| 167 | 164 | echo '<div class="spf--block spf--block-subset hidden">'; |
| 168 | - echo '<div class="spf--title">' . esc_html__( 'Subset', 'post-carousel' ) . '</div>'; | |
| 165 | + echo '<div class="spf--title">' . esc_html__( 'Subset', 'smart-post-show' ) . '</div>'; | |
| 169 | 166 | $subset = ( is_array( $this->value['subset'] ) ) ? $this->value['subset'] : array_filter( (array) $this->value['subset'] ); |
| 170 | - echo $this->create_select( $subset, 'subset', esc_html__( 'Default', 'post-carousel' ), $args['multi_subset'] ); | |
| 167 | + echo $this->create_select( $subset, 'subset', esc_html__( 'Default', 'smart-post-show' ), $args['multi_subset'] ); | |
| 171 | 168 | echo '</div>'; |
| 172 | 169 | } |
| 173 | 170 | |
| 174 | 171 | // |
| @@ -174,20 +171,20 @@ | ||
| 174 | 171 | // |
| 175 | 172 | // Text Align. |
| 176 | 173 | if ( ! empty( $args['text_align'] ) ) { |
| 177 | 174 | echo '<div class="spf--block">'; |
| 178 | - echo '<div class="spf--title">' . esc_html__( 'Text Align', 'post-carousel' ) . '</div>'; | |
| 175 | + echo '<div class="spf--title">' . esc_html__( 'Text Align', 'smart-post-show' ) . '</div>'; | |
| 179 | 176 | echo $this->create_select( |
| 180 | 177 | array( |
| 181 | - 'inherit' => esc_html__( 'Inherit', 'post-carousel' ), | |
| 182 | - 'left' => esc_html__( 'Left', 'post-carousel' ), | |
| 183 | - 'center' => esc_html__( 'Center', 'post-carousel' ), | |
| 184 | - 'right' => esc_html__( 'Right', 'post-carousel' ), | |
| 185 | - 'justify' => esc_html__( 'Justify', 'post-carousel' ), | |
| 186 | - 'initial' => esc_html__( 'Initial', 'post-carousel' ), | |
| 178 | + 'inherit' => esc_html__( 'Inherit', 'smart-post-show' ), | |
| 179 | + 'left' => esc_html__( 'Left', 'smart-post-show' ), | |
| 180 | + 'center' => esc_html__( 'Center', 'smart-post-show' ), | |
| 181 | + 'right' => esc_html__( 'Right', 'smart-post-show' ), | |
| 182 | + 'justify' => esc_html__( 'Justify', 'smart-post-show' ), | |
| 183 | + 'initial' => esc_html__( 'Initial', 'smart-post-show' ), | |
| 187 | 184 | ), |
| 188 | 185 | 'text-align', |
| 189 | - esc_html__( 'Default', 'post-carousel' ) | |
| 186 | + esc_html__( 'Default', 'smart-post-show' ) | |
| 190 | 187 | ); |
| 191 | 188 | echo '</div>'; |
| 192 | 189 | } |
| 193 | 190 | |
| @@ -194,19 +191,17 @@ | ||
| 194 | 191 | // |
| 195 | 192 | // Font Variant. |
| 196 | 193 | if ( ! empty( $args['font_variant'] ) ) { |
| 197 | 194 | echo '<div class="spf--block">'; |
| 198 | - echo '<div class="spf--title">' . esc_html__( 'Font Variant', 'post-carousel' ) . '</div>'; | |
| 199 | - echo wp_kses_post( | |
| 200 | - $this->create_select( | |
| 201 | - array( | |
| 202 | - 'normal' => esc_html__( 'Normal', 'post-carousel' ), | |
| 203 | - 'small-caps' => esc_html__( 'Small Caps', 'post-carousel' ), | |
| 204 | - 'all-small-caps' => esc_html__( 'All Small Caps', 'post-carousel' ), | |
| 205 | - ), | |
| 206 | - 'font-variant', | |
| 207 | - esc_html__( 'Default', 'post-carousel' ) | |
| 208 | - ) | |
| 195 | + echo '<div class="spf--title">' . esc_html__( 'Font Variant', 'smart-post-show' ) . '</div>'; | |
| 196 | + echo $this->create_select( | |
| 197 | + array( | |
| 198 | + 'normal' => esc_html__( 'Normal', 'smart-post-show' ), | |
| 199 | + 'small-caps' => esc_html__( 'Small Caps', 'smart-post-show' ), | |
| 200 | + 'all-small-caps' => esc_html__( 'All Small Caps', 'smart-post-show' ), | |
| 201 | + ), | |
| 202 | + 'font-variant', | |
| 203 | + esc_html__( 'Default', 'smart-post-show' ) | |
| 209 | 204 | ); |
| 210 | 205 | echo '</div>'; |
| 211 | 206 | } |
| 212 | 207 | |
| @@ -213,18 +208,18 @@ | ||
| 213 | 208 | // |
| 214 | 209 | // Text Transform. |
| 215 | 210 | if ( ! empty( $args['text_transform'] ) ) { |
| 216 | 211 | echo '<div class="spf--block">'; |
| 217 | - echo '<div class="spf--title">' . esc_html__( 'Text Transform', 'post-carousel' ) . '</div>'; | |
| 212 | + echo '<div class="spf--title">' . esc_html__( 'Text Transform', 'smart-post-show' ) . '</div>'; | |
| 218 | 213 | echo $this->create_select( |
| 219 | 214 | array( |
| 220 | - 'none' => esc_html__( 'None', 'post-carousel' ), | |
| 221 | - 'capitalize' => esc_html__( 'Capitalize', 'post-carousel' ), | |
| 222 | - 'uppercase' => esc_html__( 'Uppercase', 'post-carousel' ), | |
| 223 | - 'lowercase' => esc_html__( 'Lowercase', 'post-carousel' ), | |
| 215 | + 'none' => esc_html__( 'None', 'smart-post-show' ), | |
| 216 | + 'capitalize' => esc_html__( 'Capitalize', 'smart-post-show' ), | |
| 217 | + 'uppercase' => esc_html__( 'Uppercase', 'smart-post-show' ), | |
| 218 | + 'lowercase' => esc_html__( 'Lowercase', 'smart-post-show' ), | |
| 224 | 219 | ), |
| 225 | 220 | 'text-transform', |
| 226 | - esc_html__( 'Default', 'post-carousel' ) | |
| 221 | + esc_html__( 'Default', 'smart-post-show' ) | |
| 227 | 222 | ); |
| 228 | 223 | echo '</div>'; |
| 229 | 224 | } |
| 230 | 225 | |
| @@ -231,24 +226,22 @@ | ||
| 231 | 226 | // |
| 232 | 227 | // Text Decoration. |
| 233 | 228 | if ( ! empty( $args['text_decoration'] ) ) { |
| 234 | 229 | echo '<div class="spf--block">'; |
| 235 | - echo '<div class="spf--title">' . esc_html__( 'Text Decoration', 'post-carousel' ) . '</div>'; | |
| 236 | - echo wp_kses_post( | |
| 237 | - $this->create_select( | |
| 238 | - array( | |
| 239 | - 'none' => esc_html__( 'None', 'post-carousel' ), | |
| 240 | - 'underline' => esc_html__( 'Solid', 'post-carousel' ), | |
| 241 | - 'underline double' => esc_html__( 'Double', 'post-carousel' ), | |
| 242 | - 'underline dotted' => esc_html__( 'Dotted', 'post-carousel' ), | |
| 243 | - 'underline dashed' => esc_html__( 'Dashed', 'post-carousel' ), | |
| 244 | - 'underline wavy' => esc_html__( 'Wavy', 'post-carousel' ), | |
| 245 | - 'underline overline' => esc_html__( 'Overline', 'post-carousel' ), | |
| 246 | - 'line-through' => esc_html__( 'Line-through', 'post-carousel' ), | |
| 247 | - ), | |
| 248 | - 'text-decoration', | |
| 249 | - esc_html__( 'Default', 'post-carousel' ) | |
| 250 | - ) | |
| 230 | + echo '<div class="spf--title">' . esc_html__( 'Text Decoration', 'smart-post-show' ) . '</div>'; | |
| 231 | + echo $this->create_select( | |
| 232 | + array( | |
| 233 | + 'none' => esc_html__( 'None', 'smart-post-show' ), | |
| 234 | + 'underline' => esc_html__( 'Solid', 'smart-post-show' ), | |
| 235 | + 'underline double' => esc_html__( 'Double', 'smart-post-show' ), | |
| 236 | + 'underline dotted' => esc_html__( 'Dotted', 'smart-post-show' ), | |
| 237 | + 'underline dashed' => esc_html__( 'Dashed', 'smart-post-show' ), | |
| 238 | + 'underline wavy' => esc_html__( 'Wavy', 'smart-post-show' ), | |
| 239 | + 'underline overline' => esc_html__( 'Overline', 'smart-post-show' ), | |
| 240 | + 'line-through' => esc_html__( 'Line-through', 'smart-post-show' ), | |
| 241 | + ), | |
| 242 | + 'text-decoration', | |
| 243 | + esc_html__( 'Default', 'smart-post-show' ) | |
| 251 | 244 | ); |
| 252 | 245 | echo '</div>'; |
| 253 | 246 | } |
| 254 | 247 | |
| @@ -259,57 +252,57 @@ | ||
| 259 | 252 | // |
| 260 | 253 | // Font Size and Line Height. |
| 261 | 254 | if ( ! empty( $args['font_size'] ) ) { |
| 262 | 255 | echo '<div class="spf--block">'; |
| 263 | - echo '<div class="spf--title">' . esc_html__( 'Font Size', 'post-carousel' ) . '</div>'; | |
| 256 | + echo '<div class="spf--title">' . esc_html__( 'Font Size', 'smart-post-show' ) . '</div>'; | |
| 264 | 257 | echo '<div class="spf--input-wrap">'; |
| 265 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[font-size]' ) ) . '" class="spf--font-size spf--input spf-input-number" value="' . esc_attr( $this->value['font-size'] ) . '" />'; | |
| 266 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 258 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[font-size]' ) . '" class="spf--font-size spf--input spf-input-number" value="' . $this->value['font-size'] . '" />'; | |
| 259 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 267 | 260 | echo '</div>'; |
| 268 | 261 | echo '</div>'; |
| 269 | 262 | } |
| 270 | 263 | if ( ! empty( $args['line_height'] ) ) { |
| 271 | 264 | echo '<div class="spf--block">'; |
| 272 | - echo '<div class="spf--title">' . esc_html__( 'Line Height', 'post-carousel' ) . '</div>'; | |
| 265 | + echo '<div class="spf--title">' . esc_html__( 'Line Height', 'smart-post-show' ) . '</div>'; | |
| 273 | 266 | echo '<div class="spf--input-wrap">'; |
| 274 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[line-height]' ) ) . '" class="spf--line-height spf--input spf-input-number" value="' . esc_attr( $this->value['line-height'] ) . '" />'; | |
| 275 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 267 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[line-height]' ) . '" class="spf--line-height spf--input spf-input-number" value="' . $this->value['line-height'] . '" />'; | |
| 268 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 276 | 269 | echo '</div>'; |
| 277 | 270 | echo '</div>'; |
| 278 | 271 | } |
| 279 | 272 | if ( ! empty( $args['tablet_font_size'] ) ) { |
| 280 | 273 | echo '<div class="spf--block">'; |
| 281 | - echo '<div class="spf--title">' . esc_html__( 'Font Size (Tablet)', 'post-carousel' ) . '</div>'; | |
| 274 | + echo '<div class="spf--title">' . esc_html__( 'Font Size (Tablet)', 'smart-post-show' ) . '</div>'; | |
| 282 | 275 | echo '<div class="spf--input-wrap">'; |
| 283 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[tablet-font-size]' ) ) . '" class="spf--font-size spf--input spf-input-number" value="' . esc_attr( $this->value['tablet-font-size'] ) . '" />'; | |
| 284 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 276 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[tablet-font-size]' ) . '" class="spf--font-size spf--input spf-input-number" value="' . $this->value['tablet-font-size'] . '" />'; | |
| 277 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 285 | 278 | echo '</div>'; |
| 286 | 279 | echo '</div>'; |
| 287 | 280 | } |
| 288 | 281 | if ( ! empty( $args['tablet_line_height'] ) ) { |
| 289 | 282 | echo '<div class="spf--block">'; |
| 290 | - echo '<div class="spf--title">' . esc_html__( 'Line Height (Tablet)', 'post-carousel' ) . '</div>'; | |
| 283 | + echo '<div class="spf--title">' . esc_html__( 'Line Height (Tablet)', 'smart-post-show' ) . '</div>'; | |
| 291 | 284 | echo '<div class="spf--input-wrap">'; |
| 292 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[tablet-line-height]' ) ) . '" class="spf--line-height spf--input spf-input-number" value="' . esc_attr( $this->value['tablet-line-height'] ) . '" />'; | |
| 293 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 285 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[tablet-line-height]' ) . '" class="spf--line-height spf--input spf-input-number" value="' . $this->value['tablet-line-height'] . '" />'; | |
| 286 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 294 | 287 | echo '</div>'; |
| 295 | 288 | echo '</div>'; |
| 296 | 289 | } |
| 297 | 290 | if ( ! empty( $args['mobile_font_size'] ) ) { |
| 298 | 291 | echo '<div class="spf--block">'; |
| 299 | - echo '<div class="spf--title">' . esc_html__( 'Font Size (Mobile)', 'post-carousel' ) . '</div>'; | |
| 292 | + echo '<div class="spf--title">' . esc_html__( 'Font Size (Mobile)', 'smart-post-show' ) . '</div>'; | |
| 300 | 293 | echo '<div class="spf--input-wrap">'; |
| 301 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[mobile-font-size]' ) ) . '" class="spf--font-size spf--input spf-input-number" value="' . esc_attr( $this->value['mobile-font-size'] ) . '" />'; | |
| 302 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 294 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[mobile-font-size]' ) . '" class="spf--font-size spf--input spf-input-number" value="' . $this->value['mobile-font-size'] . '" />'; | |
| 295 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 303 | 296 | echo '</div>'; |
| 304 | 297 | echo '</div>'; |
| 305 | 298 | } |
| 306 | 299 | if ( ! empty( $args['mobile_line_height'] ) ) { |
| 307 | 300 | echo '<div class="spf--block">'; |
| 308 | - echo '<div class="spf--title">' . esc_html__( 'Line Height (Mobile)', 'post-carousel' ) . '</div>'; | |
| 301 | + echo '<div class="spf--title">' . esc_html__( 'Line Height (Mobile)', 'smart-post-show' ) . '</div>'; | |
| 309 | 302 | echo '<div class="spf--input-wrap">'; |
| 310 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[mobile-line-height]' ) ) . '" class="spf--line-height spf--input spf-input-number" disabled="disabled" value="' . esc_attr( $this->value['mobile-line-height'] ) . '" />'; | |
| 311 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 303 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[mobile-line-height]' ) . '" class="spf--line-height spf--input spf-input-number" disabled="disabled" value="' . $this->value['mobile-line-height'] . '" />'; | |
| 304 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 312 | 305 | echo '</div>'; |
| 313 | 306 | echo '</div>'; |
| 314 | 307 | } |
| 315 | 308 | |
| @@ -316,12 +309,12 @@ | ||
| 316 | 309 | // |
| 317 | 310 | // Letter Spacing. |
| 318 | 311 | if ( ! empty( $args['letter_spacing'] ) ) { |
| 319 | 312 | echo '<div class="spf--block">'; |
| 320 | - echo '<div class="spf--title">' . esc_html__( 'Letter Spacing', 'post-carousel' ) . '</div>'; | |
| 313 | + echo '<div class="spf--title">' . esc_html__( 'Letter Spacing', 'smart-post-show' ) . '</div>'; | |
| 321 | 314 | echo '<div class="spf--input-wrap">'; |
| 322 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[letter-spacing]' ) ) . '" class="spf--letter-spacing spf--input spf-input-number" value="' . esc_attr( $this->value['letter-spacing'] ) . '" />'; | |
| 323 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 315 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[letter-spacing]' ) . '" class="spf--letter-spacing spf--input spf-input-number" value="' . $this->value['letter-spacing'] . '" />'; | |
| 316 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 324 | 317 | echo '</div>'; |
| 325 | 318 | echo '</div>'; |
| 326 | 319 | } |
| 327 | 320 | |
| @@ -328,12 +321,12 @@ | ||
| 328 | 321 | // |
| 329 | 322 | // Word Spacing. |
| 330 | 323 | if ( ! empty( $args['word_spacing'] ) ) { |
| 331 | 324 | echo '<div class="spf--block">'; |
| 332 | - echo '<div class="spf--title">' . esc_html__( 'Word Spacing', 'post-carousel' ) . '</div>'; | |
| 325 | + echo '<div class="spf--title">' . esc_html__( 'Word Spacing', 'smart-post-show' ) . '</div>'; | |
| 333 | 326 | echo '<div class="spf--input-wrap">'; |
| 334 | - echo '<input type="number" disabled="disabled" name="' . esc_attr( $this->field_name( '[word-spacing]' ) ) . '" class="spf--word-spacing spf--input spf-input-number" value="' . esc_attr( $this->value['word-spacing'] ) . '" />'; | |
| 335 | - echo '<span class="spf--unit">' . esc_attr( $args['unit'] ) . '</span>'; | |
| 327 | + echo '<input type="number" disabled="disabled" name="' . $this->field_name( '[word-spacing]' ) . '" class="spf--word-spacing spf--input spf-input-number" value="' . $this->value['word-spacing'] . '" />'; | |
| 328 | + echo '<span class="spf--unit">' . $args['unit'] . '</span>'; | |
| 336 | 329 | echo '</div>'; |
| 337 | 330 | echo '</div>'; |
| 338 | 331 | } |
| 339 | 332 | |
| @@ -344,11 +337,11 @@ | ||
| 344 | 337 | if ( ! empty( $args['color'] ) ) { |
| 345 | 338 | echo '<div class="spf--blocks spf--blocks-color">'; |
| 346 | 339 | $default_color_attr = ( ! empty( $default_value['color'] ) ) ? ' data-default-color="' . $default_value['color'] . '"' : ''; |
| 347 | 340 | echo '<div class="spf--block spf--block-font-color">'; |
| 348 | - echo '<div class="spf--title">' . esc_html__( 'Font Color', 'post-carousel' ) . '</div>'; | |
| 341 | + echo '<div class="spf--title">' . esc_html__( 'Font Color', 'smart-post-show' ) . '</div>'; | |
| 349 | 342 | echo '<div class="spf-field-color">'; |
| 350 | - echo '<input type="text" name="' . esc_attr( $this->field_name( '[color]' ) ) . '" class="spf-color spf--color" value="' . esc_attr( $this->value['color'] ) . '"' . wp_kses_post( $default_color_attr ) . ' />'; | |
| 343 | + echo '<input type="text" name="' . $this->field_name( '[color]' ) . '" class="spf-color spf--color" value="' . $this->value['color'] . '"' . $default_color_attr . ' />'; | |
| 351 | 344 | echo '</div>'; |
| 352 | 345 | echo '</div>'; |
| 353 | 346 | |
| 354 | 347 | // |
| @@ -355,15 +348,15 @@ | ||
| 355 | 348 | // Font Hover Color. |
| 356 | 349 | if ( ! empty( $args['hover_color'] ) ) { |
| 357 | 350 | $default_hover_color_attr = ( ! empty( $default_value['hover_color'] ) ) ? ' data-default-color="' . $default_value['hover_color'] . '"' : ''; |
| 358 | 351 | echo '<div class="spf--block spf--block-font-color">'; |
| 359 | - echo '<div class="spf--title">' . esc_html__( 'Hover Color', 'post-carousel' ) . '</div>'; | |
| 352 | + echo '<div class="spf--title">' . esc_html__( 'Hover Color', 'smart-post-show' ) . '</div>'; | |
| 360 | 353 | echo '<div class="spf-field-color">'; |
| 361 | - echo '<input type="text" name="' . esc_attr( $this->field_name( '[hover_color]' ) ) . '" class="spf-color spf--color" value="' . esc_attr( $this->value['hover_color'] ) . '"' . wp_kses_post( $default_hover_color_attr ) . ' />'; | |
| 354 | + echo '<input type="text" name="' . $this->field_name( '[hover_color]' ) . '" class="spf-color spf--color" value="' . $this->value['hover_color'] . '"' . $default_hover_color_attr . ' />'; | |
| 362 | 355 | echo '</div>'; |
| 363 | 356 | echo '</div>'; |
| 364 | 357 | } |
| 365 | - echo '</div>'; // End of spf--blocks-color. | |
| 358 | + echo '</div>'; // End of spf--blocks-color | |
| 366 | 359 | } |
| 367 | 360 | |
| 368 | 361 | // |
| 369 | 362 | // Custom style. |
| @@ -368,42 +361,33 @@ | ||
| 368 | 361 | // |
| 369 | 362 | // Custom style. |
| 370 | 363 | if ( ! empty( $args['custom_style'] ) ) { |
| 371 | 364 | echo '<div class="spf--block spf--block-custom-style">'; |
| 372 | - echo '<div class="spf--title">' . esc_html__( 'Custom Style', 'post-carousel' ) . '</div>'; | |
| 373 | - echo '<textarea disabled="disabled" name="' . esc_attr( $this->field_name( '[custom-style]' ) ) . '" class="spf--custom-style">' . esc_html( $this->value['custom-style'] ) . '</textarea>'; | |
| 365 | + echo '<div class="spf--title">' . esc_html__( 'Custom Style', 'smart-post-show' ) . '</div>'; | |
| 366 | + echo '<textarea disabled="disabled" name="' . $this->field_name( '[custom-style]' ) . '" class="spf--custom-style">' . $this->value['custom-style'] . '</textarea>'; | |
| 374 | 367 | echo '</div>'; |
| 375 | 368 | } |
| 376 | 369 | |
| 377 | 370 | // |
| 378 | 371 | // Preview. |
| 379 | - $always_preview = ( 'always' !== $args['preview'] ) ? ' hidden' : ''; | |
| 372 | + $always_preview = ( $args['preview'] !== 'always' ) ? ' hidden' : ''; | |
| 380 | 373 | |
| 381 | 374 | if ( ! empty( $args['preview'] ) ) { |
| 382 | - echo '<div class="spf--block spf--block-preview' . esc_attr( $always_preview ) . '">'; | |
| 375 | + echo '<div class="spf--block spf--block-preview' . $always_preview . '">'; | |
| 383 | 376 | echo '<div class="spf--toggle fa fa-toggle-off"></div>'; |
| 384 | - echo '<div class="spf--preview">' . esc_html( $args['preview_text'] ) . '</div>'; | |
| 377 | + echo '<div class="spf--preview">' . $args['preview_text'] . '</div>'; | |
| 385 | 378 | echo '</div>'; |
| 386 | 379 | } |
| 387 | 380 | |
| 388 | - echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[type]' ) ) . '" class="spf--type" value="' . esc_attr( $this->value['type'] ) . '" />'; | |
| 389 | - echo '<input type="hidden" name="' . esc_attr( $this->field_name( '[unit]' ) ) . '" class="spf--unit-save" value="' . esc_attr( $args['unit'] ) . '" />'; | |
| 381 | + echo '<input type="hidden" name="' . $this->field_name( '[type]' ) . '" class="spf--type" value="' . $this->value['type'] . '" />'; | |
| 382 | + echo '<input type="hidden" name="' . $this->field_name( '[unit]' ) . '" class="spf--unit-save" value="' . $args['unit'] . '" />'; | |
| 390 | 383 | |
| 391 | 384 | echo '</div>'; |
| 392 | 385 | |
| 393 | - echo wp_kses_post( $this->field_after() ); | |
| 386 | + echo $this->field_after(); | |
| 394 | 387 | |
| 395 | 388 | } |
| 396 | 389 | |
| 397 | - /** | |
| 398 | - * Create select field. | |
| 399 | - * | |
| 400 | - * @param [type] $options | |
| 401 | - * @param [type] $name | |
| 402 | - * @param string $placeholder | |
| 403 | - * @param boolean $is_multiple | |
| 404 | - * @return mixed | |
| 405 | - */ | |
| 406 | 390 | public function create_select( $options, $name, $placeholder = '', $is_multiple = false ) { |
| 407 | 391 | |
| 408 | 392 | $multiple_name = ( $is_multiple ) ? '[]' : ''; |
| 409 | 393 | $multiple_attr = ( $is_multiple ) ? ' multiple data-multiple="true"' : ''; |
| @@ -415,13 +399,13 @@ | ||
| 415 | 399 | if ( ! empty( $options ) ) { |
| 416 | 400 | foreach ( $options as $option_key => $pcp_metabox_value ) { |
| 417 | 401 | if ( $is_multiple ) { |
| 418 | 402 | $selected = ( in_array( $pcp_metabox_value, $this->value[ $name ] ) ) ? ' selected' : ''; |
| 419 | - $output .= '<option value="' . esc_attr( $pcp_metabox_value ) . '"' . $selected . '>' . $pcp_metabox_value . '</option>'; | |
| 403 | + $output .= '<option value="' . $pcp_metabox_value . '"' . $selected . '>' . $pcp_metabox_value . '</option>'; | |
| 420 | 404 | } else { |
| 421 | 405 | $option_key = ( is_numeric( $option_key ) ) ? $pcp_metabox_value : $option_key; |
| 422 | 406 | $selected = ( $option_key === $this->value[ $name ] ) ? ' selected' : ''; |
| 423 | - $output .= '<option value="' . esc_attr( $option_key ) . '"' . $selected . '>' . $pcp_metabox_value . '</option>'; | |
| 407 | + $output .= '<option value="' . $option_key . '"' . $selected . '>' . $pcp_metabox_value . '</option>'; | |
| 424 | 408 | } |
| 425 | 409 | } |
| 426 | 410 | } |
| 427 | 411 | |
| @@ -430,13 +414,8 @@ | ||
| 430 | 414 | return $output; |
| 431 | 415 | |
| 432 | 416 | } |
| 433 | 417 | |
| 434 | - /** | |
| 435 | - * Enqueue fonts. | |
| 436 | - * | |
| 437 | - * @return void | |
| 438 | - */ | |
| 439 | 418 | public function enqueue() { |
| 440 | 419 | |
| 441 | 420 | if ( ! wp_style_is( 'spf-webfont-loader' ) ) { |
| 442 | 421 | |
| @@ -449,15 +428,15 @@ | ||
| 449 | 428 | $customwebfonts = apply_filters( 'spf_field_typography_customwebfonts', array() ); |
| 450 | 429 | |
| 451 | 430 | if ( ! empty( $customwebfonts ) ) { |
| 452 | 431 | $webfonts['custom'] = array( |
| 453 | - 'label' => esc_html__( 'Custom Web Fonts', 'post-carousel' ), | |
| 432 | + 'label' => esc_html__( 'Custom Web Fonts', 'smart-post-show' ), | |
| 454 | 433 | 'fonts' => $customwebfonts, |
| 455 | 434 | ); |
| 456 | 435 | } |
| 457 | 436 | |
| 458 | 437 | $webfonts['safe'] = array( |
| 459 | - 'label' => esc_html__( 'Safe Web Fonts', 'post-carousel' ), | |
| 438 | + 'label' => esc_html__( 'Safe Web Fonts', 'smart-post-show' ), | |
| 460 | 439 | 'fonts' => apply_filters( |
| 461 | 440 | 'spf_field_typography_safewebfonts', |
| 462 | 441 | array( |
| 463 | 442 | 'Arial', |
| @@ -478,9 +457,9 @@ | ||
| 478 | 457 | ), |
| 479 | 458 | ); |
| 480 | 459 | |
| 481 | 460 | $webfonts['google'] = array( |
| 482 | - 'label' => esc_html__( 'Google Web Fonts', 'post-carousel' ), | |
| 461 | + 'label' => esc_html__( 'Google Web Fonts', 'smart-post-show' ), | |
| 483 | 462 | 'fonts' => apply_filters( |
| 484 | 463 | 'spf_field_typography_googlewebfonts', |
| 485 | 464 | spf_get_google_fonts() |
| 486 | 465 | ), |
| @@ -527,13 +506,8 @@ | ||
| 527 | 506 | } |
| 528 | 507 | |
| 529 | 508 | } |
| 530 | 509 | |
| 531 | - /** | |
| 532 | - * Enqueue Google fonts. | |
| 533 | - * | |
| 534 | - * @return mixed | |
| 535 | - */ | |
| 536 | 510 | public function enqueue_google_fonts() { |
| 537 | 511 | |
| 538 | 512 | $value = $this->value; |
| 539 | 513 | $families = array(); |
| @@ -539,9 +513,9 @@ | ||
| 539 | 513 | $families = array(); |
| 540 | 514 | $is_google = false; |
| 541 | 515 | |
| 542 | 516 | if ( ! empty( $this->value['type'] ) ) { |
| 543 | - $is_google = ( 'google' === $this->value['type'] ) ? true : false; | |
| 517 | + $is_google = ( $this->value['type'] === 'google' ) ? true : false; | |
| 544 | 518 | } else { |
| 545 | 519 | SP_PC::include_plugin_file( 'fields/typography/google-fonts.php' ); |
| 546 | 520 | $is_google = ( array_key_exists( $this->value['font-family'], spf_get_google_fonts() ) ) ? true : false; |
| 547 | 521 | } |
| @@ -547,9 +521,9 @@ | ||
| 547 | 521 | } |
| 548 | 522 | |
| 549 | 523 | if ( $is_google ) { |
| 550 | 524 | |
| 551 | - // set style. | |
| 525 | + // set style | |
| 552 | 526 | $font_weight = ( ! empty( $value['font-weight'] ) ) ? $value['font-weight'] : ''; |
| 553 | 527 | $font_style = ( ! empty( $value['font-style'] ) ) ? $value['font-style'] : ''; |
| 554 | 528 | |
| 555 | 529 | if ( $font_weight || $font_style ) { |
| @@ -556,9 +530,9 @@ | ||
| 556 | 530 | $style = $font_weight . $font_style; |
| 557 | 531 | $families['style'][ $style ] = $style; |
| 558 | 532 | } |
| 559 | 533 | |
| 560 | - // set extra styles. | |
| 534 | + // set extra styles | |
| 561 | 535 | if ( ! empty( $value['extra-styles'] ) ) { |
| 562 | 536 | foreach ( $value['extra-styles'] as $extra_style ) { |
| 563 | 537 | $families['style'][ $extra_style ] = $extra_style; |
| 564 | 538 | } |
| @@ -563,9 +537,9 @@ | ||
| 563 | 537 | $families['style'][ $extra_style ] = $extra_style; |
| 564 | 538 | } |
| 565 | 539 | } |
| 566 | 540 | |
| 567 | - // set subsets. | |
| 541 | + // set subsets | |
| 568 | 542 | if ( ! empty( $value['subset'] ) ) { |
| 569 | 543 | $value['subset'] = ( is_array( $value['subset'] ) ) ? $value['subset'] : array_filter( (array) $value['subset'] ); |
| 570 | 544 | foreach ( $value['subset'] as $subset ) { |
| 571 | 545 | $families['subset'][ $subset ] = $subset; |
| @@ -586,13 +560,8 @@ | ||
| 586 | 560 | return false; |
| 587 | 561 | |
| 588 | 562 | } |
| 589 | 563 | |
| 590 | - /** | |
| 591 | - * Output method. | |
| 592 | - * | |
| 593 | - * @return mixed | |
| 594 | - */ | |
| 595 | 564 | public function output() { |
| 596 | 565 | |
| 597 | 566 | $output = ''; |
| 598 | 567 | $bg_image = array(); |
| @@ -605,9 +574,9 @@ | ||
| 605 | 574 | if ( $font_family ) { |
| 606 | 575 | $output .= 'font-family:"' . $font_family . '"' . $backup_family . $important . ';'; |
| 607 | 576 | } |
| 608 | 577 | |
| 609 | - // Common font properties. | |
| 578 | + // Common font properties | |
| 610 | 579 | $properties = array( |
| 611 | 580 | 'color', |
| 612 | 581 | 'hover_color', |
| 613 | 582 | 'font-weight', |
| @@ -618,9 +587,9 @@ | ||
| 618 | 587 | 'text-decoration', |
| 619 | 588 | ); |
| 620 | 589 | |
| 621 | 590 | foreach ( $properties as $property ) { |
| 622 | - if ( isset( $this->value[ $property ] ) && '' !== $this->value[ $property ] ) { | |
| 591 | + if ( isset( $this->value[ $property ] ) && $this->value[ $property ] !== '' ) { | |
| 623 | 592 | $output .= $property . ':' . $this->value[ $property ] . $important . ';'; |
| 624 | 593 | } |
| 625 | 594 | } |
| 626 | 595 | |
| @@ -633,9 +602,9 @@ | ||
| 633 | 602 | |
| 634 | 603 | $unit = ( ! empty( $this->value['unit'] ) ) ? $this->value['unit'] : ''; |
| 635 | 604 | |
| 636 | 605 | foreach ( $properties as $property ) { |
| 637 | - if ( isset( $this->value[ $property ] ) && '' !== $this->value[ $property ] ) { | |
| 606 | + if ( isset( $this->value[ $property ] ) && $this->value[ $property ] !== '' ) { | |
| 638 | 607 | $output .= $property . ':' . $this->value[ $property ] . $unit . $important . ';'; |
| 639 | 608 | } |
| 640 | 609 | } |
| 641 | 610 | |