@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | public function custom_css() { |
| 67 | 67 | |
| 68 | 68 | $config = apply_filters( 'kirki_config', array() ); |
| 69 | - if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) { |
|
| 69 | + if ( ! isset( $config[ 'color_accent' ] ) && ! isset( $config[ 'color_back' ] ) ) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | - $back = isset( $config['color_back'] ) ? $config['color_back'] : false; |
|
| 72 | + $back = isset( $config[ 'color_back' ] ) ? $config[ 'color_back' ] : false; |
|
| 73 | 73 | |
| 74 | 74 | $text_on_back = ''; |
| 75 | 75 | $border_on_back = ''; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $hover_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 3 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 3 )->toCSS( $back_obj->mode ); |
| 92 | 92 | $arrows_on_back = ( 50 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 30 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 30 )->toCSS( $back_obj->mode ); |
| 93 | 93 | } |
| 94 | - $accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false; |
|
| 94 | + $accent = ( isset( $config[ 'color_accent' ] ) ) ? $config[ 'color_accent' ] : false; |
|
| 95 | 95 | if ( $accent ) { |
| 96 | 96 | $accent_obj = ariColor::newColor( $accent ); |
| 97 | 97 | $text_on_accent = ( 60 > $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness + 60 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness - 60 )->toCSS( $accent_obj->mode ); |
@@ -403,18 +403,18 @@ discard block |
||
| 403 | 403 | color: #444 !important; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - <?php if ( isset( $config['width'] ) ) : ?> |
|
| 406 | + <?php if ( isset( $config[ 'width' ] ) ) : ?> |
|
| 407 | 407 | .wp-full-overlay-sidebar { |
| 408 | - width: <?php echo esc_attr( $config['width'] ); ?>; |
|
| 408 | + width: <?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
| 409 | 409 | } |
| 410 | 410 | .expanded .wp-full-overlay-footer { |
| 411 | - width: <?php echo esc_attr( $config['width'] ); ?>; |
|
| 411 | + width: <?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
| 412 | 412 | } |
| 413 | 413 | .wp-full-overlay.expanded { |
| 414 | - margin-left: <?php echo esc_attr( $config['width'] ); ?>; |
|
| 414 | + margin-left: <?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
| 415 | 415 | } |
| 416 | 416 | .wp-full-overlay.collapsed .wp-full-overlay-sidebar { |
| 417 | - margin-left: -<?php echo esc_attr( $config['width'] ); ?>; |
|
| 417 | + margin-left: -<?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
| 418 | 418 | } |
| 419 | 419 | <?php endif; ?> |
| 420 | 420 | </style> |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | protected function process_output( $output, $value ) { |
| 25 | 25 | |
| 26 | - $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
|
| 27 | - $output['element'] = ( isset( $output['element'] ) ) ? $output['element'] : 'body'; |
|
| 28 | - $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
| 29 | - $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
| 26 | + $output[ 'media_query' ] = ( isset( $output[ 'media_query' ] ) ) ? $output[ 'media_query' ] : 'global'; |
|
| 27 | + $output[ 'element' ] = ( isset( $output[ 'element' ] ) ) ? $output[ 'element' ] : 'body'; |
|
| 28 | + $output[ 'prefix' ] = ( isset( $output[ 'prefix' ] ) ) ? $output[ 'prefix' ] : ''; |
|
| 29 | + $output[ 'suffix' ] = ( isset( $output[ 'suffix' ] ) ) ? $output[ 'suffix' ] : ''; |
|
| 30 | 30 | |
| 31 | 31 | $value = Kirki_Field_Typography::sanitize( $value ); |
| 32 | 32 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | foreach ( $properties as $property ) { |
| 49 | 49 | |
| 50 | 50 | // Early exit if the value is not in the defaults. |
| 51 | - if ( ! isset( $this->field['default'][ $property ] ) ) { |
|
| 51 | + if ( ! isset( $this->field[ 'default' ][ $property ] ) ) { |
|
| 52 | 52 | continue; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -58,39 +58,39 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Early exit if we use "choice" but not for this property. |
| 61 | - if ( isset( $output['choice'] ) && $output['choice'] !== $property ) { |
|
| 61 | + if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] !== $property ) { |
|
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Take care of variants. |
| 66 | - if ( 'variant' === $property && isset( $value['variant'] ) && ! empty( $value['variant'] ) ) { |
|
| 66 | + if ( 'variant' === $property && isset( $value[ 'variant' ] ) && ! empty( $value[ 'variant' ] ) ) { |
|
| 67 | 67 | |
| 68 | 68 | // Get the font_weight. |
| 69 | - $font_weight = str_replace( 'italic', '', $value['variant'] ); |
|
| 69 | + $font_weight = str_replace( 'italic', '', $value[ 'variant' ] ); |
|
| 70 | 70 | $font_weight = ( in_array( $font_weight, array( '', 'regular' ), true ) ) ? '400' : $font_weight; |
| 71 | 71 | |
| 72 | 72 | // Is this italic? |
| 73 | - $is_italic = ( false !== strpos( $value['variant'], 'italic' ) ); |
|
| 74 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $font_weight; |
|
| 73 | + $is_italic = ( false !== strpos( $value[ 'variant' ], 'italic' ) ); |
|
| 74 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-weight' ] = $font_weight; |
|
| 75 | 75 | if ( $is_italic ) { |
| 76 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = 'italic'; |
|
| 76 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ 'font-style' ] = 'italic'; |
|
| 77 | 77 | } |
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $property_value = $this->process_property_value( $property, $value[ $property ] ); |
| 82 | 82 | if ( 'font-family' === $property ) { |
| 83 | - $value['font-backup'] = ( isset( $value['font-backup'] ) ) ? $value['font-backup'] : ''; |
|
| 83 | + $value[ 'font-backup' ] = ( isset( $value[ 'font-backup' ] ) ) ? $value[ 'font-backup' ] : ''; |
|
| 84 | 84 | $property_value = $this->process_property_value( |
| 85 | 85 | $property, array( |
| 86 | - $value['font-family'], |
|
| 87 | - $value['font-backup'], |
|
| 86 | + $value[ 'font-family' ], |
|
| 87 | + $value[ 'font-backup' ], |
|
| 88 | 88 | ) |
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | - $property = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property; |
|
| 92 | - $property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value; |
|
| 93 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix']; |
|
| 91 | + $property = ( isset( $output[ 'choice' ] ) && isset( $output[ 'property' ] ) ) ? $output[ 'property' ] : $property; |
|
| 92 | + $property_value = ( is_array( $property_value ) && isset( $property_value[ 0 ] ) ) ? $property_value[ 0 ] : $property_value; |
|
| 93 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $property ] = $output[ 'prefix' ] . $property_value . $output[ 'suffix' ]; |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | protected function process_output( $output, $value ) { |
| 25 | 25 | |
| 26 | - if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
|
| 26 | + if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | $output = wp_parse_args( |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | ) |
| 36 | 36 | ); |
| 37 | 37 | if ( is_array( $value ) ) { |
| 38 | - if ( isset( $output['choice'] ) && $output['choice'] ) { |
|
| 39 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix']; |
|
| 38 | + if ( isset( $output[ 'choice' ] ) && $output[ 'choice' ] ) { |
|
| 39 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ $output[ 'choice' ] ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | - if ( isset( $value['url'] ) ) { |
|
| 43 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
| 42 | + if ( isset( $value[ 'url' ] ) ) { |
|
| 43 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value[ 'url' ] ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
| 48 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
| 49 | 49 | } |
| 50 | 50 | } |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | public static function css( $field ) { |
| 147 | 147 | |
| 148 | 148 | // Set class vars. |
| 149 | - self::$settings = $field['settings']; |
|
| 150 | - self::$callback = $field['sanitize_callback']; |
|
| 151 | - self::$field_type = $field['type']; |
|
| 152 | - self::$output = $field['output']; |
|
| 149 | + self::$settings = $field[ 'settings' ]; |
|
| 150 | + self::$callback = $field[ 'sanitize_callback' ]; |
|
| 151 | + self::$field_type = $field[ 'type' ]; |
|
| 152 | + self::$output = $field[ 'output' ]; |
|
| 153 | 153 | if ( ! is_array( self::$output ) ) { |
| 154 | 154 | self::$output = array( |
| 155 | 155 | array( |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | // Find the class that will handle the outpout for this field. |
| 166 | 166 | $classname = 'Kirki_Output'; |
| 167 | 167 | $field_output_classes = apply_filters( |
| 168 | - "kirki_{$field['kirki_config']}_output_control_classnames", array( |
|
| 168 | + "kirki_{$field[ 'kirki_config' ]}_output_control_classnames", array( |
|
| 169 | 169 | 'kirki-background' => 'Kirki_Output_Field_Background', |
| 170 | 170 | 'kirki-dimensions' => 'Kirki_Output_Field_Dimensions', |
| 171 | 171 | 'kirki-image' => 'Kirki_Output_Field_Image', |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | if ( array_key_exists( self::$field_type, $field_output_classes ) ) { |
| 177 | 177 | $classname = $field_output_classes[ self::$field_type ]; |
| 178 | 178 | } |
| 179 | - $obj = new $classname( $field['kirki_config'], self::$output, self::$value, $field ); |
|
| 179 | + $obj = new $classname( $field[ 'kirki_config' ], self::$output, self::$value, $field ); |
|
| 180 | 180 | return $obj->get_styles(); |
| 181 | 181 | |
| 182 | 182 | } |
@@ -73,14 +73,14 @@ |
||
| 73 | 73 | 'logoImage' => '', |
| 74 | 74 | 'description' => '', |
| 75 | 75 | ); |
| 76 | - if ( isset( $config['logo_image'] ) && '' !== $config['logo_image'] ) { |
|
| 77 | - $vars['logoImage'] = esc_url_raw( $config['logo_image'] ); |
|
| 76 | + if ( isset( $config[ 'logo_image' ] ) && '' !== $config[ 'logo_image' ] ) { |
|
| 77 | + $vars[ 'logoImage' ] = esc_url_raw( $config[ 'logo_image' ] ); |
|
| 78 | 78 | } |
| 79 | - if ( isset( $config['description'] ) && '' !== $config['description'] ) { |
|
| 80 | - $vars['description'] = esc_textarea( $config['description'] ); |
|
| 79 | + if ( isset( $config[ 'description' ] ) && '' !== $config[ 'description' ] ) { |
|
| 80 | + $vars[ 'description' ] = esc_textarea( $config[ 'description' ] ); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if ( ! empty( $vars['logoImage'] ) || ! empty( $vars['description'] ) ) { |
|
| 83 | + if ( ! empty( $vars[ 'logoImage' ] ) || ! empty( $vars[ 'description' ] ) ) { |
|
| 84 | 84 | wp_register_script( 'kirki-branding', Kirki::$url . '/modules/customizer-branding/branding.js', array(), KIRKI_VERSION, false ); |
| 85 | 85 | wp_localize_script( 'kirki-branding', 'kirkiBranding', $vars ); |
| 86 | 86 | wp_enqueue_script( 'kirki-branding' ); |
@@ -51,10 +51,10 @@ |
||
| 51 | 51 | ) |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 55 | - $array['content'] = $this->get_content(); |
|
| 56 | - $array['active'] = $this->active(); |
|
| 57 | - $array['instanceNumber'] = $this->instance_number; |
|
| 54 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 55 | + $array[ 'content' ] = $this->get_content(); |
|
| 56 | + $array[ 'active' ] = $this->active(); |
|
| 57 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
| 58 | 58 | |
| 59 | 59 | return $array; |
| 60 | 60 | } |
@@ -53,15 +53,15 @@ |
||
| 53 | 53 | ) |
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | - $array['title'] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 57 | - $array['content'] = $this->get_content(); |
|
| 58 | - $array['active'] = $this->active(); |
|
| 59 | - $array['instanceNumber'] = $this->instance_number; |
|
| 56 | + $array[ 'title' ] = html_entity_decode( $this->title, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 57 | + $array[ 'content' ] = $this->get_content(); |
|
| 58 | + $array[ 'active' ] = $this->active(); |
|
| 59 | + $array[ 'instanceNumber' ] = $this->instance_number; |
|
| 60 | 60 | |
| 61 | - $array['customizeAction'] = esc_attr__( 'Customizing', 'kirki' ); |
|
| 61 | + $array[ 'customizeAction' ] = esc_attr__( 'Customizing', 'kirki' ); |
|
| 62 | 62 | if ( $this->panel ) { |
| 63 | 63 | /* translators: The title. */ |
| 64 | - $array['customizeAction'] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 64 | + $array[ 'customizeAction' ] = sprintf( esc_attr__( 'Customizing ▸ %s', 'kirki' ), esc_html( $this->manager->get_panel( $this->panel )->title ) ); |
|
| 65 | 65 | } |
| 66 | 66 | return $array; |
| 67 | 67 | } |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function typography_field_tweaks( $value, $field_id ) { |
| 42 | 42 | |
| 43 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) { |
|
| 44 | - if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) { |
|
| 43 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'type' ] ) ) { |
|
| 44 | + if ( 'kirki-typography' === Kirki::$fields[ $field_id ][ 'type' ] ) { |
|
| 45 | 45 | |
| 46 | 46 | // Sanitize the value. |
| 47 | 47 | // This also adds font-weight if it doesn't already exist. |
| 48 | 48 | $value = Kirki_Field_Typography::sanitize( $value ); |
| 49 | 49 | |
| 50 | 50 | // Combine font-family and font-backup. |
| 51 | - if ( isset( $value['font-family'] ) && isset( $value['font-backup'] ) ) { |
|
| 52 | - $value['font-family'] .= ', ' . $value['font-backup']; |
|
| 53 | - unset( $value['font-backup'] ); |
|
| 51 | + if ( isset( $value[ 'font-family' ] ) && isset( $value[ 'font-backup' ] ) ) { |
|
| 52 | + $value[ 'font-family' ] .= ', ' . $value[ 'font-backup' ]; |
|
| 53 | + unset( $value[ 'font-backup' ] ); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -87,39 +87,39 @@ discard block |
||
| 87 | 87 | $config_id = 'global'; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 90 | + if ( 'theme_mod' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
| 91 | 91 | |
| 92 | 92 | // We're using theme_mods so just get the value using get_theme_mod. |
| 93 | 93 | $default_value = null; |
| 94 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
| 95 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
| 94 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) { |
|
| 95 | + $default_value = Kirki::$fields[ $field_id ][ 'default' ]; |
|
| 96 | 96 | } |
| 97 | 97 | $value = get_theme_mod( $field_id, $default_value ); |
| 98 | 98 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
| 101 | + if ( 'option' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
| 102 | 102 | |
| 103 | 103 | // We're using options. |
| 104 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
| 104 | + if ( '' !== Kirki::$config[ $config_id ][ 'option_name' ] ) { |
|
| 105 | 105 | |
| 106 | 106 | // Options are serialized as a single option in the db. |
| 107 | 107 | // We'll have to get the option and then get the item from the array. |
| 108 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
| 108 | + $options = get_option( Kirki::$config[ $config_id ][ 'option_name' ] ); |
|
| 109 | 109 | |
| 110 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
| 111 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
| 110 | + if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']' ] ) ) { |
|
| 111 | + $field_id = Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']'; |
|
| 112 | 112 | } |
| 113 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
| 113 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ][ 'option_name' ] . '[', '', $field_id ) ); |
|
| 114 | 114 | |
| 115 | - $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : ''; |
|
| 115 | + $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) ? Kirki::$fields[ $field_id ][ 'default' ] : ''; |
|
| 116 | 116 | $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
| 117 | 117 | $value = maybe_unserialize( $value ); |
| 118 | 118 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // Each option separately saved in the db. |
| 122 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
| 122 | + $value = get_option( $field_id, Kirki::$fields[ $field_id ][ 'default' ] ); |
|
| 123 | 123 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
| 124 | 124 | |
| 125 | 125 | } |
@@ -135,18 +135,18 @@ discard block |
||
| 135 | 135 | * @return string|array |
| 136 | 136 | */ |
| 137 | 137 | public static function get_sanitized_field_value( $field ) { |
| 138 | - $value = $field['default']; |
|
| 139 | - if ( isset( $field['option_type'] ) && 'theme_mod' === $field['option_type'] ) { |
|
| 140 | - $value = get_theme_mod( $field['settings'], $field['default'] ); |
|
| 141 | - } elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) { |
|
| 142 | - if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
|
| 143 | - $all_values = get_option( $field['option_name'], array() ); |
|
| 144 | - $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
|
| 138 | + $value = $field[ 'default' ]; |
|
| 139 | + if ( isset( $field[ 'option_type' ] ) && 'theme_mod' === $field[ 'option_type' ] ) { |
|
| 140 | + $value = get_theme_mod( $field[ 'settings' ], $field[ 'default' ] ); |
|
| 141 | + } elseif ( isset( $field[ 'option_type' ] ) && 'option' === $field[ 'option_type' ] ) { |
|
| 142 | + if ( isset( $field[ 'option_name' ] ) && '' !== $field[ 'option_name' ] ) { |
|
| 143 | + $all_values = get_option( $field[ 'option_name' ], array() ); |
|
| 144 | + $sub_setting_id = str_replace( array( ']', $field[ 'option_name' ] . '[' ), '', $field[ 'settings' ] ); |
|
| 145 | 145 | if ( isset( $all_values[ $sub_setting_id ] ) ) { |
| 146 | 146 | $value = $all_values[ $sub_setting_id ]; |
| 147 | 147 | } |
| 148 | 148 | } else { |
| 149 | - $value = get_option( $field['settings'], $field['default'] ); |
|
| 149 | + $value = get_option( $field[ 'settings' ], $field[ 'default' ] ); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | |
| 119 | 119 | global $l10n; |
| 120 | 120 | if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
| 121 | - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited |
|
| 121 | + $l10n[ 'kirki' ] = $l10n[ $this->get_theme_textdomain() ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | // Check if the domain is "kirki". |