@@ -179,7 +179,7 @@ |
||
179 | 179 | case 'letter-spacing': |
180 | 180 | case 'word-spacing': |
181 | 181 | case 'line-height': |
182 | - $value[ $key ] = Kirki_Sanitize_Values::css_dimension( $val ); |
|
182 | + $value[$key] = Kirki_Sanitize_Values::css_dimension( $val ); |
|
183 | 183 | break; |
184 | 184 | case 'text-align': |
185 | 185 | if ( ! in_array( $val, array( 'inherit', 'left', 'center', 'right', 'justify' ), true ) ) { |
@@ -38,14 +38,14 @@ |
||
38 | 38 | |
39 | 39 | $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
40 | 40 | |
41 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = $value['start']['color']; |
|
41 | + $this->styles[$output['media_query']][$output['element']]['background'] = $value['start']['color']; |
|
42 | 42 | switch ( $value['mode'] ) { |
43 | 43 | |
44 | 44 | case 'linear': |
45 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = 'linear-gradient(' . intval( $value['angle'] ) . 'deg, ' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
45 | + $this->styles[$output['media_query']][$output['element']]['background'] = 'linear-gradient(' . intval( $value['angle'] ) . 'deg, ' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
46 | 46 | break; |
47 | 47 | case 'radial': |
48 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background'] = 'radial-gradient(ellipse at center,' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
48 | + $this->styles[$output['media_query']][$output['element']]['background'] = 'radial-gradient(ellipse at center,' . $value['start']['color'] . ' ' . $value['start']['position'] . '%,' . $value['end']['color'] . ' ' . $value['end']['position'] . '%)'; |
|
49 | 49 | break; |
50 | 50 | } |
51 | 51 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->control_types = $this->default_control_types( apply_filters( 'kirki/control_types', $this->control_types ) ); |
168 | 168 | foreach ( $this->control_types as $key => $classname ) { |
169 | 169 | if ( ! class_exists( $classname ) ) { |
170 | - unset( $control_types[ $key ] ); |
|
170 | + unset( $control_types[$key] ); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | foreach ( Kirki::$panels as $panel_args ) { |
194 | 194 | // Extra checks for nested panels. |
195 | 195 | if ( isset( $panel_args['panel'] ) ) { |
196 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
196 | + if ( isset( Kirki::$panels[$panel_args['panel']] ) ) { |
|
197 | 197 | // Set the type to nested. |
198 | 198 | $panel_args['type'] = 'kirki-nested'; |
199 | 199 | } |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | foreach ( Kirki::$sections as $section_args ) { |
216 | 216 | // Extra checks for nested sections. |
217 | 217 | if ( isset( $section_args['section'] ) ) { |
218 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
218 | + if ( isset( Kirki::$sections[$section_args['section']] ) ) { |
|
219 | 219 | // Set the type to nested. |
220 | 220 | $section_args['type'] = 'kirki-nested'; |
221 | 221 | // We need to check if the parent section is nested inside a panel. |
222 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
222 | + $parent_section = Kirki::$sections[$section_args['section']]; |
|
223 | 223 | if ( isset( $parent_section['panel'] ) ) { |
224 | 224 | $section_args['panel'] = $parent_section['panel']; |
225 | 225 | } |
@@ -67,9 +67,9 @@ |
||
67 | 67 | |
68 | 68 | // Make sure that every row is an array, not an object. |
69 | 69 | foreach ( $sanitized as $key => $_value ) { |
70 | - $sanitized[ $key ] = (array) $_value; |
|
70 | + $sanitized[$key] = (array) $_value; |
|
71 | 71 | if ( empty( $_value ) ) { |
72 | - unset( $sanitized[ $key ] ); |
|
72 | + unset( $sanitized[$key] ); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 |
@@ -130,8 +130,8 @@ |
||
130 | 130 | // Are we force-loading all subsets? |
131 | 131 | if ( true === Kirki_Fonts_Google::$force_load_all_subsets ) { |
132 | 132 | |
133 | - if ( isset( $this->googlefonts[ $font ]['subsets'] ) ) { |
|
134 | - foreach ( $this->googlefonts[ $font ]['subsets'] as $subset ) { |
|
133 | + if ( isset( $this->googlefonts[$font]['subsets'] ) ) { |
|
134 | + foreach ( $this->googlefonts[$font]['subsets'] as $subset ) { |
|
135 | 135 | $this->subsets[] = $subset; |
136 | 136 | } |
137 | 137 | } |
@@ -101,19 +101,19 @@ discard block |
||
101 | 101 | $value = str_replace( '$', $value, $output['value_pattern'] ); |
102 | 102 | } |
103 | 103 | if ( is_array( $value ) ) { |
104 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) ) { |
|
105 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
104 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) ) { |
|
105 | + $value[$output['choice']] = str_replace( '$', $value[$output['choice']], $output['value_pattern'] ); |
|
106 | 106 | } else { |
107 | 107 | foreach ( $value as $k => $v ) { |
108 | - $value[ $k ] = str_replace( '$', $value[ $k ], $output['value_pattern'] ); |
|
108 | + $value[$k] = str_replace( '$', $value[$k], $output['value_pattern'] ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | 112 | if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) { |
113 | 113 | $option_type = 'theme_mod'; |
114 | 114 | $option_name = false; |
115 | - if ( isset( Kirki::$config[ $this->config_id ] ) ) { |
|
116 | - $config = Kirki::$config[ $this->config_id ]; |
|
115 | + if ( isset( Kirki::$config[$this->config_id] ) ) { |
|
116 | + $config = Kirki::$config[$this->config_id]; |
|
117 | 117 | $option_type = ( isset( $config['option_type'] ) ) ? $config['option_type'] : 'theme_mod'; |
118 | 118 | if ( 'option' === $option_type || 'site_option' === $option_type ) { |
119 | 119 | $option_name = ( isset( $config['option_name'] ) ) ? $config['option_name'] : false; |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | if ( is_array( $options ) ) { |
131 | 131 | if ( $option_name ) { |
132 | 132 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
133 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
133 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
134 | 134 | break; |
135 | 135 | } |
136 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
136 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
137 | 137 | break; |
138 | 138 | } |
139 | 139 | $replacement = get_option( $replace ); |
140 | 140 | break; |
141 | 141 | case 'site_option': |
142 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
142 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
143 | 143 | break; |
144 | 144 | case 'user_meta': |
145 | 145 | $user_id = get_current_user_id(); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $replacement = ( false === $replacement ) ? '' : $replacement; |
155 | 155 | if ( is_array( $value ) ) { |
156 | 156 | foreach ( $value as $k => $v ) { |
157 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
157 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
158 | 158 | } |
159 | 159 | return $value; |
160 | 160 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | // If 'choice' is defined check for sub-values too. |
201 | 201 | // Fixes https://github.com/aristath/kirki/issues/1416. |
202 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
202 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
203 | 203 | $skip = true; |
204 | 204 | } |
205 | 205 | } |
@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | 'background', |
258 | 258 | ); |
259 | 259 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
260 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
261 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
260 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
261 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
262 | 262 | } |
263 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
263 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
264 | 264 | return; |
265 | 265 | } |
266 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
266 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
284 | 284 | ) ); |
285 | 285 | if ( array_key_exists( $property, $properties ) ) { |
286 | - $classname = $properties[ $property ]; |
|
286 | + $classname = $properties[$property]; |
|
287 | 287 | $obj = new $classname( $property, $value ); |
288 | 288 | return $obj->get_value(); |
289 | 289 | } |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | |
336 | 336 | // Get the config arguments, and merge them with the defaults. |
337 | 337 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
338 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
339 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
338 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
339 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
340 | 340 | } |
341 | 341 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
342 | 342 | foreach ( $config_defaults as $key => $value ) { |
343 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value != $defaults[ $key ] ) { |
|
344 | - $defaults[ $key ] = $value; |
|
343 | + if ( isset( $defaults[$key] ) && ! empty( $value ) && $value != $defaults[$key] ) { |
|
344 | + $defaults[$key] = $value; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | // Get all arguments with their values. |
390 | 390 | $args = get_object_vars( $this ); |
391 | 391 | foreach ( $args as $key => $default_value ) { |
392 | - $args[ $key ] = $this->$key; |
|
392 | + $args[$key] = $this->$key; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | // Add the field to the static $fields variable properly indexed. |
396 | - Kirki::$fields[ $this->settings ] = $args; |
|
396 | + Kirki::$fields[$this->settings] = $args; |
|
397 | 397 | |
398 | 398 | } |
399 | 399 | |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | if ( false !== strpos( $property, '_' ) ) { |
414 | 414 | $property_parts = explode( '_', $property ); |
415 | 415 | } |
416 | - foreach( $property_parts as $property_part_k => $property_part_v ) { |
|
417 | - $property_parts[ $property_part_k ] = ucfirst( $property_part_v ); |
|
416 | + foreach ( $property_parts as $property_part_k => $property_part_v ) { |
|
417 | + $property_parts[$property_part_k] = ucfirst( $property_part_v ); |
|
418 | 418 | } |
419 | 419 | return 'Kirki_Field_Property_' . implode( '_', $property_parts ); |
420 | 420 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
560 | 560 | /* translators: %1$s represents the field ID where the error occurs. */ |
561 | 561 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
562 | - unset( $this->partial_refresh[ $id ] ); |
|
562 | + unset( $this->partial_refresh[$id] ); |
|
563 | 563 | continue; |
564 | 564 | } |
565 | 565 | } |
@@ -587,10 +587,10 @@ discard block |
||
587 | 587 | } |
588 | 588 | $settings = array(); |
589 | 589 | foreach ( $this->settings as $setting_key => $setting_value ) { |
590 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $setting_value ); |
|
590 | + $settings[sanitize_key( $setting_key )] = esc_attr( $setting_value ); |
|
591 | 591 | // If we're using serialized options then we need to spice this up. |
592 | 592 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
593 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
593 | + $settings[sanitize_key( $setting_key )] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | $this->settings = $settings; |