@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $config = apply_filters( 'kirki_config', array() ); |
78 | 78 | |
79 | 79 | // If we have set $config['disable_google_fonts'] to true then do not proceed any further. |
80 | - if ( isset( $config['disable_google_fonts'] ) && true === $config['disable_google_fonts'] ) { |
|
80 | + if ( isset( $config[ 'disable_google_fonts' ] ) && true === $config[ 'disable_google_fonts' ] ) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -115,57 +115,57 @@ discard block |
||
115 | 115 | global $wp_customize; |
116 | 116 | |
117 | 117 | // Process typography fields. |
118 | - if ( isset( $args['type'] ) && 'kirki-typography' === $args['type'] ) { |
|
118 | + if ( isset( $args[ 'type' ] ) && 'kirki-typography' === $args[ 'type' ] ) { |
|
119 | 119 | |
120 | 120 | // Get the value. |
121 | 121 | $value = Kirki_Values::get_sanitized_field_value( $args ); |
122 | 122 | |
123 | - if ( isset( $value['downloadFont'] ) && $value['downloadFont'] ) { |
|
124 | - $this->hosted_fonts[] = $value['font-family']; |
|
123 | + if ( isset( $value[ 'downloadFont' ] ) && $value[ 'downloadFont' ] ) { |
|
124 | + $this->hosted_fonts[ ] = $value[ 'font-family' ]; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // If we don't have a font-family then we can skip this. |
128 | - if ( ! $wp_customize && ( ! isset( $value['font-family'] ) || in_array( $value['font-family'], $this->hosted_fonts ) ) ) { |
|
128 | + if ( ! $wp_customize && ( ! isset( $value[ 'font-family' ] ) || in_array( $value[ 'font-family' ], $this->hosted_fonts ) ) ) { |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | 132 | // If not a google-font, then we can skip this. |
133 | - if ( ! isset( $value['font-family'] ) || ! Kirki_Fonts::is_google_font( $value['font-family'] ) ) { |
|
133 | + if ( ! isset( $value[ 'font-family' ] ) || ! Kirki_Fonts::is_google_font( $value[ 'font-family' ] ) ) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 | |
137 | 137 | // Set a default value for variants. |
138 | - if ( ! isset( $value['variant'] ) ) { |
|
139 | - $value['variant'] = 'regular'; |
|
138 | + if ( ! isset( $value[ 'variant' ] ) ) { |
|
139 | + $value[ 'variant' ] = 'regular'; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Add the requested google-font. |
143 | - if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) { |
|
144 | - $this->fonts[ $value['font-family'] ] = array(); |
|
143 | + if ( ! isset( $this->fonts[ $value[ 'font-family' ] ] ) ) { |
|
144 | + $this->fonts[ $value[ 'font-family' ] ] = array(); |
|
145 | 145 | } |
146 | - if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) { |
|
147 | - $this->fonts[ $value['font-family'] ][] = $value['variant']; |
|
146 | + if ( ! in_array( $value[ 'variant' ], $this->fonts[ $value[ 'font-family' ] ], true ) ) { |
|
147 | + $this->fonts[ $value[ 'font-family' ] ][ ] = $value[ 'variant' ]; |
|
148 | 148 | } |
149 | 149 | // Are we force-loading all variants? |
150 | 150 | if ( true === self::$force_load_all_variants ) { |
151 | 151 | $all_variants = Kirki_Fonts::get_all_variants(); |
152 | - $args['choices']['variant'] = array_keys( $all_variants ); |
|
152 | + $args[ 'choices' ][ 'variant' ] = array_keys( $all_variants ); |
|
153 | 153 | } |
154 | 154 | |
155 | - if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) { |
|
156 | - foreach ( $args['choices']['variant'] as $extra_variant ) { |
|
157 | - $this->fonts[ $value['font-family'] ][] = $extra_variant; |
|
155 | + if ( ! empty( $args[ 'choices' ][ 'variant' ] ) && is_array( $args[ 'choices' ][ 'variant' ] ) ) { |
|
156 | + foreach ( $args[ 'choices' ][ 'variant' ] as $extra_variant ) { |
|
157 | + $this->fonts[ $value[ 'font-family' ] ][ ] = $extra_variant; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // Process non-typography fields. |
164 | - if ( isset( $args['output'] ) && is_array( $args['output'] ) ) { |
|
165 | - foreach ( $args['output'] as $output ) { |
|
164 | + if ( isset( $args[ 'output' ] ) && is_array( $args[ 'output' ] ) ) { |
|
165 | + foreach ( $args[ 'output' ] as $output ) { |
|
166 | 166 | |
167 | 167 | // If we don't have a typography-related output argument we can skip this. |
168 | - if ( ! isset( $output['property'] ) || ! in_array( $output['property'], array( 'font-family', 'font-weight' ), true ) ) { |
|
168 | + if ( ! isset( $output[ 'property' ] ) || ! in_array( $output[ 'property' ], array( 'font-family', 'font-weight' ), true ) ) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | $value = Kirki_Values::get_sanitized_field_value( $args ); |
174 | 174 | |
175 | 175 | if ( is_string( $value ) ) { |
176 | - if ( 'font-family' === $output['property'] ) { |
|
176 | + if ( 'font-family' === $output[ 'property' ] ) { |
|
177 | 177 | if ( ! array_key_exists( $value, $this->fonts ) ) { |
178 | 178 | $this->fonts[ $value ] = array(); |
179 | 179 | } |
180 | - } elseif ( 'font-weight' === $output['property'] ) { |
|
180 | + } elseif ( 'font-weight' === $output[ 'property' ] ) { |
|
181 | 181 | foreach ( $this->fonts as $font => $variants ) { |
182 | 182 | if ( ! in_array( $value, $variants, true ) ) { |
183 | - $this->fonts[ $font ][] = $value; |
|
183 | + $this->fonts[ $font ][ ] = $value; |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | |
213 | 213 | // Get all valid font variants for this font. |
214 | 214 | $font_variants = array(); |
215 | - if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { |
|
216 | - $font_variants = $this->google_fonts[ $font ]['variants']; |
|
215 | + if ( isset( $this->google_fonts[ $font ][ 'variants' ] ) ) { |
|
216 | + $font_variants = $this->google_fonts[ $font ][ 'variants' ]; |
|
217 | 217 | } |
218 | 218 | foreach ( $variants as $variant ) { |
219 | 219 |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | public function custom_css() { |
69 | 69 | |
70 | 70 | $config = apply_filters( 'kirki_config', array() ); |
71 | - if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) { |
|
71 | + if ( ! isset( $config[ 'color_accent' ] ) && ! isset( $config[ 'color_back' ] ) ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | - $back = isset( $config['color_back'] ) ? $config['color_back'] : false; |
|
74 | + $back = isset( $config[ 'color_back' ] ) ? $config[ 'color_back' ] : false; |
|
75 | 75 | |
76 | 76 | $text_on_back = ''; |
77 | 77 | $border_on_back = ''; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $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 ); |
94 | 94 | $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 ); |
95 | 95 | } |
96 | - $accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false; |
|
96 | + $accent = ( isset( $config[ 'color_accent' ] ) ) ? $config[ 'color_accent' ] : false; |
|
97 | 97 | if ( $accent ) { |
98 | 98 | $accent_obj = ariColor::newColor( $accent ); |
99 | 99 | $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 ); |
@@ -405,18 +405,18 @@ discard block |
||
405 | 405 | color: #444 !important; |
406 | 406 | } |
407 | 407 | |
408 | - <?php if ( isset( $config['width'] ) ) : ?> |
|
408 | + <?php if ( isset( $config[ 'width' ] ) ) : ?> |
|
409 | 409 | .wp-full-overlay-sidebar { |
410 | - width: <?php echo esc_attr( $config['width'] ); ?>; |
|
410 | + width: <?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
411 | 411 | } |
412 | 412 | .expanded .wp-full-overlay-footer { |
413 | - width: <?php echo esc_attr( $config['width'] ); ?>; |
|
413 | + width: <?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
414 | 414 | } |
415 | 415 | .wp-full-overlay.expanded { |
416 | - margin-left: <?php echo esc_attr( $config['width'] ); ?>; |
|
416 | + margin-left: <?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
417 | 417 | } |
418 | 418 | .wp-full-overlay.collapsed .wp-full-overlay-sidebar { |
419 | - margin-left: -<?php echo esc_attr( $config['width'] ); ?>; |
|
419 | + margin-left: -<?php echo esc_attr( $config[ 'width' ] ); ?>; |
|
420 | 420 | } |
421 | 421 | <?php endif; ?> |
422 | 422 | </style> |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | // Return regular if the one we want could not be found. |
206 | - if ( isset( $local_urls['regular'] ) ) { |
|
207 | - return $local_urls['regular']; |
|
206 | + if ( isset( $local_urls[ 'regular' ] ) ) { |
|
207 | + return $local_urls[ 'regular' ]; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | // Return the first available if all else failed. |
211 | 211 | $vals = array_values( $local_urls ); |
212 | - return $vals[0]; |
|
212 | + return $vals[ 0 ]; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | public function get_root_path() { |
402 | 402 | // Get the upload directory for this site. |
403 | 403 | $upload_dir = wp_upload_dir(); |
404 | - $path = untrailingslashit( wp_normalize_path( $upload_dir['basedir'] ) ) . '/webfonts'; |
|
404 | + $path = untrailingslashit( wp_normalize_path( $upload_dir[ 'basedir' ] ) ) . '/webfonts'; |
|
405 | 405 | |
406 | 406 | // If the folder doesn't exist, create it. |
407 | 407 | if ( ! file_exists( $path ) ) { |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $upload_dir = wp_upload_dir(); |
427 | 427 | |
428 | 428 | // The URL. |
429 | - $url = trailingslashit( $upload_dir['baseurl'] ); |
|
429 | + $url = trailingslashit( $upload_dir[ 'baseurl' ] ); |
|
430 | 430 | // Take care of domain mapping. |
431 | 431 | // When using domain mapping we have to make sure that the URL to the file |
432 | 432 | // does not include the original domain but instead the mapped domain. |