@@ -31,32 +31,32 @@ |
||
31 | 31 | |
32 | 32 | // Background-image. |
33 | 33 | if ( isset( $value['background-image'] ) && ! empty( $value['background-image'] ) ) { |
34 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background-image'] = $output['prefix'] . $this->process_property_value( 'background-image', $value['background-image'] ) . $output['suffix']; |
|
34 | + $this->styles[$output['media_query']][$output['element']]['background-image'] = $output['prefix'] . $this->process_property_value( 'background-image', $value['background-image'] ) . $output['suffix']; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // Background-color. |
38 | 38 | if ( isset( $value['background-color'] ) && ! empty( $value['background-color'] ) ) { |
39 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background-color'] = $output['prefix'] . $this->process_property_value( 'background-color', $value['background-color'] ) . $output['suffix']; |
|
39 | + $this->styles[$output['media_query']][$output['element']]['background-color'] = $output['prefix'] . $this->process_property_value( 'background-color', $value['background-color'] ) . $output['suffix']; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Background-repeat. |
43 | 43 | if ( isset( $value['background-repeat'] ) && ! empty( $value['background-repeat'] ) ) { |
44 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background-repeat'] = $output['prefix'] . $this->process_property_value( 'background-repeat', $value['background-repeat'] ) . $output['suffix']; |
|
44 | + $this->styles[$output['media_query']][$output['element']]['background-repeat'] = $output['prefix'] . $this->process_property_value( 'background-repeat', $value['background-repeat'] ) . $output['suffix']; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Background-position. |
48 | 48 | if ( isset( $value['background-position'] ) && ! empty( $value['background-position'] ) ) { |
49 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background-position'] = $output['prefix'] . $this->process_property_value( 'background-position', $value['background-position'] ) . $output['suffix']; |
|
49 | + $this->styles[$output['media_query']][$output['element']]['background-position'] = $output['prefix'] . $this->process_property_value( 'background-position', $value['background-position'] ) . $output['suffix']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Background-size. |
53 | 53 | if ( isset( $value['background-size'] ) && ! empty( $value['background-size'] ) ) { |
54 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background-size'] = $output['prefix'] . $this->process_property_value( 'background-size', $value['background-size'] ) . $output['suffix']; |
|
54 | + $this->styles[$output['media_query']][$output['element']]['background-size'] = $output['prefix'] . $this->process_property_value( 'background-size', $value['background-size'] ) . $output['suffix']; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Background-attachment. |
58 | 58 | if ( isset( $value['background-attachment'] ) && ! empty( $value['background-attachment'] ) ) { |
59 | - $this->styles[ $output['media_query'] ][ $output['element'] ]['background-attachment'] = $output['prefix'] . $this->process_property_value( 'background-attachment', $value['background-attachment'] ) . $output['suffix']; |
|
59 | + $this->styles[$output['media_query']][$output['element']]['background-attachment'] = $output['prefix'] . $this->process_property_value( 'background-attachment', $value['background-attachment'] ) . $output['suffix']; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |
@@ -43,43 +43,43 @@ discard block |
||
43 | 43 | $config_id = ( '' === $config_id ) ? 'global' : $config_id; |
44 | 44 | |
45 | 45 | // Fallback to 'global' if $config_id is not found. |
46 | - if ( ! isset( Kirki::$config[ $config_id ] ) ) { |
|
46 | + if ( ! isset( Kirki::$config[$config_id] ) ) { |
|
47 | 47 | $config_id = 'global'; |
48 | 48 | } |
49 | 49 | |
50 | - if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
50 | + if ( 'theme_mod' === Kirki::$config[$config_id]['option_type'] ) { |
|
51 | 51 | |
52 | 52 | // We're using theme_mods so just get the value using get_theme_mod. |
53 | 53 | $default_value = null; |
54 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
55 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
54 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) { |
|
55 | + $default_value = Kirki::$fields[$field_id]['default']; |
|
56 | 56 | } |
57 | 57 | $value = get_theme_mod( $field_id, $default_value ); |
58 | 58 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
59 | 59 | } |
60 | 60 | |
61 | - if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
61 | + if ( 'option' === Kirki::$config[$config_id]['option_type'] ) { |
|
62 | 62 | |
63 | 63 | // We're using options. |
64 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
64 | + if ( '' !== Kirki::$config[$config_id]['option_name'] ) { |
|
65 | 65 | |
66 | 66 | // Options are serialized as a single option in the db. |
67 | 67 | // We'll have to get the option and then get the item from the array. |
68 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
68 | + $options = get_option( Kirki::$config[$config_id]['option_name'] ); |
|
69 | 69 | |
70 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
71 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
70 | + if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
71 | + $field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'; |
|
72 | 72 | } |
73 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
73 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) ); |
|
74 | 74 | |
75 | - $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : ''; |
|
76 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
|
75 | + $default_value = ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) ? Kirki::$fields[$field_id]['default'] : ''; |
|
76 | + $value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : $default_value; |
|
77 | 77 | $value = maybe_unserialize( $value ); |
78 | 78 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Each option separately saved in the db. |
82 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
82 | + $value = get_option( $field_id, Kirki::$fields[$field_id]['default'] ); |
|
83 | 83 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
84 | 84 | |
85 | 85 | } // End if(). |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
105 | 105 | $all_values = get_option( $field['option_name'], array() ); |
106 | 106 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
107 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
108 | - $value = $all_values[ $sub_setting_id ]; |
|
107 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
108 | + $value = $all_values[$sub_setting_id]; |
|
109 | 109 | } |
110 | 110 | } else { |
111 | 111 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -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 | } |