1 | <?php |
||||
2 | /** |
||||
3 | * Handles CSS output for dimensions 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 2.2.0 |
||||
10 | */ |
||||
11 | |||||
12 | /** |
||||
13 | * Output overrides. |
||||
14 | */ |
||||
15 | class Kirki_Output_Field_Dimensions 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 | $output = wp_parse_args( |
||||
27 | $output, array( |
||||
28 | 'element' => '', |
||||
29 | 'property' => '', |
||||
30 | 'media_query' => 'global', |
||||
31 | 'prefix' => '', |
||||
32 | 'suffix' => '', |
||||
33 | ) |
||||
34 | ); |
||||
35 | |||||
36 | if ( ! is_array( $value ) ) { |
||||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
37 | return; |
||||
38 | } |
||||
39 | |||||
40 | foreach ( array_keys( $value ) as $key ) { |
||||
41 | |||||
42 | $property = ( empty( $output['property'] ) ) ? $key : $output['property'] . '-' . $key; |
||||
43 | if ( isset( $output['choice'] ) && $output['property'] ) { |
||||
44 | if ( $key === $output['choice'] ) { |
||||
45 | $property = $output['property']; |
||||
46 | } else { |
||||
47 | continue; |
||||
48 | } |
||||
49 | } |
||||
50 | if ( false !== strpos( $output['property'], '%%' ) ) { |
||||
51 | $property = str_replace( '%%', $key, $output['property'] ); |
||||
52 | } |
||||
53 | $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix']; |
||||
0 ignored issues
–
show
Are you sure
$this->process_property_...property, $value[$key]) 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...
|
|||||
54 | } |
||||
55 | } |
||||
56 | } |
||||
57 |