@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // Take care of font-families. |
33 | 33 | if ( isset( $value['font-family'] ) && ! empty( $value['font-family'] ) ) { |
34 | 34 | $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
35 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-family'] = $output['prefix'] . $this->process_property_value( 'font-family', $value['font-family'] ) . $output['suffix']; |
|
35 | + $this->styles[$output['media_query']][$output['element']]['font-family'] = $output['prefix'] . $this->process_property_value( 'font-family', $value['font-family'] ) . $output['suffix']; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Add support for the older font-weight parameter. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // Once a user visits their customizer and make changes to their typography, |
41 | 41 | // new values are saved and this one is no longer used. |
42 | 42 | if ( isset( $value['font-weight'] ) && ! empty( $value['font-weight'] ) ) { |
43 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $output['prefix'] . $value['font-weight'] . $output['suffix']; |
|
43 | + $this->styles[$output['media_query']][$output['element']]['font-weight'] = $output['prefix'] . $value['font-weight'] . $output['suffix']; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Take care of variants. |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | |
53 | 53 | // Is this italic? |
54 | 54 | $is_italic = ( false !== strpos( $value['variant'], 'italic' ) ); |
55 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-weight'] = $output['prefix'] . $font_weight . $output['suffix']; |
|
56 | - $font_style = $is_italic ? 'italic' : 'normal' ; |
|
57 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-style'] = $output['prefix'] . $font_style . $output['suffix']; |
|
55 | + $this->styles[$output['media_query']][$output['element']]['font-weight'] = $output['prefix'] . $font_weight . $output['suffix']; |
|
56 | + $font_style = $is_italic ? 'italic' : 'normal'; |
|
57 | + $this->styles[$output['media_query']][$output['element']]['font-style'] = $output['prefix'] . $font_style . $output['suffix']; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // Take care of font-size. |
61 | 61 | if ( isset( $value['font-size'] ) && ! empty( $value['font-size'] ) ) { |
62 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['font-size'] = $output['prefix'] . $value['font-size'] . $output['suffix']; |
|
62 | + $this->styles[$output['media_query']][$output['element']]['font-size'] = $output['prefix'] . $value['font-size'] . $output['suffix']; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Take care of line-height. |
66 | 66 | if ( isset( $value['line-height'] ) && ! empty( $value['line-height'] ) ) { |
67 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['line-height'] = $output['prefix'] . $value['line-height'] . $output['suffix']; |
|
67 | + $this->styles[$output['media_query']][$output['element']]['line-height'] = $output['prefix'] . $value['line-height'] . $output['suffix']; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Take care of letter-spacing. |
71 | 71 | if ( isset( $value['letter-spacing'] ) && ( ! empty( $value['letter-spacing'] ) || '0' == $value['letter-spacing'] ) ) { |
72 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['letter-spacing'] = $output['prefix'] . $value['letter-spacing'] . $output['suffix']; |
|
72 | + $this->styles[$output['media_query']][$output['element']]['letter-spacing'] = $output['prefix'] . $value['letter-spacing'] . $output['suffix']; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Take care of word-spacing. |
76 | 76 | if ( isset( $value['word-spacing'] ) && ( ! empty( $value['word-spacing'] ) || '0' == $value['word-spacing'] ) ) { |
77 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['word-spacing'] = $output['prefix'] . $value['word-spacing'] . $output['suffix']; |
|
77 | + $this->styles[$output['media_query']][$output['element']]['word-spacing'] = $output['prefix'] . $value['word-spacing'] . $output['suffix']; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Take care of text-align. |
81 | 81 | if ( isset( $value['text-align'] ) && ! empty( $value['text-align'] ) ) { |
82 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['text-align'] = $output['prefix'] . $value['text-align'] . $output['suffix']; |
|
82 | + $this->styles[$output['media_query']][$output['element']]['text-align'] = $output['prefix'] . $value['text-align'] . $output['suffix']; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // Take care of text-transform. |
86 | 86 | if ( isset( $value['text-transform'] ) && ! empty( $value['text-transform'] ) ) { |
87 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['text-transform'] = $output['prefix'] . $value['text-transform'] . $output['suffix']; |
|
87 | + $this->styles[$output['media_query']][$output['element']]['text-transform'] = $output['prefix'] . $value['text-transform'] . $output['suffix']; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | // Take care of color. |
91 | 91 | if ( isset( $value['color'] ) && ! empty( $value['color'] ) ) { |
92 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['color'] = $output['prefix'] . $value['color'] . $output['suffix']; |
|
92 | + $this->styles[$output['media_query']][$output['element']]['color'] = $output['prefix'] . $value['color'] . $output['suffix']; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | } |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | return; |
134 | 134 | } |
135 | 135 | $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
136 | - $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
137 | - $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; |
|
138 | - $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
136 | + $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
137 | + $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; |
|
138 | + $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
139 | 139 | |
140 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
140 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
158 | 158 | ) ); |
159 | 159 | if ( array_key_exists( $property, $properties ) ) { |
160 | - $classname = $properties[ $property ]; |
|
160 | + $classname = $properties[$property]; |
|
161 | 161 | $obj = new $classname( $property, $value ); |
162 | 162 | return $obj->get_value(); |
163 | 163 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | if ( $process_field && isset( $field['required'] ) && ! empty( $field['required'] ) ) { |
51 | - $field_dependencies[ $field['id'] ] = $field['required']; |
|
51 | + $field_dependencies[$field['id']] = $field['required']; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | wp_localize_script( 'kirki_field_dependencies', 'fieldDependencies', $field_dependencies ); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $key = esc_attr( $key ); |
52 | 52 | $setting = $key; |
53 | 53 | $tooltip = $field['tooltip']; |
54 | - $description = isset( $l10n[ 'background-' . $key ] ) ? $l10n[ 'background-' . $key ] : ''; |
|
54 | + $description = isset( $l10n['background-' . $key] ) ? $l10n['background-' . $key] : ''; |
|
55 | 55 | $output_property = 'background-' . $key; |
56 | 56 | $label = ( 0 === $i ) ? $field['label'] : ''; |
57 | 57 | $type = 'select'; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * Build the field. |
106 | 106 | * We're merging with the original field here, so any extra properties are inherited. |
107 | 107 | */ |
108 | - $fields[ $property_setting ] = array_merge( $field, array( |
|
108 | + $fields[$property_setting] = array_merge( $field, array( |
|
109 | 109 | 'type' => $type, |
110 | 110 | 'label' => $label, |
111 | 111 | 'settings' => $property_setting, |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'description' => $description, |
117 | 117 | 'default' => $value, |
118 | 118 | 'id' => sanitize_key( str_replace( '[', '-', str_replace( ']', '', $property_setting ) ) ), |
119 | - 'choices' => isset( $choices[ $key ] ) ? $choices[ $key ] : array(), |
|
119 | + 'choices' => isset( $choices[$key] ) ? $choices[$key] : array(), |
|
120 | 120 | 'sanitize_callback' => $sanitize_callback, |
121 | 121 | 'output' => ( ! empty( $field['output'] ) ) ? array( |
122 | 122 | array( |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | if ( is_array( $this->choices ) ) { |
94 | 94 | foreach ( $this->choices as $choice => $value ) { |
95 | 95 | if ( 'labels' !== $choice && true === $value ) { |
96 | - $this->json['choices'][ $choice ] = true; |
|
96 | + $this->json['choices'][$choice] = true; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
100 | 100 | if ( is_array( $this->json['default'] ) ) { |
101 | 101 | foreach ( $this->json['default'] as $key => $value ) { |
102 | - if ( isset( $this->json['choices'][ $key ] ) && ! isset( $this->json['value'][ $key ] ) ) { |
|
103 | - $this->json['value'][ $key ] = $value; |
|
102 | + if ( isset( $this->json['choices'][$key] ) && ! isset( $this->json['value'][$key] ) ) { |
|
103 | + $this->json['value'][$key] = $value; |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
@@ -208,6 +208,6 @@ discard block |
||
208 | 208 | if ( false === $id ) { |
209 | 209 | return $translation_strings; |
210 | 210 | } |
211 | - return $translation_strings[ $id ]; |
|
211 | + return $translation_strings[$id]; |
|
212 | 212 | } |
213 | 213 | } |
@@ -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 ) ) { |