Passed
Push — develop ( 3892e2...b1663d )
by Aristeides
03:47
created

css/field/class-kirki-output-field-image.php (2 issues)

1
<?php
2
/**
3
 * Handles CSS output for image fields.
4
 *
5
 * @package     Kirki
6
 * @subpackage  Controls
7
 * @copyright   Copyright (c) 2017, Aristeides Stathopoulos
8
 * @license     http://opensource.org/licenses/https://opensource.org/licenses/MIT
9
 * @since       3.0.10
10
 */
11
12
/**
13
 * Output overrides.
14
 */
15
class Kirki_Output_Field_Image extends Kirki_Output {
16
17
	/**
18
	 * Processes a single item from the `output` array.
19
	 *
20
	 * @access protected
21
	 * @param array $output The `output` item.
22
	 * @param array $value  The field's value.
23
	 */
24
	protected function process_output( $output, $value ) {
25
26
		if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) {
27
			return;
28
		}
29
		$output = wp_parse_args( $output, array(
30
			'media_query' => 'global',
31
			'prefix'      => '',
32
			'units'       => '',
33
			'suffix'      => '',
34
		) );
35
		if ( is_array( $value ) ) {
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'];
0 ignored issues
show
Are you sure $this->process_property_...lue[$output['choice']]) of type array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
				$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . /** @scrutinizer ignore-type */ $this->process_property_value( $output['property'], $value[ $output['choice'] ] ) . $output['units'] . $output['suffix'];
Loading history...
38
				return;
39
			}
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'];
0 ignored issues
show
Are you sure $this->process_property_...perty'], $value['url']) of type array can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

41
				$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . /** @scrutinizer ignore-type */ $this->process_property_value( $output['property'], $value['url'] ) . $output['units'] . $output['suffix'];
Loading history...
42
				return;
43
			}
44
			return;
45
		}
46
		$this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix'];
47
	}
48
}
49