@@ -34,15 +34,15 @@ |
||
34 | 34 | ) ); |
35 | 35 | if ( is_array( $value ) ) { |
36 | 36 | if ( isset( $output['choice'] ) && $output['choice'] ) { |
37 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix']; |
|
37 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value[$output['choice']] ) . $output['units'] . $output['suffix']; |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | if ( isset( $value['url'] ) ) { |
41 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
41 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix']; |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | return; |
45 | 45 | } |
46 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
46 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
47 | 47 | } |
48 | 48 | } |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | } |
102 | 102 | if ( is_array( $value ) ) { |
103 | 103 | foreach ( array_keys( $value ) as $value_k ) { |
104 | - if ( ! is_string( $value[ $value_k ] ) ) { |
|
104 | + if ( ! is_string( $value[$value_k] ) ) { |
|
105 | 105 | continue; |
106 | 106 | } |
107 | 107 | if ( isset( $output['choice'] ) ) { |
108 | 108 | if ( $output['choice'] === $value_k ) { |
109 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
109 | + $value[$output['choice']] = str_replace( '$', $value[$output['choice']], $output['value_pattern'] ); |
|
110 | 110 | } |
111 | 111 | continue; |
112 | 112 | } |
113 | - $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] ); |
|
113 | + $value[$value_k] = str_replace( '$', $value[$value_k], $output['value_pattern'] ); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | $value = $this->apply_pattern_replace( $output, $value ); |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | if ( is_array( $options ) ) { |
141 | 141 | if ( $option_name ) { |
142 | 142 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
143 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
143 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
144 | 144 | break; |
145 | 145 | } |
146 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
146 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
147 | 147 | break; |
148 | 148 | } |
149 | 149 | $replacement = get_option( $replace ); |
150 | 150 | break; |
151 | 151 | case 'site_option': |
152 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
152 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
153 | 153 | break; |
154 | 154 | case 'user_meta': |
155 | 155 | $user_id = get_current_user_id(); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $replacement = ( false === $replacement ) ? '' : $replacement; |
165 | 165 | if ( is_array( $value ) ) { |
166 | 166 | foreach ( $value as $k => $v ) { |
167 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
167 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
168 | 168 | } |
169 | 169 | return $value; |
170 | 170 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | // If 'choice' is defined check for sub-values too. |
208 | 208 | // Fixes https://github.com/aristath/kirki/issues/1416. |
209 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
209 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
210 | 210 | $skip = true; |
211 | 211 | } |
212 | 212 | } |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | 'background', |
265 | 265 | ); |
266 | 266 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
267 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
268 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
267 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
268 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
269 | 269 | } |
270 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
270 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
271 | 271 | return; |
272 | 272 | } |
273 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
273 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
291 | 291 | ) ); |
292 | 292 | if ( array_key_exists( $property, $properties ) ) { |
293 | - $classname = $properties[ $property ]; |
|
293 | + $classname = $properties[$property]; |
|
294 | 294 | $obj = new $classname( $property, $value ); |
295 | 295 | return $obj->get_value(); |
296 | 296 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | if ( false !== strpos( $output['property'], '%%' ) ) { |
45 | 45 | $property = str_replace( '%%', $key, $output['property'] ); |
46 | 46 | } |
47 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix']; |
|
47 | + $this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $this->process_property_value( $property, $value[$key] ) . $output['suffix']; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -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 | } |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
150 | - if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ) ) && ! isset( $this->json['default'][ $key ] ) ) { |
|
151 | - unset( $this->json['value'][ $key ] ); |
|
150 | + if ( ! in_array( $key, array( 'variant', 'font-weight', 'font-style' ) ) && ! isset( $this->json['default'][$key] ) ) { |
|
151 | + unset( $this->json['value'][$key] ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | // Fix for https://github.com/aristath/kirki/issues/1405. |
156 | 156 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
157 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
158 | - unset( $this->json['value'][ $key ] ); |
|
157 | + if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) { |
|
158 | + unset( $this->json['value'][$key] ); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | if ( is_string( $variant ) ) { |
339 | 339 | $final_variants[] = array( |
340 | 340 | 'id' => $variant, |
341 | - 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
|
341 | + 'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant, |
|
342 | 342 | ); |
343 | 343 | } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
344 | 344 | $final_variants[] = $variant; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if ( array_key_exists( $variant, $all_variants ) ) { |
420 | 420 | $available_variants[] = array( |
421 | 421 | 'id' => $variant, |
422 | - 'label' => $all_variants[ $variant ], |
|
422 | + 'label' => $all_variants[$variant], |
|
423 | 423 | ); |
424 | 424 | } |
425 | 425 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | if ( array_key_exists( $subset, $all_subsets ) ) { |
432 | 432 | $available_subsets[] = array( |
433 | 433 | 'id' => $subset, |
434 | - 'label' => $all_subsets[ $subset ], |
|
434 | + 'label' => $all_subsets[$subset], |
|
435 | 435 | ); |
436 | 436 | } |
437 | 437 | } |
@@ -336,7 +336,8 @@ discard block |
||
336 | 336 | </div> |
337 | 337 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
338 | 338 | <input class="typography-hidden-value" type="hidden" {{{ data.link }}}> |
339 | - <?php else : ?> |
|
339 | + <?php else { |
|
340 | + : ?> |
|
340 | 341 | <# |
341 | 342 | if ( ! _.isUndefined( data.value['font-family'] ) ) { |
342 | 343 | data.value['font-family'] = data.value['font-family'].replace( /"/g, ''' ); |
@@ -344,7 +345,9 @@ discard block |
||
344 | 345 | valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); |
345 | 346 | #> |
346 | 347 | <input class="typography-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
347 | - <?php endif; ?> |
|
348 | + <?php endif; |
|
349 | +} |
|
350 | +?> |
|
348 | 351 | <?php |
349 | 352 | } |
350 | 353 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
48 | 48 | |
49 | 49 | // Create the styles. |
50 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $sub_value . $output['suffix']; |
|
50 | + $this->styles[$output['media_query']][$output['element']][$property] = $sub_value . $output['suffix']; |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | } |
@@ -180,9 +180,12 @@ |
||
180 | 180 | <div class="iris-target"></div> |
181 | 181 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
182 | 182 | <input class="multicolor-hidden-value" type="hidden" {{{ data.link }}}> |
183 | - <?php else : ?> |
|
183 | + <?php else { |
|
184 | + : ?> |
|
184 | 185 | <input class="multicolor-hidden-value" type="hidden" value='{{{ JSON.stringify( data.value ) }}}' {{{ data.link }}}> |
185 | - <?php endif; ?> |
|
186 | + <?php endif; |
|
187 | +} |
|
188 | +?> |
|
186 | 189 | <?php |
187 | 190 | } |
188 | 191 |
@@ -200,10 +200,13 @@ |
||
200 | 200 | </div> |
201 | 201 | <?php if ( Kirki_Util::get_wp_version() >= 4.9 ) : ?> |
202 | 202 | <input class="background-hidden-value" type="hidden" {{{ data.link }}}> |
203 | - <?php else : ?> |
|
203 | + <?php else { |
|
204 | + : ?> |
|
204 | 205 | <# valueJSON = JSON.stringify( data.value ).replace( /'/g, ''' ); #> |
205 | 206 | <input class="background-hidden-value" type="hidden" value='{{{ valueJSON }}}' {{{ data.link }}}> |
206 | - <?php endif; ?> |
|
207 | + <?php endif; |
|
208 | +} |
|
209 | +?> |
|
207 | 210 | <?php |
208 | 211 | } |
209 | 212 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | * Returns an array of paths where translation files may be located. |
94 | 94 | * |
95 | 95 | * @access protected |
96 | - * @return array |
|
96 | + * @return string[] |
|
97 | 97 | */ |
98 | 98 | protected function get_paths() { |
99 | 99 |
@@ -115,8 +115,8 @@ |
||
115 | 115 | function override_load_textdomain( $override, $domain, $mofile ) { |
116 | 116 | |
117 | 117 | global $l10n; |
118 | - if ( isset( $l10n[ $this->get_theme_textdomain() ] ) ) { |
|
119 | - $l10n['kirki'] = $l10n[ $this->get_theme_textdomain() ]; |
|
118 | + if ( isset( $l10n[$this->get_theme_textdomain()] ) ) { |
|
119 | + $l10n['kirki'] = $l10n[$this->get_theme_textdomain()]; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // Check if the domain is "kirki". |