@@ -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 | } |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | - exit; |
|
| 15 | + exit; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | // Do not proceed if Kirki does not exist. |
| 19 | 19 | if ( ! class_exists( 'Kirki' ) ) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @link https://aristath.github.io/kirki/docs/getting-started/config.html |
| 27 | 27 | */ |
| 28 | 28 | Kirki::add_config( 'kirki_demo', array( |
| 29 | - 'capability' => 'edit_theme_options', |
|
| 29 | + 'capability' => 'edit_theme_options', |
|
| 30 | 30 | 'option_type' => 'theme_mod', |
| 31 | 31 | ) ); |
| 32 | 32 | |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * @link https://aristath.github.io/kirki/docs/getting-started/panels.html |
| 37 | 37 | */ |
| 38 | 38 | Kirki::add_panel( 'kirki_demo_panel', array( |
| 39 | - 'priority' => 10, |
|
| 40 | - 'title' => esc_attr__( 'Kirki Demo Panel', 'textdomain' ), |
|
| 41 | - 'description' => esc_attr__( 'Contains sections for all kirki controls.', 'textdomain' ), |
|
| 39 | + 'priority' => 10, |
|
| 40 | + 'title' => esc_attr__( 'Kirki Demo Panel', 'textdomain' ), |
|
| 41 | + 'description' => esc_attr__( 'Contains sections for all kirki controls.', 'textdomain' ), |
|
| 42 | 42 | ) ); |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,61 +50,61 @@ discard block |
||
| 50 | 50 | * @link https://aristath.github.io/kirki/docs/getting-started/sections.html |
| 51 | 51 | */ |
| 52 | 52 | $sections = array( |
| 53 | - 'background' => array( esc_attr__( 'Background', 'textdomain' ), '' ), |
|
| 54 | - 'code' => array( esc_attr__( 'Code', 'textdomain' ), '' ), |
|
| 55 | - 'checkbox' => array( esc_attr__( 'Checkbox', 'textdomain' ), '' ), |
|
| 56 | - 'color' => array( esc_attr__( 'Color', 'textdomain' ), '' ), |
|
| 57 | - 'color-palette' => array( esc_attr__( 'Color Palette', 'textdomain' ), '' ), |
|
| 58 | - 'custom' => array( esc_attr__( 'Custom', 'textdomain' ), '' ), |
|
| 59 | - 'dashicons' => array( esc_attr__( 'Dashicons', 'textdomain' ), '' ), |
|
| 60 | - 'date' => array( esc_attr__( 'Date', 'textdomain' ), '' ), |
|
| 61 | - 'dimension' => array( esc_attr__( 'Dimension', 'textdomain' ), '' ), |
|
| 62 | - 'dimensions' => array( esc_attr__( 'Dimensions', 'textdomain' ), '' ), |
|
| 63 | - 'editor' => array( esc_attr__( 'Editor', 'textdomain' ), '' ), |
|
| 64 | - 'fontawesome' => array( esc_attr__( 'Font-Awesome', 'textdomain' ), '' ), |
|
| 65 | - 'generic' => array( esc_attr__( 'Generic', 'textdomain' ), '' ), |
|
| 66 | - 'image' => array( esc_attr__( 'Image', 'textdomain' ), '' ), |
|
| 67 | - 'multicheck' => array( esc_attr__( 'Multicheck', 'textdomain' ), '' ), |
|
| 68 | - 'multicolor' => array( esc_attr__( 'Multicolor', 'textdomain' ), '' ), |
|
| 69 | - 'number' => array( esc_attr__( 'Number', 'textdomain' ), '' ), |
|
| 70 | - 'palette' => array( esc_attr__( 'Palette', 'textdomain' ), '' ), |
|
| 71 | - 'preset' => array( esc_attr__( 'Preset', 'textdomain' ), '' ), |
|
| 72 | - 'radio' => array( esc_attr__( 'Radio', 'textdomain' ), esc_attr__( 'A plain Radio control.', 'textdomain' ) ), |
|
| 73 | - 'radio-buttonset' => array( esc_attr__( 'Radio Buttonset', 'textdomain' ), esc_attr__( 'Radio-Buttonset controls are essentially radio controls with some fancy styling to make them look cooler.', 'textdomain' ) ), |
|
| 74 | - 'radio-image' => array( esc_attr__( 'Radio Image', 'textdomain' ), esc_attr__( 'Radio-Image controls are essentially radio controls with some fancy styles to use images', 'textdomain' ) ), |
|
| 75 | - 'repeater' => array( esc_attr__( 'Repeater', 'textdomain' ), '' ), |
|
| 76 | - 'select' => array( esc_attr__( 'Select', 'textdomain' ), '' ), |
|
| 77 | - 'slider' => array( esc_attr__( 'Slider', 'textdomain' ), '' ), |
|
| 78 | - 'sortable' => array( esc_attr__( 'Sortable', 'textdomain' ), '' ), |
|
| 79 | - 'switch' => array( esc_attr__( 'Switch', 'textdomain' ), '' ), |
|
| 80 | - 'toggle' => array( esc_attr__( 'Toggle', 'textdomain' ), '' ), |
|
| 81 | - 'typography' => array( esc_attr__( 'Typography', 'textdomain' ), '' ), |
|
| 53 | + 'background' => array( esc_attr__( 'Background', 'textdomain' ), '' ), |
|
| 54 | + 'code' => array( esc_attr__( 'Code', 'textdomain' ), '' ), |
|
| 55 | + 'checkbox' => array( esc_attr__( 'Checkbox', 'textdomain' ), '' ), |
|
| 56 | + 'color' => array( esc_attr__( 'Color', 'textdomain' ), '' ), |
|
| 57 | + 'color-palette' => array( esc_attr__( 'Color Palette', 'textdomain' ), '' ), |
|
| 58 | + 'custom' => array( esc_attr__( 'Custom', 'textdomain' ), '' ), |
|
| 59 | + 'dashicons' => array( esc_attr__( 'Dashicons', 'textdomain' ), '' ), |
|
| 60 | + 'date' => array( esc_attr__( 'Date', 'textdomain' ), '' ), |
|
| 61 | + 'dimension' => array( esc_attr__( 'Dimension', 'textdomain' ), '' ), |
|
| 62 | + 'dimensions' => array( esc_attr__( 'Dimensions', 'textdomain' ), '' ), |
|
| 63 | + 'editor' => array( esc_attr__( 'Editor', 'textdomain' ), '' ), |
|
| 64 | + 'fontawesome' => array( esc_attr__( 'Font-Awesome', 'textdomain' ), '' ), |
|
| 65 | + 'generic' => array( esc_attr__( 'Generic', 'textdomain' ), '' ), |
|
| 66 | + 'image' => array( esc_attr__( 'Image', 'textdomain' ), '' ), |
|
| 67 | + 'multicheck' => array( esc_attr__( 'Multicheck', 'textdomain' ), '' ), |
|
| 68 | + 'multicolor' => array( esc_attr__( 'Multicolor', 'textdomain' ), '' ), |
|
| 69 | + 'number' => array( esc_attr__( 'Number', 'textdomain' ), '' ), |
|
| 70 | + 'palette' => array( esc_attr__( 'Palette', 'textdomain' ), '' ), |
|
| 71 | + 'preset' => array( esc_attr__( 'Preset', 'textdomain' ), '' ), |
|
| 72 | + 'radio' => array( esc_attr__( 'Radio', 'textdomain' ), esc_attr__( 'A plain Radio control.', 'textdomain' ) ), |
|
| 73 | + 'radio-buttonset' => array( esc_attr__( 'Radio Buttonset', 'textdomain' ), esc_attr__( 'Radio-Buttonset controls are essentially radio controls with some fancy styling to make them look cooler.', 'textdomain' ) ), |
|
| 74 | + 'radio-image' => array( esc_attr__( 'Radio Image', 'textdomain' ), esc_attr__( 'Radio-Image controls are essentially radio controls with some fancy styles to use images', 'textdomain' ) ), |
|
| 75 | + 'repeater' => array( esc_attr__( 'Repeater', 'textdomain' ), '' ), |
|
| 76 | + 'select' => array( esc_attr__( 'Select', 'textdomain' ), '' ), |
|
| 77 | + 'slider' => array( esc_attr__( 'Slider', 'textdomain' ), '' ), |
|
| 78 | + 'sortable' => array( esc_attr__( 'Sortable', 'textdomain' ), '' ), |
|
| 79 | + 'switch' => array( esc_attr__( 'Switch', 'textdomain' ), '' ), |
|
| 80 | + 'toggle' => array( esc_attr__( 'Toggle', 'textdomain' ), '' ), |
|
| 81 | + 'typography' => array( esc_attr__( 'Typography', 'textdomain' ), '' ), |
|
| 82 | 82 | ); |
| 83 | 83 | foreach ( $sections as $section_id => $section ) { |
| 84 | - Kirki::add_section( $section_id . '_section', array( |
|
| 85 | - 'title' => $section[0], |
|
| 86 | - 'description' => $section[1], |
|
| 87 | - 'panel' => 'kirki_demo_panel', |
|
| 88 | - ) ); |
|
| 84 | + Kirki::add_section( $section_id . '_section', array( |
|
| 85 | + 'title' => $section[0], |
|
| 86 | + 'description' => $section[1], |
|
| 87 | + 'panel' => 'kirki_demo_panel', |
|
| 88 | + ) ); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Background Control. |
| 93 | 93 | */ |
| 94 | 94 | Kirki::add_field( 'kirki_demo', array( |
| 95 | - 'type' => 'background', |
|
| 96 | - 'settings' => 'background_setting', |
|
| 97 | - 'label' => esc_attr__( 'Background Control', 'textdomain' ), |
|
| 98 | - 'description' => esc_attr__( 'Background conrols are pretty complex! (but useful if properly used)', 'textdomain' ), |
|
| 99 | - 'section' => 'background_section', |
|
| 100 | - 'default' => array( |
|
| 101 | - 'background-color' => 'rgba(20,20,20,.8)', |
|
| 102 | - 'background-image' => '', |
|
| 103 | - 'background-repeat' => 'repeat-all', |
|
| 104 | - 'background-position' => 'center center', |
|
| 105 | - 'background-size' => 'cover', |
|
| 106 | - 'background-attachment' => 'scroll', |
|
| 107 | - ), |
|
| 95 | + 'type' => 'background', |
|
| 96 | + 'settings' => 'background_setting', |
|
| 97 | + 'label' => esc_attr__( 'Background Control', 'textdomain' ), |
|
| 98 | + 'description' => esc_attr__( 'Background conrols are pretty complex! (but useful if properly used)', 'textdomain' ), |
|
| 99 | + 'section' => 'background_section', |
|
| 100 | + 'default' => array( |
|
| 101 | + 'background-color' => 'rgba(20,20,20,.8)', |
|
| 102 | + 'background-image' => '', |
|
| 103 | + 'background-repeat' => 'repeat-all', |
|
| 104 | + 'background-position' => 'center center', |
|
| 105 | + 'background-size' => 'cover', |
|
| 106 | + 'background-attachment' => 'scroll', |
|
| 107 | + ), |
|
| 108 | 108 | ) ); |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -113,16 +113,16 @@ discard block |
||
| 113 | 113 | * @link https://aristath.github.io/kirki/docs/controls/code.html |
| 114 | 114 | */ |
| 115 | 115 | Kirki::add_field( 'kirki_demo', array( |
| 116 | - 'type' => 'code', |
|
| 117 | - 'settings' => 'code_setting', |
|
| 118 | - 'label' => esc_attr__( 'Code Control', 'textdomain' ), |
|
| 119 | - 'description' => esc_attr__( 'Description', 'textdomain' ), |
|
| 120 | - 'section' => 'code_section', |
|
| 121 | - 'default' => '', |
|
| 122 | - 'choices' => array( |
|
| 123 | - 'language' => 'css', |
|
| 124 | - 'theme' => 'monokai', |
|
| 125 | - ), |
|
| 116 | + 'type' => 'code', |
|
| 117 | + 'settings' => 'code_setting', |
|
| 118 | + 'label' => esc_attr__( 'Code Control', 'textdomain' ), |
|
| 119 | + 'description' => esc_attr__( 'Description', 'textdomain' ), |
|
| 120 | + 'section' => 'code_section', |
|
| 121 | + 'default' => '', |
|
| 122 | + 'choices' => array( |
|
| 123 | + 'language' => 'css', |
|
| 124 | + 'theme' => 'monokai', |
|
| 125 | + ), |
|
| 126 | 126 | ) ); |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | * @link https://aristath.github.io/kirki/docs/controls/checkbox.html |
| 132 | 132 | */ |
| 133 | 133 | Kirki::add_field( 'kirki_demo', array( |
| 134 | - 'type' => 'checkbox', |
|
| 135 | - 'settings' => 'checkbox_setting', |
|
| 136 | - 'label' => esc_attr__( 'Checkbox Control', 'textdomain' ), |
|
| 137 | - 'description' => esc_attr__( 'Description', 'textdomain' ), |
|
| 138 | - 'section' => 'checkbox_section', |
|
| 139 | - 'default' => true, |
|
| 134 | + 'type' => 'checkbox', |
|
| 135 | + 'settings' => 'checkbox_setting', |
|
| 136 | + 'label' => esc_attr__( 'Checkbox Control', 'textdomain' ), |
|
| 137 | + 'description' => esc_attr__( 'Description', 'textdomain' ), |
|
| 138 | + 'section' => 'checkbox_section', |
|
| 139 | + 'default' => true, |
|
| 140 | 140 | ) ); |