|
@@ -257,13 +257,13 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
|
|
@@ -407,7 +407,7 @@ discard block |
|
|
block discarded – undo |
|
407
|
407
|
if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
|
408
|
408
|
/* translators: %1$s represents the field ID where the error occurs. */ |
|
409
|
409
|
_doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
|
410
|
|
- unset( $this->partial_refresh[ $id ] ); |
|
|
410
|
+ unset( $this->partial_refresh[$id] ); |
|
411
|
411
|
continue; |
|
412
|
412
|
} |
|
413
|
413
|
} |
|
@@ -435,10 +435,10 @@ discard block |
|
|
block discarded – undo |
|
435
|
435
|
} |
|
436
|
436
|
$settings = array(); |
|
437
|
437
|
foreach ( $this->settings as $setting_key => $setting_value ) { |
|
438
|
|
- $settings[ $setting_key ] = $setting_value; |
|
|
438
|
+ $settings[$setting_key] = $setting_value; |
|
439
|
439
|
// If we're using serialized options then we need to spice this up. |
|
440
|
440
|
if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
|
441
|
|
- $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
|
441
|
+ $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
442
|
442
|
} |
|
443
|
443
|
} |
|
444
|
444
|
$this->settings = $settings; |
|
@@ -550,27 +550,27 @@ discard block |
|
|
block discarded – undo |
|
550
|
550
|
} |
|
551
|
551
|
foreach ( $this->output as $key => $output ) { |
|
552
|
552
|
if ( empty( $output ) || ! isset( $output['element'] ) ) { |
|
553
|
|
- unset( $this->output[ $key ] ); |
|
|
553
|
+ unset( $this->output[$key] ); |
|
554
|
554
|
continue; |
|
555
|
555
|
} |
|
556
|
556
|
if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
|
557
|
|
- $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
|
557
|
+ $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
558
|
558
|
} |
|
559
|
559
|
// Convert element arrays to strings. |
|
560
|
560
|
if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
|
561
|
|
- $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
562
|
|
- sort( $this->output[ $key ]['element'] ); |
|
|
561
|
+ $this->output[$key]['element'] = array_unique( $this->output[$key]['element'] ); |
|
|
562
|
+ sort( $this->output[$key]['element'] ); |
|
563
|
563
|
|
|
564
|
564
|
// Trim each element in the array. |
|
565
|
|
- foreach ( $this->output[ $key ]['element'] as $index => $element ) { |
|
566
|
|
- $this->output[ $key ]['element'][ $index ] = trim( $element ); |
|
|
565
|
+ foreach ( $this->output[$key]['element'] as $index => $element ) { |
|
|
566
|
+ $this->output[$key]['element'][$index] = trim( $element ); |
|
567
|
567
|
} |
|
568
|
|
- $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
|
568
|
+ $this->output[$key]['element'] = implode( ',', $this->output[$key]['element'] ); |
|
569
|
569
|
} |
|
570
|
570
|
|
|
571
|
571
|
// Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751. |
|
572
|
|
- $this->output[ $key ]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[ $key ]['element'] ); |
|
573
|
|
- $this->output[ $key ]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[ $key ]['element'] ) ); |
|
|
572
|
+ $this->output[$key]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[$key]['element'] ); |
|
|
573
|
+ $this->output[$key]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[$key]['element'] ) ); |
|
574
|
574
|
} |
|
575
|
575
|
} |
|
576
|
576
|
|