@@ -76,13 +76,13 @@ |
||
| 76 | 76 | |
| 77 | 77 | $fields = Kirki::$fields; |
| 78 | 78 | foreach ( $fields as $field ) { |
| 79 | - if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
|
| 79 | + if ( isset( $field[ 'tooltip' ] ) && ! empty( $field[ 'tooltip' ] ) ) { |
|
| 80 | 80 | // Get the control ID and properly format it for the tooltips |
| 81 | - $id = str_replace( '[', '-', str_replace( ']', '', $field['settings'] ) ); |
|
| 81 | + $id = str_replace( '[', '-', str_replace( ']', '', $field[ 'settings' ] ) ); |
|
| 82 | 82 | // Add the tooltips content. |
| 83 | 83 | $this->tooltips_content[ $id ] = array( |
| 84 | 84 | 'id' => $id, |
| 85 | - 'content' => wp_kses_post( $field['tooltip'] ), |
|
| 85 | + 'content' => wp_kses_post( $field[ 'tooltip' ] ), |
|
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -35,25 +35,25 @@ discard block |
||
| 35 | 35 | public function to_json() { |
| 36 | 36 | parent::to_json(); |
| 37 | 37 | |
| 38 | - if ( is_array( $this->json['value'] ) ) { |
|
| 39 | - foreach ( array_keys( $this->json['value'] ) as $key ) { |
|
| 40 | - if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json['default'][ $key ] ) ) { |
|
| 41 | - unset( $this->json['value'][ $key ] ); |
|
| 38 | + if ( is_array( $this->json[ 'value' ] ) ) { |
|
| 39 | + foreach ( array_keys( $this->json[ 'value' ] ) as $key ) { |
|
| 40 | + if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ), true ) && ! isset( $this->json[ 'default' ][ $key ] ) ) { |
|
| 41 | + unset( $this->json[ 'value' ][ $key ] ); |
|
| 42 | 42 | } |
| 43 | 43 | // Fix for https://wordpress.org/support/topic/white-font-after-updateing-to-3-0-16. |
| 44 | - if ( ! isset( $this->json['default'][ $key ] ) ) { |
|
| 45 | - unset( $this->json['value'][ $key ] ); |
|
| 44 | + if ( ! isset( $this->json[ 'default' ][ $key ] ) ) { |
|
| 45 | + unset( $this->json[ 'value' ][ $key ] ); |
|
| 46 | 46 | } |
| 47 | 47 | // Fix for https://github.com/aristath/kirki/issues/1405. |
| 48 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
| 49 | - unset( $this->json['value'][ $key ] ); |
|
| 48 | + if ( isset( $this->json[ 'default' ][ $key ] ) && false === $this->json[ 'default' ][ $key ] ) { |
|
| 49 | + unset( $this->json[ 'value' ][ $key ] ); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
|
| 55 | - $this->json['show_subsets'] = ( true === Kirki_Fonts_Google::$force_load_all_subsets ) ? false : true; |
|
| 56 | - $this->json['languages'] = Kirki_Fonts::get_google_font_subsets(); |
|
| 54 | + $this->json[ 'show_variants' ] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
|
| 55 | + $this->json[ 'show_subsets' ] = ( true === Kirki_Fonts_Google::$force_load_all_subsets ) ? false : true; |
|
| 56 | + $this->json[ 'languages' ] = Kirki_Fonts::get_google_font_subsets(); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -250,12 +250,12 @@ discard block |
||
| 250 | 250 | $final_variants = array(); |
| 251 | 251 | foreach ( $variants as $variant ) { |
| 252 | 252 | if ( is_string( $variant ) ) { |
| 253 | - $final_variants[] = array( |
|
| 253 | + $final_variants[ ] = array( |
|
| 254 | 254 | 'id' => $variant, |
| 255 | 255 | 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
| 256 | 256 | ); |
| 257 | - } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
|
| 258 | - $final_variants[] = $variant; |
|
| 257 | + } elseif ( is_array( $variant ) && isset( $variant[ 'id' ] ) && isset( $variant[ 'label' ] ) ) { |
|
| 258 | + $final_variants[ ] = $variant; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | return $final_variants; |