@@ -257,13 +257,13 @@ discard block |
||
257 | 257 | |
258 | 258 | // Get the config arguments, and merge them with the defaults. |
259 | 259 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
260 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
261 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
260 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
261 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
262 | 262 | } |
263 | 263 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
264 | 264 | foreach ( $config_defaults as $key => $value ) { |
265 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) { |
|
266 | - $defaults[ $key ] = $value; |
|
265 | + if ( isset( $defaults[$key] ) && ! empty( $value ) && $value !== $defaults[$key] ) { |
|
266 | + $defaults[$key] = $value; |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | // Get all arguments with their values. |
309 | 309 | $args = get_object_vars( $this ); |
310 | 310 | foreach ( array_keys( $args ) as $key ) { |
311 | - $args[ $key ] = $this->$key; |
|
311 | + $args[$key] = $this->$key; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | // Add the field to the static $fields variable properly indexed. |
315 | - Kirki::$fields[ $this->settings ] = $args; |
|
315 | + Kirki::$fields[$this->settings] = $args; |
|
316 | 316 | |
317 | 317 | } |
318 | 318 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
408 | 408 | /* translators: %1$s represents the field ID where the error occurs. */ |
409 | 409 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
410 | - unset( $this->partial_refresh[ $id ] ); |
|
410 | + unset( $this->partial_refresh[$id] ); |
|
411 | 411 | continue; |
412 | 412 | } |
413 | 413 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | } |
436 | 436 | $settings = array(); |
437 | 437 | foreach ( $this->settings as $setting_key => $setting_value ) { |
438 | - $settings[ $setting_key ] = $setting_value; |
|
438 | + $settings[$setting_key] = $setting_value; |
|
439 | 439 | // If we're using serialized options then we need to spice this up. |
440 | 440 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
441 | - $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
441 | + $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | $this->settings = $settings; |
@@ -563,17 +563,17 @@ discard block |
||
563 | 563 | } |
564 | 564 | foreach ( $this->output as $key => $output ) { |
565 | 565 | if ( empty( $output ) || ! isset( $output['element'] ) ) { |
566 | - unset( $this->output[ $key ] ); |
|
566 | + unset( $this->output[$key] ); |
|
567 | 567 | continue; |
568 | 568 | } |
569 | 569 | if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
570 | - $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
570 | + $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
571 | 571 | } |
572 | 572 | // Convert element arrays to strings. |
573 | 573 | if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
574 | - $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
575 | - sort( $this->output[ $key ]['element'] ); |
|
576 | - $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
574 | + $this->output[$key]['element'] = array_unique( $this->output[$key]['element'] ); |
|
575 | + sort( $this->output[$key]['element'] ); |
|
576 | + $this->output[$key]['element'] = implode( ',', $this->output[$key]['element'] ); |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 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 ); |
@@ -34,8 +34,8 @@ |
||
34 | 34 | ); |
35 | 35 | |
36 | 36 | foreach ( array( 'background-image', 'background-color', 'background-repeat', 'background-position', 'background-size', 'background-attachment' ) as $property ) { |
37 | - if ( isset( $value[ $property ] ) && ! empty( $value[ $property ] ) ) { |
|
38 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $property ] ) . $output['suffix']; |
|
37 | + if ( isset( $value[$property] ) && ! empty( $value[$property] ) ) { |
|
38 | + $this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $this->process_property_value( $property, $value[$property] ) . $output['suffix']; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | ); |
45 | 45 | |
46 | 46 | foreach ( $properties as $property ) { |
47 | - if ( ! isset( $value[ $property ] ) || ! $value[ $property ] ) { |
|
47 | + if ( ! isset( $value[$property] ) || ! $value[$property] ) { |
|
48 | 48 | continue; |
49 | 49 | } |
50 | 50 | if ( isset( $output['choice'] ) && $output['choice'] !== $property ) { |
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
54 | - $property_value = $this->process_property_value( $property, $value[ $property ] ); |
|
54 | + $property_value = $this->process_property_value( $property, $value[$property] ); |
|
55 | 55 | if ( 'font-family' === $property ) { |
56 | 56 | $value['font-backup'] = ( isset( $value['font-backup'] ) ) ? $value['font-backup'] : ''; |
57 | 57 | $property_value = $this->process_property_value( $property, array( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | $property = ( isset( $output['choice'] ) && isset( $output['property'] ) ) ? $output['property'] : $property; |
63 | 63 | $property_value = ( is_array( $property_value ) && isset( $property_value[0] ) ) ? $property_value[0] : $property_value; |
64 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $property_value . $output['suffix']; |
|
64 | + $this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $property_value . $output['suffix']; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->control_types = $this->default_control_types(); |
168 | 168 | foreach ( $this->control_types as $key => $classname ) { |
169 | 169 | if ( ! class_exists( $classname ) ) { |
170 | - unset( $this->control_types[ $key ] ); |
|
170 | + unset( $this->control_types[$key] ); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | foreach ( Kirki::$panels as $panel_args ) { |
196 | 196 | // Extra checks for nested panels. |
197 | 197 | if ( isset( $panel_args['panel'] ) ) { |
198 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
198 | + if ( isset( Kirki::$panels[$panel_args['panel']] ) ) { |
|
199 | 199 | // Set the type to nested. |
200 | 200 | $panel_args['type'] = 'kirki-nested'; |
201 | 201 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | foreach ( Kirki::$sections as $section_args ) { |
218 | 218 | // Extra checks for nested sections. |
219 | 219 | if ( isset( $section_args['section'] ) ) { |
220 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
220 | + if ( isset( Kirki::$sections[$section_args['section']] ) ) { |
|
221 | 221 | // Set the type to nested. |
222 | 222 | $section_args['type'] = 'kirki-nested'; |
223 | 223 | // We need to check if the parent section is nested inside a panel. |
224 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
224 | + $parent_section = Kirki::$sections[$section_args['section']]; |
|
225 | 225 | if ( isset( $parent_section['panel'] ) ) { |
226 | 226 | $section_args['panel'] = $parent_section['panel']; |
227 | 227 | } |
@@ -118,9 +118,9 @@ |
||
118 | 118 | // If we have a variable_callback defined then get the value of the option |
119 | 119 | // and run it through the callback function. |
120 | 120 | // If no callback is defined (false) then just get the value. |
121 | - $variables[ $variable_name ] = Kirki_Values::get_value( $field['settings'] ); |
|
121 | + $variables[$variable_name] = Kirki_Values::get_value( $field['settings'] ); |
|
122 | 122 | if ( $variable_callback ) { |
123 | - $variables[ $variable_name ] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
123 | + $variables[$variable_name] = call_user_func( $field_variable['callback'], Kirki_Values::get_value( $field['settings'] ) ); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
@@ -40,8 +40,8 @@ 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. |
@@ -83,43 +83,43 @@ discard block |
||
83 | 83 | $config_id = ( '' === $config_id ) ? 'global' : $config_id; |
84 | 84 | |
85 | 85 | // Fallback to 'global' if $config_id is not found. |
86 | - if ( ! isset( Kirki::$config[ $config_id ] ) ) { |
|
86 | + if ( ! isset( Kirki::$config[$config_id] ) ) { |
|
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'] : ''; |
|
116 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
|
115 | + $default_value = ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) ? Kirki::$fields[$field_id]['default'] : ''; |
|
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(). |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
145 | 145 | $all_values = get_option( $field['option_name'], array() ); |
146 | 146 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
147 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
148 | - $value = $all_values[ $sub_setting_id ]; |
|
147 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
148 | + $value = $all_values[$sub_setting_id]; |
|
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | |
161 | 161 | // Fix for https://github.com/aristath/kirki/issues/1405. |
162 | 162 | foreach ( array_keys( $this->json['value'] ) as $key ) { |
163 | - if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { |
|
164 | - unset( $this->json['value'][ $key ] ); |
|
163 | + if ( isset( $this->json['default'][$key] ) && false === $this->json['default'][$key] ) { |
|
164 | + unset( $this->json['value'][$key] ); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | $this->json['show_variants'] = ( true === Kirki_Fonts_Google::$force_load_all_variants ) ? false : true; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | if ( is_string( $variant ) ) { |
345 | 345 | $final_variants[] = array( |
346 | 346 | 'id' => $variant, |
347 | - 'label' => isset( $all_variants[ $variant ] ) ? $all_variants[ $variant ] : $variant, |
|
347 | + 'label' => isset( $all_variants[$variant] ) ? $all_variants[$variant] : $variant, |
|
348 | 348 | ); |
349 | 349 | } elseif ( is_array( $variant ) && isset( $variant['id'] ) && isset( $variant['label'] ) ) { |
350 | 350 | $final_variants[] = $variant; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if ( array_key_exists( $variant, $all_variants ) ) { |
420 | 420 | $available_variants[] = array( |
421 | 421 | 'id' => $variant, |
422 | - 'label' => $all_variants[ $variant ], |
|
422 | + 'label' => $all_variants[$variant], |
|
423 | 423 | ); |
424 | 424 | } |
425 | 425 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | if ( array_key_exists( $subset, $all_subsets ) ) { |
432 | 432 | $available_subsets[] = array( |
433 | 433 | 'id' => $subset, |
434 | - 'label' => $all_subsets[ $subset ], |
|
434 | + 'label' => $all_subsets[$subset], |
|
435 | 435 | ); |
436 | 436 | } |
437 | 437 | } |