@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $google_fonts = array(); |
| 101 | 101 | if ( is_array( $fonts ) ) { |
| 102 | 102 | foreach ( $fonts['items'] as $font ) { |
| 103 | - $google_fonts[ $font['family'] ] = array( |
|
| 103 | + $google_fonts[$font['family']] = array( |
|
| 104 | 104 | 'label' => $font['family'], |
| 105 | 105 | 'variants' => $font['variants'], |
| 106 | 106 | 'subsets' => $font['subsets'], |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $fonts = self::get_all_fonts(); |
| 176 | 176 | $fonts_array = array(); |
| 177 | 177 | foreach ( $fonts as $key => $args ) { |
| 178 | - $fonts_array[ $key ] = $key; |
|
| 178 | + $fonts_array[$key] = $key; |
|
| 179 | 179 | } |
| 180 | 180 | return $fonts_array; |
| 181 | 181 | } |
@@ -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 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $class_name = 'WP_Customize_Control'; |
| 68 | 68 | // Get the classname from the array of control classnames. |
| 69 | 69 | if ( array_key_exists( $args['type'], self::$control_types ) ) { |
| 70 | - $class_name = self::$control_types[ $args['type'] ]; |
|
| 70 | + $class_name = self::$control_types[$args['type']]; |
|
| 71 | 71 | } |
| 72 | 72 | return $class_name; |
| 73 | 73 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | foreach ( self::$control_types as $key => $classname ) { |
| 142 | 142 | |
| 143 | 143 | if ( ! class_exists( $classname ) ) { |
| 144 | - unset( self::$control_types[ $key ] ); |
|
| 144 | + unset( self::$control_types[$key] ); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | foreach ( $value as $key => $subvalue ) { |
| 160 | 160 | |
| 161 | 161 | if ( in_array( $key, array( 'font-size', 'letter-spacing', 'word-spacing', 'line-height' ), true ) ) { |
| 162 | - $value[ $key ] = Kirki_Sanitize_Values::css_dimension( $value[ $key ] ); |
|
| 162 | + $value[$key] = Kirki_Sanitize_Values::css_dimension( $value[$key] ); |
|
| 163 | 163 | } elseif ( 'text-align' === $key && ! in_array( $value['text-align'], array( 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) { |
| 164 | 164 | $value['text-align'] = 'inherit'; |
| 165 | 165 | } elseif ( 'text-transform' === $key && ! in_array( $value['text-transform'], array( 'none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit' ), true ) ) { |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | foreach ( $args['fields'] as $key => $value ) { |
| 113 | 113 | if ( ! isset( $value['default'] ) ) { |
| 114 | - $args['fields'][ $key ]['default'] = ''; |
|
| 114 | + $args['fields'][$key]['default'] = ''; |
|
| 115 | 115 | } |
| 116 | 116 | if ( ! isset( $value['label'] ) ) { |
| 117 | - $args['fields'][ $key ]['label'] = ''; |
|
| 117 | + $args['fields'][$key]['label'] = ''; |
|
| 118 | 118 | } |
| 119 | - $args['fields'][ $key ]['id'] = $key; |
|
| 119 | + $args['fields'][$key]['id'] = $key; |
|
| 120 | 120 | |
| 121 | 121 | // We check if the filed is an uploaded media ( image , file, video, etc.. ). |
| 122 | 122 | if ( isset( $value['type'] ) ) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | case 'cropped_image': |
| 126 | 126 | case 'upload': |
| 127 | 127 | // We add it to the list of fields that need some extra filtering/processing. |
| 128 | - $media_fields_to_filter[ $key ] = true; |
|
| 128 | + $media_fields_to_filter[$key] = true; |
|
| 129 | 129 | break; |
| 130 | 130 | |
| 131 | 131 | case 'dropdown-pages': |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | ) |
| 141 | 141 | ); |
| 142 | 142 | // Hackily add in the data link parameter. |
| 143 | - $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][ $key ]['id'] ) . '"' . $this->get_link(), $dropdown ); |
|
| 144 | - $args['fields'][ $key ]['dropdown'] = $dropdown; |
|
| 143 | + $dropdown = str_replace( '<select', '<select data-field="' . esc_attr( $args['fields'][$key]['id'] ) . '"' . $this->get_link(), $dropdown ); |
|
| 144 | + $args['fields'][$key]['dropdown'] = $dropdown; |
|
| 145 | 145 | break; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | // Validating row label field. |
| 558 | - if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][ esc_attr( $args['row_label']['field'] ) ] ) ) { |
|
| 558 | + if ( isset( $args['row_label']['field'] ) && ! empty( $args['row_label']['field'] ) && isset( $args['fields'][esc_attr( $args['row_label']['field'] )] ) ) { |
|
| 559 | 559 | $this->row_label['field'] = esc_attr( $args['row_label']['field'] ); |
| 560 | 560 | } else { |
| 561 | 561 | // If from field is not set correctly, making sure standard is set as the type. |
@@ -591,6 +591,6 @@ discard block |
||
| 591 | 591 | if ( false === $id ) { |
| 592 | 592 | return $translation_strings; |
| 593 | 593 | } |
| 594 | - return $translation_strings[ $id ]; |
|
| 594 | + return $translation_strings[$id]; |
|
| 595 | 595 | } |
| 596 | 596 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $property = $output['property'] . '-' . $key; |
| 36 | 36 | } |
| 37 | 37 | $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
| 38 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value; |
|
| 38 | + $this->styles[$output['media_query']][$output['element']][$property] = $sub_value; |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -38,14 +38,14 @@ |
||
| 38 | 38 | // Add backup font. |
| 39 | 39 | if ( Kirki_Fonts::is_google_font( $this->value ) ) { |
| 40 | 40 | |
| 41 | - if ( isset( $google_fonts_array[ $this->value ] ) && isset( $google_fonts_array[ $this->value ]['category'] ) ) { |
|
| 42 | - if ( isset( $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ] ) ) { |
|
| 41 | + if ( isset( $google_fonts_array[$this->value] ) && isset( $google_fonts_array[$this->value]['category'] ) ) { |
|
| 42 | + if ( isset( $backup_fonts[$google_fonts_array[$this->value]['category']] ) ) { |
|
| 43 | 43 | |
| 44 | 44 | // Add double quotes if needed. |
| 45 | 45 | if ( false !== strpos( $this->value, ' ' ) && false === strpos( $this->value, '"' ) ) { |
| 46 | - $this->value = '"' . $this->value . '", ' . $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ]; |
|
| 46 | + $this->value = '"' . $this->value . '", ' . $backup_fonts[$google_fonts_array[$this->value]['category']]; |
|
| 47 | 47 | } else { |
| 48 | - $this->value .= ', ' . $backup_fonts[ $google_fonts_array[ $this->value ]['category'] ]; |
|
| 48 | + $this->value .= ', ' . $backup_fonts[$google_fonts_array[$this->value]['category']]; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | // Sanitize each sub-value separately. |
| 54 | 54 | foreach ( $value as $key => $sub_value ) { |
| 55 | - $value[ $key ] = Kirki_Sanitize_Values::css_dimension( $sub_value ); |
|
| 55 | + $value[$key] = Kirki_Sanitize_Values::css_dimension( $sub_value ); |
|
| 56 | 56 | } |
| 57 | 57 | return $value; |
| 58 | 58 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $section_classname = 'WP_Customize_Section'; |
| 51 | 51 | |
| 52 | 52 | if ( isset( $args['type'] ) && array_key_exists( $args['type'], $this->section_types ) ) { |
| 53 | - $section_classname = $this->section_types[ $args['type'] ]; |
|
| 53 | + $section_classname = $this->section_types[$args['type']]; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Add the section. |