@@ -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 |
@@ -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( $this->control_types[ $key ] ); |
|
170 | + unset( $this->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 | } |
@@ -101,12 +101,12 @@ 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 ( array_keys( $value ) as $value_k ) { |
108 | - if ( is_string( $value[ $value_k ] ) ) { |
|
109 | - $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] ); |
|
108 | + if ( is_string( $value[$value_k] ) ) { |
|
109 | + $value[$value_k] = str_replace( '$', $value[$value_k], $output['value_pattern'] ); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) { |
115 | 115 | $option_type = 'theme_mod'; |
116 | 116 | $option_name = false; |
117 | - if ( isset( Kirki::$config[ $this->config_id ] ) ) { |
|
118 | - $config = Kirki::$config[ $this->config_id ]; |
|
117 | + if ( isset( Kirki::$config[$this->config_id] ) ) { |
|
118 | + $config = Kirki::$config[$this->config_id]; |
|
119 | 119 | $option_type = ( isset( $config['option_type'] ) ) ? $config['option_type'] : 'theme_mod'; |
120 | 120 | if ( 'option' === $option_type || 'site_option' === $option_type ) { |
121 | 121 | $option_name = ( isset( $config['option_name'] ) ) ? $config['option_name'] : false; |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | if ( is_array( $options ) ) { |
133 | 133 | if ( $option_name ) { |
134 | 134 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
135 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
135 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
136 | 136 | break; |
137 | 137 | } |
138 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
138 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
139 | 139 | break; |
140 | 140 | } |
141 | 141 | $replacement = get_option( $replace ); |
142 | 142 | break; |
143 | 143 | case 'site_option': |
144 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
144 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
145 | 145 | break; |
146 | 146 | case 'user_meta': |
147 | 147 | $user_id = get_current_user_id(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $replacement = ( false === $replacement ) ? '' : $replacement; |
157 | 157 | if ( is_array( $value ) ) { |
158 | 158 | foreach ( $value as $k => $v ) { |
159 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
159 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
160 | 160 | } |
161 | 161 | return $value; |
162 | 162 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | // If 'choice' is defined check for sub-values too. |
203 | 203 | // Fixes https://github.com/aristath/kirki/issues/1416. |
204 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
204 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
205 | 205 | $skip = true; |
206 | 206 | } |
207 | 207 | } |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | 'background', |
260 | 260 | ); |
261 | 261 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
262 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
263 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
262 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
263 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
264 | 264 | } |
265 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
265 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
266 | 266 | return; |
267 | 267 | } |
268 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
268 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
286 | 286 | ) ); |
287 | 287 | if ( array_key_exists( $property, $properties ) ) { |
288 | - $classname = $properties[ $property ]; |
|
288 | + $classname = $properties[$property]; |
|
289 | 289 | $obj = new $classname( $property, $value ); |
290 | 290 | return $obj->get_value(); |
291 | 291 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Check if we've got it cached and ready. |
67 | - if ( isset( $this->cached_paths[ $class_name ] ) && file_exists( $this->cached_paths[ $class_name ] ) ) { |
|
68 | - include_once $this->cached_paths[ $class_name ]; |
|
67 | + if ( isset( $this->cached_paths[$class_name] ) && file_exists( $this->cached_paths[$class_name] ) ) { |
|
68 | + include_once $this->cached_paths[$class_name]; |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | foreach ( $paths as $path ) { |
75 | 75 | $path = wp_normalize_path( $path ); |
76 | 76 | if ( file_exists( $path ) ) { |
77 | - $this->cached_paths[ $class_name ] = $path; |
|
77 | + $this->cached_paths[$class_name] = $path; |
|
78 | 78 | include_once $path; |
79 | 79 | return; |
80 | 80 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | |
135 | 135 | $previous_path = ''; |
136 | 136 | for ( $i = 0; $i < $levels; $i++ ) { |
137 | - $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
138 | - $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
|
137 | + $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[$i] ) . '/' . $filename; |
|
138 | + $previous_path .= strtolower( $exploded[$i] ) . '/'; |
|
139 | 139 | } |
140 | 140 | return $paths; |
141 | 141 | } |
@@ -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->fonts[ $font ]['subsets'] ) ) { |
|
134 | - foreach ( $this->googlefonts->fonts[ $font ]['subsets'] as $subset ) { |
|
133 | + if ( isset( $this->googlefonts->fonts[$font]['subsets'] ) ) { |
|
134 | + foreach ( $this->googlefonts->fonts[$font]['subsets'] as $subset ) { |
|
135 | 135 | $this->subsets[] = $subset; |
136 | 136 | } |
137 | 137 | } |
@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | |
258 | 258 | // Get the config arguments, and merge them with the defaults. |
259 | 259 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
260 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
261 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
260 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
261 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
262 | 262 | } |
263 | 263 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
264 | 264 | foreach ( $config_defaults as $key => $value ) { |
265 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) { |
|
266 | - $defaults[ $key ] = $value; |
|
265 | + if ( isset( $defaults[$key] ) && ! empty( $value ) && $value !== $defaults[$key] ) { |
|
266 | + $defaults[$key] = $value; |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | // Get all arguments with their values. |
309 | 309 | $args = get_object_vars( $this ); |
310 | 310 | foreach ( array_keys( $args ) as $key ) { |
311 | - $args[ $key ] = $this->$key; |
|
311 | + $args[$key] = $this->$key; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | // Add the field to the static $fields variable properly indexed. |
315 | - Kirki::$fields[ $this->settings ] = $args; |
|
315 | + Kirki::$fields[$this->settings] = $args; |
|
316 | 316 | |
317 | 317 | } |
318 | 318 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $property_parts = explode( '_', $property ); |
334 | 334 | } |
335 | 335 | foreach ( $property_parts as $property_part_k => $property_part_v ) { |
336 | - $property_parts[ $property_part_k ] = ucfirst( $property_part_v ); |
|
336 | + $property_parts[$property_part_k] = ucfirst( $property_part_v ); |
|
337 | 337 | } |
338 | 338 | return 'Kirki_Field_Property_' . implode( '_', $property_parts ); |
339 | 339 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
430 | 430 | /* translators: %1$s represents the field ID where the error occurs. */ |
431 | 431 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
432 | - unset( $this->partial_refresh[ $id ] ); |
|
432 | + unset( $this->partial_refresh[$id] ); |
|
433 | 433 | continue; |
434 | 434 | } |
435 | 435 | } |
@@ -457,10 +457,10 @@ discard block |
||
457 | 457 | } |
458 | 458 | $settings = array(); |
459 | 459 | foreach ( $this->settings as $setting_key => $setting_value ) { |
460 | - $settings[ $setting_key ] = $setting_value; |
|
460 | + $settings[$setting_key] = $setting_value; |
|
461 | 461 | // If we're using serialized options then we need to spice this up. |
462 | 462 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
463 | - $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
463 | + $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | $this->settings = $settings; |
@@ -585,17 +585,17 @@ discard block |
||
585 | 585 | } |
586 | 586 | foreach ( $this->output as $key => $output ) { |
587 | 587 | if ( empty( $output ) || ! isset( $output['element'] ) ) { |
588 | - unset( $this->output[ $key ] ); |
|
588 | + unset( $this->output[$key] ); |
|
589 | 589 | continue; |
590 | 590 | } |
591 | 591 | if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
592 | - $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
592 | + $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
593 | 593 | } |
594 | 594 | // Convert element arrays to strings. |
595 | 595 | if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
596 | - $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
597 | - sort( $this->output[ $key ]['element'] ); |
|
598 | - $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
596 | + $this->output[$key]['element'] = array_unique( $this->output[$key]['element'] ); |
|
597 | + sort( $this->output[$key]['element'] ); |
|
598 | + $this->output[$key]['element'] = implode( ',', $this->output[$key]['element'] ); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | } |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | $js_var['index_key'] = $key; |
143 | 143 | $callback = $this->get_callback( $args ); |
144 | 144 | if ( is_callable( $callback ) ) { |
145 | - $field['scripts'][ $key ] = call_user_func_array( $callback, array( $js_var, $args ) ); |
|
145 | + $field['scripts'][$key] = call_user_func_array( $callback, array( $js_var, $args ) ); |
|
146 | 146 | continue; |
147 | 147 | } |
148 | - $field['scripts'][ $key ] = $this->script_var( $js_var ); |
|
148 | + $field['scripts'][$key] = $this->script_var( $js_var ); |
|
149 | 149 | } |
150 | 150 | $combo_extra_script = ''; |
151 | 151 | $combo_css_script = ''; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function script_html_var( $args ) { |
179 | 179 | |
180 | - $script = ( isset( $args['choice'] ) ) ? "newval=newval['{$args['choice']}'];" : ''; |
|
180 | + $script = ( isset( $args['choice'] ) ) ? "newval=newval['{$args['choice']}'];" : ''; |
|
181 | 181 | |
182 | 182 | // Apply the value_pattern. |
183 | 183 | if ( isset( $args['value_pattern'] ) && '' !== $args['value_pattern'] ) { |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $property_script = ''; |
252 | 252 | |
253 | 253 | // Define choice. |
254 | - $choice = ( isset( $args['choice'] ) && '' !== $args['choice'] ) ? $args['choice'] : ''; |
|
254 | + $choice = ( isset( $args['choice'] ) && '' !== $args['choice'] ) ? $args['choice'] : ''; |
|
255 | 255 | |
256 | 256 | $value_key = 'newval' . $args['index_key']; |
257 | 257 | $property_script .= $value_key . '=newval;'; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | 'font-weight' => 'fontWeight', |
343 | 343 | 'font-style' => 'fontStyle', |
344 | 344 | ); |
345 | - $choice_condition = ( isset( $args['choice'] ) && '' !== $args['choice'] && isset( $css_build_array[ $args['choice'] ] ) ); |
|
345 | + $choice_condition = ( isset( $args['choice'] ) && '' !== $args['choice'] && isset( $css_build_array[$args['choice']] ) ); |
|
346 | 346 | $script .= ( ! $choice_condition ) ? $webfont_loader : ''; |
347 | 347 | foreach ( $css_build_array as $property => $var ) { |
348 | 348 | if ( $choice_condition && $property !== $args['choice'] ) { |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | 'units' => '', |
454 | 454 | 'js_callback' => array( '', '' ), |
455 | 455 | 'value_pattern' => '', |
456 | - )); |
|
456 | + ) ); |
|
457 | 457 | |
458 | 458 | // Element should be a string. |
459 | 459 | if ( is_array( $args['element'] ) ) { |