@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Add the requested google-font. |
| 144 | - if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) { |
|
| 145 | - $this->fonts[ $value['font-family'] ] = array(); |
|
| 144 | + if ( ! isset( $this->fonts[$value['font-family']] ) ) { |
|
| 145 | + $this->fonts[$value['font-family']] = array(); |
|
| 146 | 146 | } |
| 147 | - if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) { |
|
| 148 | - $this->fonts[ $value['font-family'] ][] = $value['variant']; |
|
| 147 | + if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']], true ) ) { |
|
| 148 | + $this->fonts[$value['font-family']][] = $value['variant']; |
|
| 149 | 149 | } |
| 150 | 150 | // Are we force-loading all variants? |
| 151 | 151 | if ( true === self::$force_load_all_variants ) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) { |
| 157 | 157 | foreach ( $args['choices']['variant'] as $extra_variant ) { |
| 158 | - $this->fonts[ $value['font-family'] ][] = $extra_variant; |
|
| 158 | + $this->fonts[$value['font-family']][] = $extra_variant; |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } else { |
@@ -175,12 +175,12 @@ discard block |
||
| 175 | 175 | if ( is_string( $value ) ) { |
| 176 | 176 | if ( 'font-family' === $output['property'] ) { |
| 177 | 177 | if ( ! array_key_exists( $value, $this->fonts ) ) { |
| 178 | - $this->fonts[ $value ] = array(); |
|
| 178 | + $this->fonts[$value] = array(); |
|
| 179 | 179 | } |
| 180 | 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 | } elseif ( 'font-subset' === $output['property'] || 'subset' === $output['property'] || 'subsets' === $output['property'] ) { |
@@ -220,31 +220,31 @@ discard block |
||
| 220 | 220 | // Determine if this is indeed a google font or not. |
| 221 | 221 | // If it's not, then just remove it from the array. |
| 222 | 222 | if ( ! array_key_exists( $font, $this->google_fonts ) ) { |
| 223 | - unset( $this->fonts[ $font ] ); |
|
| 223 | + unset( $this->fonts[$font] ); |
|
| 224 | 224 | continue; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Get all valid font variants for this font. |
| 228 | 228 | $font_variants = array(); |
| 229 | - if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { |
|
| 230 | - $font_variants = $this->google_fonts[ $font ]['variants']; |
|
| 229 | + if ( isset( $this->google_fonts[$font]['variants'] ) ) { |
|
| 230 | + $font_variants = $this->google_fonts[$font]['variants']; |
|
| 231 | 231 | } |
| 232 | 232 | foreach ( $variants as $variant ) { |
| 233 | 233 | |
| 234 | 234 | // If this is not a valid variant for this font-family |
| 235 | 235 | // then unset it and move on to the next one. |
| 236 | 236 | if ( ! in_array( $variant, $font_variants, true ) ) { |
| 237 | - $variant_key = array_search( $variant, $this->fonts[ $font ], true ); |
|
| 238 | - unset( $this->fonts[ $font ][ $variant_key ] ); |
|
| 237 | + $variant_key = array_search( $variant, $this->fonts[$font], true ); |
|
| 238 | + unset( $this->fonts[$font][$variant_key] ); |
|
| 239 | 239 | continue; |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Check if the selected subsets exist, even in one of the selected fonts. |
| 244 | 244 | // If they don't, then they have to be removed otherwise the link will fail. |
| 245 | - if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) { |
|
| 245 | + if ( isset( $this->google_fonts[$font]['subsets'] ) ) { |
|
| 246 | 246 | foreach ( $this->subsets as $subset ) { |
| 247 | - if ( in_array( $subset, $this->google_fonts[ $font ]['subsets'], true ) ) { |
|
| 247 | + if ( in_array( $subset, $this->google_fonts[$font]['subsets'], true ) ) { |
|
| 248 | 248 | $valid_subsets[] = $subset; |
| 249 | 249 | } |
| 250 | 250 | } |