@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function apply_sanitize_callback( $output, $value ) { |
85 | 85 | |
86 | - if ( isset( $output['sanitize_callback'] ) && null !== $output['sanitize_callback'] ) { |
|
86 | + if ( isset( $output[ 'sanitize_callback' ] ) && null !== $output[ 'sanitize_callback' ] ) { |
|
87 | 87 | |
88 | 88 | // If the sanitize_callback is invalid, return the value. |
89 | - if ( ! is_callable( $output['sanitize_callback'] ) ) { |
|
89 | + if ( ! is_callable( $output[ 'sanitize_callback' ] ) ) { |
|
90 | 90 | return $value; |
91 | 91 | } |
92 | - return call_user_func( $output['sanitize_callback'], $this->value ); |
|
92 | + return call_user_func( $output[ 'sanitize_callback' ], $this->value ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $value; |
@@ -105,22 +105,22 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function apply_value_pattern( $output, $value ) { |
107 | 107 | |
108 | - if ( isset( $output['value_pattern'] ) && ! empty( $output['value_pattern'] ) && is_string( $output['value_pattern'] ) ) { |
|
108 | + if ( isset( $output[ 'value_pattern' ] ) && ! empty( $output[ 'value_pattern' ] ) && is_string( $output[ 'value_pattern' ] ) ) { |
|
109 | 109 | if ( ! is_array( $value ) ) { |
110 | - $value = str_replace( '$', $value, $output['value_pattern'] ); |
|
110 | + $value = str_replace( '$', $value, $output[ 'value_pattern' ] ); |
|
111 | 111 | } |
112 | 112 | if ( is_array( $value ) ) { |
113 | 113 | foreach ( array_keys( $value ) as $value_k ) { |
114 | 114 | if ( ! is_string( $value[ $value_k ] ) ) { |
115 | 115 | continue; |
116 | 116 | } |
117 | - if ( isset( $output['choice'] ) ) { |
|
118 | - if ( $output['choice'] === $value_k ) { |
|
119 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
117 | + if ( isset( $output[ 'choice' ] ) ) { |
|
118 | + if ( $output[ 'choice' ] === $value_k ) { |
|
119 | + $value[ $output[ 'choice' ] ] = str_replace( '$', $value[ $output[ 'choice' ] ], $output[ 'value_pattern' ] ); |
|
120 | 120 | } |
121 | 121 | continue; |
122 | 122 | } |
123 | - $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] ); |
|
123 | + $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output[ 'value_pattern' ] ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | $value = $this->apply_pattern_replace( $output, $value ); |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | * @return string|array |
137 | 137 | */ |
138 | 138 | protected function apply_pattern_replace( $output, $value ) { |
139 | - if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) { |
|
139 | + if ( isset( $output[ 'pattern_replace' ] ) && is_array( $output[ 'pattern_replace' ] ) ) { |
|
140 | 140 | $option_type = ( '' !== Kirki::get_config_param( $this->config_id, 'option_type' ) ) ? Kirki::get_config_param( $this->config_id, 'option_type' ) : 'theme_mod'; |
141 | 141 | $option_name = Kirki::get_config_param( $this->config_id, 'option_name' ); |
142 | 142 | $options = array(); |
143 | 143 | if ( $option_name ) { |
144 | 144 | $options = ( 'site_option' === $option_type ) ? get_site_option( $option_name ) : get_option( $option_name ); |
145 | 145 | } |
146 | - foreach ( $output['pattern_replace'] as $search => $replace ) { |
|
146 | + foreach ( $output[ 'pattern_replace' ] as $search => $replace ) { |
|
147 | 147 | $replacement = ''; |
148 | 148 | switch ( $option_type ) { |
149 | 149 | case 'option': |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | // No need to proceed this if the current value is the same as in the "exclude" value. |
207 | - if ( isset( $output['exclude'] ) && is_array( $output['exclude'] ) ) { |
|
208 | - foreach ( $output['exclude'] as $exclude ) { |
|
207 | + if ( isset( $output[ 'exclude' ] ) && is_array( $output[ 'exclude' ] ) ) { |
|
208 | + foreach ( $output[ 'exclude' ] as $exclude ) { |
|
209 | 209 | if ( is_array( $value ) ) { |
210 | 210 | if ( is_array( $exclude ) ) { |
211 | 211 | $diff1 = array_diff( $value, $exclude ); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // If 'choice' is defined check for sub-values too. |
219 | 219 | // Fixes https://github.com/aristath/kirki/issues/1416. |
220 | 220 | // @codingStandardsIgnoreLine WordPress.PHP.StrictComparisons.LooseComparison |
221 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison |
|
221 | + if ( isset( $output[ 'choice' ] ) && isset( $value[ $output[ 'choice' ] ] ) && $exclude == $value[ $output[ 'choice' ] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison |
|
222 | 222 | $skip = true; |
223 | 223 | } |
224 | 224 | } |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | // Apply any value patterns defined. |
240 | 240 | $value = $this->apply_value_pattern( $output, $value ); |
241 | 241 | |
242 | - if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
|
243 | - $output['element'] = array_unique( $output['element'] ); |
|
244 | - sort( $output['element'] ); |
|
245 | - $output['element'] = implode( ',', $output['element'] ); |
|
242 | + if ( isset( $output[ 'element' ] ) && is_array( $output[ 'element' ] ) ) { |
|
243 | + $output[ 'element' ] = array_unique( $output[ 'element' ] ); |
|
244 | + sort( $output[ 'element' ] ); |
|
245 | + $output[ 'element' ] = implode( ',', $output[ 'element' ] ); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $value = $this->process_value( $value, $output ); |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * @return null |
261 | 261 | */ |
262 | 262 | protected function process_output( $output, $value ) { |
263 | - if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) { |
|
263 | + if ( ! isset( $output[ 'element' ] ) || ! isset( $output[ 'property' ] ) ) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | - $output['media_query'] = ( isset( $output['media_query'] ) ) ? $output['media_query'] : 'global'; |
|
267 | - $output['prefix'] = ( isset( $output['prefix'] ) ) ? $output['prefix'] : ''; |
|
268 | - $output['units'] = ( isset( $output['units'] ) ) ? $output['units'] : ''; |
|
269 | - $output['suffix'] = ( isset( $output['suffix'] ) ) ? $output['suffix'] : ''; |
|
266 | + $output[ 'media_query' ] = ( isset( $output[ 'media_query' ] ) ) ? $output[ 'media_query' ] : 'global'; |
|
267 | + $output[ 'prefix' ] = ( isset( $output[ 'prefix' ] ) ) ? $output[ 'prefix' ] : ''; |
|
268 | + $output[ 'units' ] = ( isset( $output[ 'units' ] ) ) ? $output[ 'units' ] : ''; |
|
269 | + $output[ 'suffix' ] = ( isset( $output[ 'suffix' ] ) ) ? $output[ 'suffix' ] : ''; |
|
270 | 270 | |
271 | 271 | // Properties that can accept multiple values. |
272 | 272 | // Useful for example for gradients where all browsers use the "background-image" property |
@@ -275,14 +275,14 @@ discard block |
||
275 | 275 | 'background-image', |
276 | 276 | 'background', |
277 | 277 | ); |
278 | - if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
|
279 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
280 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
278 | + if ( in_array( $output[ 'property' ], $accepts_multiple, true ) ) { |
|
279 | + if ( isset( $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] ) && ! is_array( $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] ) ) { |
|
280 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = (array) $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ]; |
|
281 | 281 | } |
282 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
282 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ][ ] = $output[ 'prefix' ] . $value . $output[ 'units' ] . $output[ 'suffix' ]; |
|
283 | 283 | return; |
284 | 284 | } |
285 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
285 | + $this->styles[ $output[ 'media_query' ] ][ $output[ 'element' ] ][ $output[ 'property' ] ] = $output[ 'prefix' ] . $this->process_property_value( $output[ 'property' ], $value ) . $output[ 'units' ] . $output[ 'suffix' ]; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | * @return string|array |
321 | 321 | */ |
322 | 322 | protected function process_value( $value, $output ) { |
323 | - if ( isset( $output['property'] ) ) { |
|
324 | - return $this->process_property_value( $output['property'], $value ); |
|
323 | + if ( isset( $output[ 'property' ] ) ) { |
|
324 | + return $this->process_property_value( $output[ 'property' ], $value ); |
|
325 | 325 | } |
326 | 326 | return $value; |
327 | 327 | } |
@@ -218,7 +218,8 @@ |
||
218 | 218 | // If 'choice' is defined check for sub-values too. |
219 | 219 | // Fixes https://github.com/aristath/kirki/issues/1416. |
220 | 220 | // @codingStandardsIgnoreLine WordPress.PHP.StrictComparisons.LooseComparison |
221 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison |
|
221 | + if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
222 | +// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison |
|
222 | 223 | $skip = true; |
223 | 224 | } |
224 | 225 | } |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function typography_field_tweaks( $value, $field_id ) { |
42 | 42 | |
43 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['type'] ) ) { |
|
44 | - if ( 'kirki-typography' === Kirki::$fields[ $field_id ]['type'] ) { |
|
43 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'type' ] ) ) { |
|
44 | + if ( 'kirki-typography' === Kirki::$fields[ $field_id ][ 'type' ] ) { |
|
45 | 45 | |
46 | 46 | // Sanitize the value. |
47 | 47 | // This also adds font-weight if it doesn't already exist. |
48 | 48 | $value = Kirki_Field_Typography::sanitize( $value ); |
49 | 49 | |
50 | 50 | // Combine font-family and font-backup. |
51 | - if ( isset( $value['font-family'] ) && isset( $value['font-backup'] ) ) { |
|
52 | - $value['font-family'] .= ', ' . $value['font-backup']; |
|
53 | - unset( $value['font-backup'] ); |
|
51 | + if ( isset( $value[ 'font-family' ] ) && isset( $value[ 'font-backup' ] ) ) { |
|
52 | + $value[ 'font-family' ] .= ', ' . $value[ 'font-backup' ]; |
|
53 | + unset( $value[ 'font-backup' ] ); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -87,39 +87,39 @@ discard block |
||
87 | 87 | $config_id = 'global'; |
88 | 88 | } |
89 | 89 | |
90 | - if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
90 | + if ( 'theme_mod' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
91 | 91 | |
92 | 92 | // We're using theme_mods so just get the value using get_theme_mod. |
93 | 93 | $default_value = null; |
94 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
95 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
94 | + if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) { |
|
95 | + $default_value = Kirki::$fields[ $field_id ][ 'default' ]; |
|
96 | 96 | } |
97 | 97 | $value = get_theme_mod( $field_id, $default_value ); |
98 | 98 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
99 | 99 | } |
100 | 100 | |
101 | - if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) { |
|
101 | + if ( 'option' === Kirki::$config[ $config_id ][ 'option_type' ] ) { |
|
102 | 102 | |
103 | 103 | // We're using options. |
104 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
104 | + if ( '' !== Kirki::$config[ $config_id ][ 'option_name' ] ) { |
|
105 | 105 | |
106 | 106 | // Options are serialized as a single option in the db. |
107 | 107 | // We'll have to get the option and then get the item from the array. |
108 | - $options = get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
108 | + $options = get_option( Kirki::$config[ $config_id ][ 'option_name' ] ); |
|
109 | 109 | |
110 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
111 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
110 | + if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']' ] ) ) { |
|
111 | + $field_id = Kirki::$config[ $config_id ][ 'option_name' ] . '[' . $field_id . ']'; |
|
112 | 112 | } |
113 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
113 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ][ 'option_name' ] . '[', '', $field_id ) ); |
|
114 | 114 | |
115 | - $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : ''; |
|
115 | + $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ][ 'default' ] ) ) ? Kirki::$fields[ $field_id ][ 'default' ] : ''; |
|
116 | 116 | $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
117 | 117 | $value = maybe_unserialize( $value ); |
118 | 118 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Each option separately saved in the db. |
122 | - $value = get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
122 | + $value = get_option( $field_id, Kirki::$fields[ $field_id ][ 'default' ] ); |
|
123 | 123 | return apply_filters( 'kirki_values_get_value', $value, $field_id ); |
124 | 124 | |
125 | 125 | } // End if(). |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | * @return string|array |
138 | 138 | */ |
139 | 139 | public static function get_sanitized_field_value( $field ) { |
140 | - $value = $field['default']; |
|
141 | - if ( isset( $field['option_type'] ) && 'theme_mod' === $field['option_type'] ) { |
|
142 | - $value = get_theme_mod( $field['settings'], $field['default'] ); |
|
143 | - } elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) { |
|
144 | - if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
|
145 | - $all_values = get_option( $field['option_name'], array() ); |
|
146 | - $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
|
140 | + $value = $field[ 'default' ]; |
|
141 | + if ( isset( $field[ 'option_type' ] ) && 'theme_mod' === $field[ 'option_type' ] ) { |
|
142 | + $value = get_theme_mod( $field[ 'settings' ], $field[ 'default' ] ); |
|
143 | + } elseif ( isset( $field[ 'option_type' ] ) && 'option' === $field[ 'option_type' ] ) { |
|
144 | + if ( isset( $field[ 'option_name' ] ) && '' !== $field[ 'option_name' ] ) { |
|
145 | + $all_values = get_option( $field[ 'option_name' ], array() ); |
|
146 | + $sub_setting_id = str_replace( array( ']', $field[ 'option_name' ] . '[' ), '', $field[ 'settings' ] ); |
|
147 | 147 | if ( isset( $all_values[ $sub_setting_id ] ) ) { |
148 | 148 | $value = $all_values[ $sub_setting_id ]; |
149 | 149 | } |
150 | 150 | } else { |
151 | - $value = get_option( $field['settings'], $field['default'] ); |
|
151 | + $value = get_option( $field[ 'settings' ], $field[ 'default' ] ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | |
63 | 63 | // Apply the kirki_config filter. |
64 | 64 | $config = apply_filters( 'kirki_config', array() ); |
65 | - if ( isset( $config['url_path'] ) ) { |
|
66 | - Kirki::$url = $config['url_path']; |
|
65 | + if ( isset( $config[ 'url_path' ] ) ) { |
|
66 | + Kirki::$url = $config[ 'url_path' ]; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // Make sure the right protocol is used. |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | if ( ! empty( Kirki::$panels ) ) { |
172 | 172 | foreach ( Kirki::$panels as $panel_args ) { |
173 | 173 | // Extra checks for nested panels. |
174 | - if ( isset( $panel_args['panel'] ) ) { |
|
175 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
174 | + if ( isset( $panel_args[ 'panel' ] ) ) { |
|
175 | + if ( isset( Kirki::$panels[ $panel_args[ 'panel' ] ] ) ) { |
|
176 | 176 | // Set the type to nested. |
177 | - $panel_args['type'] = 'kirki-nested'; |
|
177 | + $panel_args[ 'type' ] = 'kirki-nested'; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | if ( ! empty( Kirki::$sections ) ) { |
193 | 193 | foreach ( Kirki::$sections as $section_args ) { |
194 | 194 | // Extra checks for nested sections. |
195 | - if ( isset( $section_args['section'] ) ) { |
|
196 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
195 | + if ( isset( $section_args[ 'section' ] ) ) { |
|
196 | + if ( isset( Kirki::$sections[ $section_args[ 'section' ] ] ) ) { |
|
197 | 197 | // Set the type to nested. |
198 | - $section_args['type'] = 'kirki-nested'; |
|
198 | + $section_args[ 'type' ] = 'kirki-nested'; |
|
199 | 199 | // We need to check if the parent section is nested inside a panel. |
200 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
201 | - if ( isset( $parent_section['panel'] ) ) { |
|
202 | - $section_args['panel'] = $parent_section['panel']; |
|
200 | + $parent_section = Kirki::$sections[ $section_args[ 'section' ] ]; |
|
201 | + if ( isset( $parent_section[ 'panel' ] ) ) { |
|
202 | + $section_args[ 'panel' ] = $parent_section[ 'panel' ]; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | } |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | // Get defaults from the class. |
93 | 93 | $defaults = get_class_vars( __CLASS__ ); |
94 | 94 | // Skip what we don't need in this context. |
95 | - unset( $defaults['config_final'] ); |
|
96 | - unset( $defaults['instances'] ); |
|
95 | + unset( $defaults[ 'config_final' ] ); |
|
96 | + unset( $defaults[ 'instances' ] ); |
|
97 | 97 | // Apply any kirki_config global filters. |
98 | 98 | $defaults = apply_filters( 'kirki_config', $defaults ); |
99 | 99 | // Merge our args with the defaults. |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public static function get_config_ids() { |
162 | 162 | $configs = array(); |
163 | 163 | foreach ( self::$instances as $instance ) { |
164 | - $configs[] = $instance->id; |
|
164 | + $configs[ ] = $instance->id; |
|
165 | 165 | } |
166 | 166 | return array_unique( $configs ); |
167 | 167 | } |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | public function custom_css() { |
69 | 69 | |
70 | 70 | $config = apply_filters( 'kirki_config', array() ); |
71 | - if ( ! isset( $config['color_accent'] ) && ! isset( $config['color_back'] ) ) { |
|
71 | + if ( ! isset( $config[ 'color_accent' ] ) && ! isset( $config[ 'color_back' ] ) ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | - $back = isset( $config['color_back'] ) ? $config['color_back'] : false; |
|
74 | + $back = isset( $config[ 'color_back' ] ) ? $config[ 'color_back' ] : false; |
|
75 | 75 | |
76 | 76 | $text_on_back = ''; |
77 | 77 | $border_on_back = ''; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $hover_on_back = ( 90 < $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness - 3 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness + 3 )->toCSS( $back_obj->mode ); |
94 | 94 | $arrows_on_back = ( 50 > $back_obj->lightness ) ? $back_obj->getNew( 'lightness', $back_obj->lightness + 30 )->toCSS( $back_obj->mode ) : $back_obj->getNew( 'lightness', $back_obj->lightness - 30 )->toCSS( $back_obj->mode ); |
95 | 95 | } |
96 | - $accent = ( isset( $config['color_accent'] ) ) ? $config['color_accent'] : false; |
|
96 | + $accent = ( isset( $config[ 'color_accent' ] ) ) ? $config[ 'color_accent' ] : false; |
|
97 | 97 | if ( $accent ) { |
98 | 98 | $accent_obj = ariColor::newColor( $accent ); |
99 | 99 | $text_on_accent = ( 60 > $accent_obj->lightness ) ? $accent_obj->getNew( 'lightness', $accent_obj->lightness + 60 )->toCSS( $accent_obj->mode ) : $accent_obj->getNew( 'lightness', $accent_obj->lightness - 60 )->toCSS( $accent_obj->mode ); |
@@ -405,18 +405,18 @@ discard block |
||
405 | 405 | color: #444 !important; |
406 | 406 | } |
407 | 407 | |
408 | - <?php if ( isset( $config['width'] ) ) : ?> |
|
408 | + <?php if ( isset( $config[ 'width' ] ) ) : ?> |
|
409 | 409 | .wp-full-overlay-sidebar { |
410 | - width: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
410 | + width: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
411 | 411 | } |
412 | 412 | .expanded .wp-full-overlay-footer { |
413 | - width: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
413 | + width: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
414 | 414 | } |
415 | 415 | .wp-full-overlay.expanded { |
416 | - margin-left: <?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
416 | + margin-left: <?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
417 | 417 | } |
418 | 418 | .wp-full-overlay.collapsed .wp-full-overlay-sidebar { |
419 | - margin-left: -<?php echo esc_attr( $config['width'] ); // WPCS: XSS ok. ?>; |
|
419 | + margin-left: -<?php echo esc_attr( $config[ 'width' ] ); // WPCS: XSS ok. ?>; |
|
420 | 420 | } |
421 | 421 | <?php endif; ?> |
422 | 422 | </style> |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | // Allow disabling the custom loader using the kirki_config filter. |
65 | 65 | $config = apply_filters( 'kirki_config', array() ); |
66 | - if ( isset( $config['disable_loader'] ) && true === $config['disable_loader'] ) { |
|
66 | + if ( isset( $config[ 'disable_loader' ] ) && true === $config[ 'disable_loader' ] ) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | // Add the "loading" icon. |
@@ -169,18 +169,18 @@ |
||
169 | 169 | */ |
170 | 170 | public function loop_fields( $config_id ) { |
171 | 171 | foreach ( Kirki::$fields as $field ) { |
172 | - if ( isset( $field['kirki_config'] ) && $config_id !== $field['kirki_config'] ) { |
|
172 | + if ( isset( $field[ 'kirki_config' ] ) && $config_id !== $field[ 'kirki_config' ] ) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 | if ( true === apply_filters( "kirki_{$config_id}_webfonts_skip_hidden", true ) ) { |
176 | 176 | // Only continue if field dependencies are met. |
177 | - if ( ! empty( $field['required'] ) ) { |
|
177 | + if ( ! empty( $field[ 'required' ] ) ) { |
|
178 | 178 | $valid = true; |
179 | 179 | |
180 | - foreach ( $field['required'] as $requirement ) { |
|
181 | - if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) { |
|
182 | - $controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] ); |
|
183 | - if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) { |
|
180 | + foreach ( $field[ 'required' ] as $requirement ) { |
|
181 | + if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) { |
|
182 | + $controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] ); |
|
183 | + if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) { |
|
184 | 184 | $valid = false; |
185 | 185 | } |
186 | 186 | } |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | public static function css( $field ) { |
147 | 147 | |
148 | 148 | // Set class vars. |
149 | - self::$settings = $field['settings']; |
|
150 | - self::$callback = $field['sanitize_callback']; |
|
151 | - self::$field_type = $field['type']; |
|
152 | - self::$output = $field['output']; |
|
149 | + self::$settings = $field[ 'settings' ]; |
|
150 | + self::$callback = $field[ 'sanitize_callback' ]; |
|
151 | + self::$field_type = $field[ 'type' ]; |
|
152 | + self::$output = $field[ 'output' ]; |
|
153 | 153 | if ( ! is_array( self::$output ) ) { |
154 | 154 | self::$output = array( |
155 | 155 | array( |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | // Find the class that will handle the outpout for this field. |
166 | 166 | $classname = 'Kirki_Output'; |
167 | - $field_output_classes = apply_filters( "kirki_{$field['kirki_config']}_output_control_classnames", array( |
|
167 | + $field_output_classes = apply_filters( "kirki_{$field[ 'kirki_config' ]}_output_control_classnames", array( |
|
168 | 168 | 'kirki-background' => 'Kirki_Output_Field_Background', |
169 | 169 | 'kirki-dimensions' => 'Kirki_Output_Field_Dimensions', |
170 | 170 | 'kirki-image' => 'Kirki_Output_Field_Image', |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | if ( array_key_exists( self::$field_type, $field_output_classes ) ) { |
175 | 175 | $classname = $field_output_classes[ self::$field_type ]; |
176 | 176 | } |
177 | - $obj = new $classname( $field['kirki_config'], self::$output, self::$value, $field ); |
|
177 | + $obj = new $classname( $field[ 'kirki_config' ], self::$output, self::$value, $field ); |
|
178 | 178 | return $obj->get_styles(); |
179 | 179 | |
180 | 180 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | |
120 | 120 | $config = apply_filters( 'kirki_config', array() ); |
121 | 121 | $priority = 999; |
122 | - if ( isset( $config['styles_priority'] ) ) { |
|
123 | - $priority = absint( $config['styles_priority'] ); |
|
122 | + if ( isset( $config[ 'styles_priority' ] ) ) { |
|
123 | + $priority = absint( $config[ 'styles_priority' ] ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // Allow completely disabling Kirki CSS output. |
127 | - if ( ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) || ( isset( $config['disable_output'] ) && true === $config['disable_output'] ) ) { |
|
127 | + if ( ( defined( 'KIRKI_NO_OUTPUT' ) && true === KIRKI_NO_OUTPUT ) || ( isset( $config[ 'disable_output' ] ) && true === $config[ 'disable_output' ] ) ) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | // If we are in the customizer, load CSS using inline-styles. |
157 | 157 | // If we are in the frontend AND self::$ajax is true, then load dynamic CSS using AJAX. |
158 | - if ( ( true === self::$ajax ) || ( isset( $config['inline_css'] ) && false === $config['inline_css'] ) ) { |
|
158 | + if ( ( true === self::$ajax ) || ( isset( $config[ 'inline_css' ] ) && false === $config[ 'inline_css' ] ) ) { |
|
159 | 159 | add_action( 'wp_enqueue_scripts', array( $this, 'frontend_styles' ), $priority ); |
160 | 160 | add_action( 'wp_ajax_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) ); |
161 | 161 | add_action( 'wp_ajax_nopriv_kirki_dynamic_css', array( $this, 'ajax_dynamic_css' ) ); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $configs = Kirki::$config; |
187 | 187 | if ( ! $this->processed ) { |
188 | 188 | foreach ( $configs as $config_id => $args ) { |
189 | - if ( isset( $args['disable_output'] ) && true === $args['disable_output'] ) { |
|
189 | + if ( isset( $args[ 'disable_output' ] ) && true === $args[ 'disable_output' ] ) { |
|
190 | 190 | continue; |
191 | 191 | } |
192 | 192 | $styles = self::loop_controls( $config_id ); |
@@ -243,19 +243,19 @@ discard block |
||
243 | 243 | foreach ( $fields as $field ) { |
244 | 244 | |
245 | 245 | // Only process fields that belong to $config_id. |
246 | - if ( $config_id !== $field['kirki_config'] ) { |
|
246 | + if ( $config_id !== $field[ 'kirki_config' ] ) { |
|
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | |
250 | 250 | if ( true === apply_filters( "kirki_{$config_id}_css_skip_hidden", true ) ) { |
251 | 251 | // Only continue if field dependencies are met. |
252 | - if ( ! empty( $field['required'] ) ) { |
|
252 | + if ( ! empty( $field[ 'required' ] ) ) { |
|
253 | 253 | $valid = true; |
254 | 254 | |
255 | - foreach ( $field['required'] as $requirement ) { |
|
256 | - if ( isset( $requirement['setting'] ) && isset( $requirement['value'] ) && isset( $requirement['operator'] ) ) { |
|
257 | - $controller_value = Kirki_Values::get_value( $config_id, $requirement['setting'] ); |
|
258 | - if ( ! Kirki_Helper::compare_values( $controller_value, $requirement['value'], $requirement['operator'] ) ) { |
|
255 | + foreach ( $field[ 'required' ] as $requirement ) { |
|
256 | + if ( isset( $requirement[ 'setting' ] ) && isset( $requirement[ 'value' ] ) && isset( $requirement[ 'operator' ] ) ) { |
|
257 | + $controller_value = Kirki_Values::get_value( $config_id, $requirement[ 'setting' ] ); |
|
258 | + if ( ! Kirki_Helper::compare_values( $controller_value, $requirement[ 'value' ], $requirement[ 'operator' ] ) ) { |
|
259 | 259 | $valid = false; |
260 | 260 | } |
261 | 261 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | // Only continue if $field['output'] is set. |
271 | - if ( isset( $field['output'] ) && ! empty( $field['output'] ) ) { |
|
271 | + if ( isset( $field[ 'output' ] ) && ! empty( $field[ 'output' ] ) ) { |
|
272 | 272 | $css = Kirki_Helper::array_replace_recursive( $css, Kirki_Modules_CSS_Generator::css( $field ) ); |
273 | 273 | |
274 | 274 | // Add the globals. |