@@ -118,9 +118,9 @@ |
||
118 | 118 | // If we have a variable_callback defined then get the value of the option |
119 | 119 | // and run it through the callback function. |
120 | 120 | // If no callback is defined (false) then just get the value. |
121 | - $variables[ $variable_name ] = Kirki_Values::get_value( $field['settings'] ); |
|
121 | + $variables[$variable_name] = Kirki_Values::get_value( $field['settings'] ); |
|
122 | 122 | if ( $variable_callback ) { |
123 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
123 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
150 | - if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ) ) && ! isset( $this->json['default'][ $key ] ) ) { |
|
151 | - unset( $this->json['value'][ $key ] ); |
|
150 | + if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ) ) && ! isset( $this->json['default'][$key] ) ) { |
|
151 | + unset( $this->json['value'][$key] ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | // Fix for https://github.com/aristath/kirki/issues/1405. |
156 | 156 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
157 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
158 | - unset( $this->json['value'][ $key ] ); |
|
157 | + if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) { |
|
158 | + unset( $this->json['value'][$key] ); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | if ( is_string( $variant ) ) { |
339 | 339 | $final_variants[] = array( |
340 | 340 | 'id' => $variant, |
341 | - 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
|
341 | + 'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant, |
|
342 | 342 | ); |
343 | 343 | } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
344 | 344 | $final_variants[] = $variant; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if ( array_key_exists( $variant, $all_variants ) ) { |
420 | 420 | $available_variants[] = array( |
421 | 421 | 'id' => $variant, |
422 | - 'label' => $all_variants[ $variant ], |
|
422 | + 'label' => $all_variants[$variant], |
|
423 | 423 | ); |
424 | 424 | } |
425 | 425 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | if ( array_key_exists( $subset, $all_subsets ) ) { |
432 | 432 | $available_subsets[] = array( |
433 | 433 | 'id' => $subset, |
434 | - 'label' => $all_subsets[ $subset ], |
|
434 | + 'label' => $all_subsets[$subset], |
|
435 | 435 | ); |
436 | 436 | } |
437 | 437 | } |
@@ -336,7 +336,8 @@ discard block |
||
336 | 336 | </div> |
337 | 337 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
338 | 338 | <input class="typography-hidden-value" type="hidden" {{{ data.link }}}> |
339 | - <?php else : ?> |
|
339 | + <?php else { |
|
340 | + : ?> |
|
340 | 341 | <# |
341 | 342 | if ( ! _.isUndefined( data.value['font-family'] ) ) { |
342 | 343 | data.value['font-family'] = data.value['font-family'].replace( /"/g, ''' ); |
@@ -344,7 +345,9 @@ discard block |
||
344 | 345 | valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); |
345 | 346 | #> |
346 | 347 | <input class="typography-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
347 | - <?php endif; ?> |
|
348 | + <?php endif; |
|
349 | +} |
|
350 | +?> |
|
348 | 351 | <?php |
349 | 352 | } |
350 | 353 |
@@ -180,9 +180,12 @@ |
||
180 | 180 | <div class="iris-target"></div> |
181 | 181 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
182 | 182 | <input class="multicolor-hidden-value" type="hidden" {{{ data.link }}}> |
183 | - <?php else : ?> |
|
183 | + <?php else { |
|
184 | + : ?> |
|
184 | 185 | <input class="multicolor-hidden-value" type="hidden" value='{{{ JSON.stringify( data.value ) }}}' {{{ data.link }}}> |
185 | - <?php endif; ?> |
|
186 | + <?php endif; |
|
187 | +} |
|
188 | +?> |
|
186 | 189 | <?php |
187 | 190 | } |
188 | 191 |
@@ -200,10 +200,13 @@ |
||
200 | 200 | </div> |
201 | 201 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
202 | 202 | <input class="background-hidden-value" type="hidden" {{{ data.link }}}> |
203 | - <?php else : ?> |
|
203 | + <?php else { |
|
204 | + : ?> |
|
204 | 205 | <# valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); #> |
205 | 206 | <input class="background-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
206 | - <?php endif; ?> |
|
207 | + <?php endif; |
|
208 | +} |
|
209 | +?> |
|
207 | 210 | <?php |
208 | 211 | } |
209 | 212 | } |
@@ -403,51 +403,51 @@ |
||
403 | 403 | * Multicolor Control. |
404 | 404 | */ |
405 | 405 | Kirki::add_field( 'kirki_demo', array( |
406 | - 'type' => 'multicolor', |
|
407 | - 'settings' => 'multicolor_setting', |
|
408 | - 'label' => esc_attr__( 'Label', 'kirki' ), |
|
409 | - 'section' => 'multicolor_section', |
|
410 | - 'priority' => 10, |
|
411 | - 'choices' => array( |
|
412 | - 'link' => esc_attr__( 'Color', 'kirki' ), |
|
413 | - 'hover' => esc_attr__( 'Hover', 'kirki' ), |
|
414 | - 'active' => esc_attr__( 'Active', 'kirki' ), |
|
415 | - ), |
|
416 | - 'default' => array( |
|
417 | - 'link' => '#0088cc', |
|
418 | - 'hover' => '#00aaff', |
|
419 | - 'active' => '#00ffff', |
|
420 | - ), |
|
406 | + 'type' => 'multicolor', |
|
407 | + 'settings' => 'multicolor_setting', |
|
408 | + 'label' => esc_attr__( 'Label', 'kirki' ), |
|
409 | + 'section' => 'multicolor_section', |
|
410 | + 'priority' => 10, |
|
411 | + 'choices' => array( |
|
412 | + 'link' => esc_attr__( 'Color', 'kirki' ), |
|
413 | + 'hover' => esc_attr__( 'Hover', 'kirki' ), |
|
414 | + 'active' => esc_attr__( 'Active', 'kirki' ), |
|
415 | + ), |
|
416 | + 'default' => array( |
|
417 | + 'link' => '#0088cc', |
|
418 | + 'hover' => '#00aaff', |
|
419 | + 'active' => '#00ffff', |
|
420 | + ), |
|
421 | 421 | ) ); |
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Number Control. |
425 | 425 | */ |
426 | 426 | Kirki::add_field( 'kirki_demo', array( |
427 | - 'type' => 'number', |
|
428 | - 'settings' => 'number_setting', |
|
429 | - 'label' => esc_attr__( 'Label', 'kirki' ), |
|
430 | - 'section' => 'number_section', |
|
431 | - 'priority' => 10, |
|
432 | - 'choices' => array( |
|
427 | + 'type' => 'number', |
|
428 | + 'settings' => 'number_setting', |
|
429 | + 'label' => esc_attr__( 'Label', 'kirki' ), |
|
430 | + 'section' => 'number_section', |
|
431 | + 'priority' => 10, |
|
432 | + 'choices' => array( |
|
433 | 433 | 'min' => -5, |
434 | 434 | 'max' => 5, |
435 | 435 | 'step' => 1, |
436 | - ), |
|
436 | + ), |
|
437 | 437 | ) ); |
438 | 438 | /** |
439 | 439 | * Palette Control. |
440 | 440 | */ |
441 | 441 | Kirki::add_field( 'kirki_demo', array( |
442 | - 'type' => 'palette', |
|
443 | - 'settings' => 'palette_setting', |
|
444 | - 'label' => esc_attr__( 'Label', 'kirki' ), |
|
445 | - 'section' => 'palette_section', |
|
442 | + 'type' => 'palette', |
|
443 | + 'settings' => 'palette_setting', |
|
444 | + 'label' => esc_attr__( 'Label', 'kirki' ), |
|
445 | + 'section' => 'palette_section', |
|
446 | 446 | 'default' => 'blue', |
447 | - 'choices' => array( |
|
447 | + 'choices' => array( |
|
448 | 448 | 'a200' => Kirki_Helper::get_material_design_colors( 'A200' ), |
449 | 449 | 'blue' => Kirki_Helper::get_material_design_colors( 'blue' ), |
450 | 450 | 'green' => array( '#E8F5E9', '#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50', '#43A047', '#388E3C', '#2E7D32', '#1B5E20', '#B9F6CA', '#69F0AE', '#00E676', '#00C853' ), |
451 | 451 | 'bnw' => array( '#000000', '#ffffff' ), |
452 | - ), |
|
452 | + ), |
|
453 | 453 | ) ); |