@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | // Add the requested google-font. |
189 | - if ( ! isset( $this->fonts[ $value['font-family'] ] ) ) { |
|
190 | - $this->fonts[ $value['font-family'] ] = array(); |
|
189 | + if ( ! isset( $this->fonts[$value['font-family']] ) ) { |
|
190 | + $this->fonts[$value['font-family']] = array(); |
|
191 | 191 | } |
192 | - if ( ! in_array( $value['variant'], $this->fonts[ $value['font-family'] ], true ) ) { |
|
193 | - $this->fonts[ $value['font-family'] ][] = $value['variant']; |
|
192 | + if ( ! in_array( $value['variant'], $this->fonts[$value['font-family']], true ) ) { |
|
193 | + $this->fonts[$value['font-family']][] = $value['variant']; |
|
194 | 194 | } |
195 | 195 | } else { |
196 | 196 | |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | |
209 | 209 | if ( 'font-family' === $output['property'] ) { |
210 | 210 | if ( ! array_key_exists( $value, $this->fonts ) ) { |
211 | - $this->fonts[ $value ] = array(); |
|
211 | + $this->fonts[$value] = array(); |
|
212 | 212 | } |
213 | 213 | } elseif ( 'font-weight' === $output['property'] ) { |
214 | 214 | foreach ( $this->fonts as $font => $variants ) { |
215 | 215 | if ( ! in_array( $value, $variants, true ) ) { |
216 | - $this->fonts[ $font ][] = $value; |
|
216 | + $this->fonts[$font][] = $value; |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | } elseif ( 'font-subset' === $output['property'] || 'subset' === $output['property'] || 'subsets' === $output['property'] ) { |
@@ -252,31 +252,31 @@ discard block |
||
252 | 252 | // Determine if this is indeed a google font or not. |
253 | 253 | // If it's not, then just remove it from the array. |
254 | 254 | if ( ! array_key_exists( $font, $this->google_fonts ) ) { |
255 | - unset( $this->fonts[ $font ] ); |
|
255 | + unset( $this->fonts[$font] ); |
|
256 | 256 | continue; |
257 | 257 | } |
258 | 258 | |
259 | 259 | // Get all valid font variants for this font. |
260 | 260 | $font_variants = array(); |
261 | - if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { |
|
262 | - $font_variants = $this->google_fonts[ $font ]['variants']; |
|
261 | + if ( isset( $this->google_fonts[$font]['variants'] ) ) { |
|
262 | + $font_variants = $this->google_fonts[$font]['variants']; |
|
263 | 263 | } |
264 | 264 | foreach ( $variants as $variant ) { |
265 | 265 | |
266 | 266 | // If this is not a valid variant for this font-family |
267 | 267 | // then unset it and move on to the next one. |
268 | 268 | if ( ! in_array( $variant, $font_variants, true ) ) { |
269 | - $variant_key = array_search( $variant, $this->fonts[ $font ] ); |
|
270 | - unset( $this->fonts[ $font ][ $variant_key ] ); |
|
269 | + $variant_key = array_search( $variant, $this->fonts[$font] ); |
|
270 | + unset( $this->fonts[$font][$variant_key] ); |
|
271 | 271 | continue; |
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
275 | 275 | // Check if the selected subsets exist, even in one of the selected fonts. |
276 | 276 | // If they don't, then they have to be removed otherwise the link will fail. |
277 | - if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) { |
|
277 | + if ( isset( $this->google_fonts[$font]['subsets'] ) ) { |
|
278 | 278 | foreach ( $this->subsets as $subset ) { |
279 | - if ( in_array( $subset, $this->google_fonts[ $font ]['subsets'], true ) ) { |
|
279 | + if ( in_array( $subset, $this->google_fonts[$font]['subsets'], true ) ) { |
|
280 | 280 | $valid_subsets[] = $subset; |
281 | 281 | } |
282 | 282 | } |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | |
302 | 302 | // Are we force-loading all variants? |
303 | 303 | if ( true === self::$force_load_all_variants ) { |
304 | - if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { |
|
305 | - $variants = $this->google_fonts[ $font ]['variants']; |
|
304 | + if ( isset( $this->google_fonts[$font]['variants'] ) ) { |
|
305 | + $variants = $this->google_fonts[$font]['variants']; |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | $variants = implode( ',', $variants ); |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | // Are we force-loading all subsets? |
318 | 318 | if ( true === self::$force_load_all_subsets ) { |
319 | 319 | |
320 | - if ( isset( $this->google_fonts[ $font ]['subsets'] ) ) { |
|
321 | - foreach ( $this->google_fonts[ $font ]['subsets'] as $subset ) { |
|
320 | + if ( isset( $this->google_fonts[$font]['subsets'] ) ) { |
|
321 | + foreach ( $this->google_fonts[$font]['subsets'] as $subset ) { |
|
322 | 322 | $this->subsets[] = $subset; |
323 | 323 | } |
324 | 324 | } |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | $media_fields_to_filter = array(); |
111 | 111 | |
112 | 112 | foreach ( $args['fields'] as $key => $value ) { |
113 | - $args['fields'][ $key ]['default'] = ( ! isset( $value['default'] ) ) ? '' :; |
|
114 | - $args['fields'][ $key ]['label'] = ( ! isset( $value['label'] ) ) ? '' :; |
|
115 | - $args['fields'][ $key ]['id'] = $key; |
|
113 | + $args['fields'][$key]['default'] = ( ! isset( $value['default'] ) ) ? '' : ; |
|
114 | + $args['fields'][$key]['label'] = ( ! isset( $value['label'] ) ) ? '' : ; |
|
115 | + $args['fields'][$key]['id'] = $key; |
|
116 | 116 | |
117 | 117 | // We check if the filed is an uploaded media ( image , file, video, etc.. ). |
118 | 118 | if ( isset( $value['type'] ) ) { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | case 'cropped_image': |
122 | 122 | case 'upload': |
123 | 123 | // We add it to the list of fields that need some extra filtering/processing. |
124 | - $media_fields_to_filter[ $key ] = true; |
|
124 | + $media_fields_to_filter[$key] = true; |
|
125 | 125 | break; |
126 | 126 | |
127 | 127 | case 'dropdown-pages': |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | ) |
137 | 137 | ); |
138 | 138 | // Hackily add in the data link parameter. |
139 | - $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); |
|
140 | - $args['fields'][ $key ]['dropdown'] = $dropdown; |
|
139 | + $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][$key]['id'] ) . '"' . $this->get_link(), $dropdown ); |
|
140 | + $args['fields'][$key]['dropdown'] = $dropdown; |
|
141 | 141 | break; |
142 | 142 | } |
143 | 143 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | } |
554 | 554 | |
555 | 555 | // Validating row label field. |
556 | - if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) { |
|
556 | + if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][esc_attr( $args['row_label']['field'] )] ) ) { |
|
557 | 557 | $this->row_label['field'] = esc_attr( $args['row_label']['field'] ); |
558 | 558 | } else { |
559 | 559 | // If from field is not set correctly, making sure standard is set as the type. |
@@ -589,6 +589,6 @@ discard block |
||
589 | 589 | if ( false === $id ) { |
590 | 590 | return $translation_strings; |
591 | 591 | } |
592 | - return $translation_strings[ $id ]; |
|
592 | + return $translation_strings[$id]; |
|
593 | 593 | } |
594 | 594 | } |