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 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 | if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
||||
26 | return; |
||||
27 | } |
||||
28 | $output = wp_parse_args( |
||||
29 | $output, array( |
||||
0 ignored issues
–
show
|
|||||
30 | 'media_query' => 'global', |
||||
31 | 'prefix' => '', |
||||
32 | 'units' => '', |
||||
33 | 'suffix' => '', |
||||
34 | ) |
||||
35 | ); |
||||
36 | if ( is_array( $value ) ) { |
||||
37 | if ( isset( $output['choice'] ) && $output['choice'] ) { |
||||
38 | $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
Loading history...
|
|||||
39 | return; |
||||
40 | } |
||||
41 | if ( isset( $value['url'] ) ) { |
||||
42 | $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
Loading history...
|
|||||
43 | return; |
||||
44 | } |
||||
45 | return; |
||||
46 | } |
||||
47 | $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
||||
48 | } |
||||
49 | } |
||||
50 |
For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this: