@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->control_types = $this->default_control_types( apply_filters( 'kirki/control_types', $this->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 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | foreach ( Kirki::$panels as $panel_args ) { |
194 | 194 | // Extra checks for nested panels. |
195 | 195 | if ( isset( $panel_args['panel'] ) ) { |
196 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
196 | + if ( isset( Kirki::$panels[$panel_args['panel']] ) ) { |
|
197 | 197 | // Set the type to nested. |
198 | 198 | $panel_args['type'] = 'kirki-nested'; |
199 | 199 | } |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | foreach ( Kirki::$sections as $section_args ) { |
216 | 216 | // Extra checks for nested sections. |
217 | 217 | if ( isset( $section_args['section'] ) ) { |
218 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
218 | + if ( isset( Kirki::$sections[$section_args['section']] ) ) { |
|
219 | 219 | // Set the type to nested. |
220 | 220 | $section_args['type'] = 'kirki-nested'; |
221 | 221 | // We need to check if the parent section is nested inside a panel. |
222 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
222 | + $parent_section = Kirki::$sections[$section_args['section']]; |
|
223 | 223 | if ( isset( $parent_section['panel'] ) ) { |
224 | 224 | $section_args['panel'] = $parent_section['panel']; |
225 | 225 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Check if we've got it cached and ready. |
67 | - if ( isset( $this->cached_paths[ $class_name ] ) && file_exists( $this->cached_paths[ $class_name ] ) ) { |
|
68 | - include_once $this->cached_paths[ $class_name ]; |
|
67 | + if ( isset( $this->cached_paths[$class_name] ) && file_exists( $this->cached_paths[$class_name] ) ) { |
|
68 | + include_once $this->cached_paths[$class_name]; |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | foreach ( $paths as $path ) { |
75 | 75 | $path = wp_normalize_path( $path ); |
76 | 76 | if ( file_exists( $path ) ) { |
77 | - $this->cached_paths[ $class_name ] = $path; |
|
77 | + $this->cached_paths[$class_name] = $path; |
|
78 | 78 | include_once $path; |
79 | 79 | return; |
80 | 80 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | |
135 | 135 | $previous_path = ''; |
136 | 136 | for ( $i = 0; $i < $levels; $i++ ) { |
137 | - $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[ $i ] ) . '/' . $filename; |
|
138 | - $previous_path .= strtolower( $exploded[ $i ] ) . '/'; |
|
137 | + $paths[] = dirname( __FILE__ ) . '/' . $previous_path . strtolower( $exploded[$i] ) . '/' . $filename; |
|
138 | + $previous_path .= strtolower( $exploded[$i] ) . '/'; |
|
139 | 139 | } |
140 | 140 | return $paths; |
141 | 141 | } |
@@ -130,8 +130,8 @@ |
||
130 | 130 | // Are we force-loading all subsets? |
131 | 131 | if ( true === Kirki_Fonts_Google::$force_load_all_subsets ) { |
132 | 132 | |
133 | - if ( isset( $this->googlefonts->fonts[ $font ]['subsets'] ) ) { |
|
134 | - foreach ( $this->googlefonts->fonts[ $font ]['subsets'] as $subset ) { |
|
133 | + if ( isset( $this->googlefonts->fonts[$font]['subsets'] ) ) { |
|
134 | + foreach ( $this->googlefonts->fonts[$font]['subsets'] as $subset ) { |
|
135 | 135 | $this->subsets[] = $subset; |
136 | 136 | } |
137 | 137 | } |
@@ -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 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $replacement = ( false === $replacement || null === $replacement ) ? '' : $replacement; |
118 | 118 | if ( is_array( $value ) ) { |
119 | 119 | foreach ( $value as $k => $v ) { |
120 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
120 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
121 | 121 | } |
122 | 122 | return $value; |
123 | 123 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | // If 'choice' is defined check for sub-values too. |
164 | 164 | // Fixes https://github.com/aristath/kirki/issues/1416. |
165 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
165 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
166 | 166 | $skip = true; |
167 | 167 | } |
168 | 168 | } |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | 'background', |
221 | 221 | ); |
222 | 222 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
223 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
224 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
223 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
224 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
225 | 225 | } |
226 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
226 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
227 | 227 | return; |
228 | 228 | } |
229 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
229 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
247 | 247 | ) ); |
248 | 248 | if ( array_key_exists( $property, $properties ) ) { |
249 | - $classname = $properties[ $property ]; |
|
249 | + $classname = $properties[$property]; |
|
250 | 250 | $obj = new $classname( $property, $value ); |
251 | 251 | return $obj->get_value(); |
252 | 252 | } |
@@ -31,8 +31,8 @@ |
||
31 | 31 | |
32 | 32 | foreach ( array( 'image', 'color', 'repeat', 'position', 'size', 'attachment' ) as $key ) { |
33 | 33 | $key = 'background-' . $key; |
34 | - if ( isset( $value[ $key ] ) && ! empty( $value[ $key ] ) ) { |
|
35 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $key ] = $output['prefix'] . $this->process_property_value( $key, $value[ $key ] ) . $output['suffix']; |
|
34 | + if ( isset( $value[$key] ) && ! empty( $value[$key] ) ) { |
|
35 | + $this->styles[$output['media_query']][$output['element']][$key] = $output['prefix'] . $this->process_property_value( $key, $value[$key] ) . $output['suffix']; |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
@@ -43,14 +43,14 @@ 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 | - switch ( Kirki::$config[ $config_id ]['option_type'] ) { |
|
50 | + switch ( Kirki::$config[$config_id]['option_type'] ) { |
|
51 | 51 | case 'option': |
52 | 52 | case 'site_option': |
53 | - $site_option = (bool) ( 'site_option' === Kirki::$config[ $config_id ] ); |
|
53 | + $site_option = (bool) ( 'site_option' === Kirki::$config[$config_id] ); |
|
54 | 54 | return apply_filters( 'kirki/values/get_value', self::get_from_option( $config_id, $field_id, $site_option ), $field_id ); |
55 | 55 | case 'user_meta': |
56 | 56 | $user_id = get_current_user_id(); |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | private static function get_from_theme_mod( $field_id ) { |
74 | 74 | // We're using theme_mods so just get the value using get_theme_mod. |
75 | 75 | $default_value = null; |
76 | - if ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) { |
|
77 | - $default_value = Kirki::$fields[ $field_id ]['default']; |
|
76 | + if ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) { |
|
77 | + $default_value = Kirki::$fields[$field_id]['default']; |
|
78 | 78 | } |
79 | 79 | return get_theme_mod( $field_id, $default_value ); |
80 | 80 | } |
@@ -92,29 +92,29 @@ discard block |
||
92 | 92 | */ |
93 | 93 | private static function get_from_option( $config_id, $field_id, $site_option = false ) { |
94 | 94 | $get_option = ( $site_option ) ? 'get_site_option' : 'get_option'; |
95 | - if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) { |
|
95 | + if ( '' !== Kirki::$config[$config_id]['option_name'] ) { |
|
96 | 96 | |
97 | - if ( false !== strpos( $field_id, Kirki::$config[ $config_id ]['option_name'] . '[' ) ) { |
|
98 | - $field_id = str_replace( array( Kirki::$config[ $config_id ]['option_name'], '[', ']' ), '', $field_id ); |
|
97 | + if ( false !== strpos( $field_id, Kirki::$config[$config_id]['option_name'] . '[' ) ) { |
|
98 | + $field_id = str_replace( array( Kirki::$config[$config_id]['option_name'], '[', ']' ), '', $field_id ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // Options are serialized as a single option in the db. |
102 | 102 | // We'll have to get the option and then get the item from the array. |
103 | - $options = $get_option( Kirki::$config[ $config_id ]['option_name'] ); |
|
103 | + $options = $get_option( Kirki::$config[$config_id]['option_name'] ); |
|
104 | 104 | |
105 | - if ( ! isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) { |
|
106 | - $field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']'; |
|
105 | + if ( ! isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'] ) ) { |
|
106 | + $field_id = Kirki::$config[$config_id]['option_name'] . '[' . $field_id . ']'; |
|
107 | 107 | } |
108 | - $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) ); |
|
108 | + $setting_modified = str_replace( ']', '', str_replace( Kirki::$config[$config_id]['option_name'] . '[', '', $field_id ) ); |
|
109 | 109 | |
110 | - $default_value = ( isset( Kirki::$fields[ $field_id ] ) && isset( Kirki::$fields[ $field_id ]['default'] ) ) ? Kirki::$fields[ $field_id ]['default'] : ''; |
|
111 | - $value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value; |
|
110 | + $default_value = ( isset( Kirki::$fields[$field_id] ) && isset( Kirki::$fields[$field_id]['default'] ) ) ? Kirki::$fields[$field_id]['default'] : ''; |
|
111 | + $value = ( isset( $options[$setting_modified] ) ) ? $options[$setting_modified] : $default_value; |
|
112 | 112 | $value = maybe_unserialize( $value ); |
113 | 113 | return apply_filters( 'kirki/values/get_value', $value, $field_id ); |
114 | 114 | } |
115 | 115 | |
116 | 116 | // Each option separately saved in the db. |
117 | - return $get_option( $field_id, Kirki::$fields[ $field_id ]['default'] ); |
|
117 | + return $get_option( $field_id, Kirki::$fields[$field_id]['default'] ); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) { |
134 | 134 | $all_values = get_option( $field['option_name'], array() ); |
135 | 135 | $sub_setting_id = str_replace( array( ']', $field['option_name'] . '[' ), '', $field['settings'] ); |
136 | - if ( isset( $all_values[ $sub_setting_id ] ) ) { |
|
137 | - $value = $all_values[ $sub_setting_id ]; |
|
136 | + if ( isset( $all_values[$sub_setting_id] ) ) { |
|
137 | + $value = $all_values[$sub_setting_id]; |
|
138 | 138 | } |
139 | 139 | } else { |
140 | 140 | $value = get_option( $field['settings'], $field['default'] ); |
@@ -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 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $property_parts = explode( '_', $property ); |
334 | 334 | } |
335 | 335 | foreach ( $property_parts as $property_part_k => $property_part_v ) { |
336 | - $property_parts[ $property_part_k ] = ucfirst( $property_part_v ); |
|
336 | + $property_parts[$property_part_k] = ucfirst( $property_part_v ); |
|
337 | 337 | } |
338 | 338 | return 'Kirki_Field_Property_' . implode( '_', $property_parts ); |
339 | 339 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
430 | 430 | /* translators: %1$s represents the field ID where the error occurs. */ |
431 | 431 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
432 | - unset( $this->partial_refresh[ $id ] ); |
|
432 | + unset( $this->partial_refresh[$id] ); |
|
433 | 433 | continue; |
434 | 434 | } |
435 | 435 | } |
@@ -457,10 +457,10 @@ discard block |
||
457 | 457 | } |
458 | 458 | $settings = array(); |
459 | 459 | foreach ( $this->settings as $setting_key => $setting_value ) { |
460 | - $settings[ $setting_key ] = $setting_value; |
|
460 | + $settings[$setting_key] = $setting_value; |
|
461 | 461 | // If we're using serialized options then we need to spice this up. |
462 | 462 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
463 | - $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
463 | + $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | $this->settings = $settings; |
@@ -585,17 +585,17 @@ discard block |
||
585 | 585 | } |
586 | 586 | foreach ( $this->output as $key => $output ) { |
587 | 587 | if ( empty( $output ) || ! isset( $output['element'] ) ) { |
588 | - unset( $this->output[ $key ] ); |
|
588 | + unset( $this->output[$key] ); |
|
589 | 589 | continue; |
590 | 590 | } |
591 | 591 | if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
592 | - $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
592 | + $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
593 | 593 | } |
594 | 594 | // Convert element arrays to strings. |
595 | 595 | if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
596 | - $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
597 | - sort( $this->output[ $key ]['element'] ); |
|
598 | - $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
596 | + $this->output[$key]['element'] = array_unique( $this->output[$key]['element'] ); |
|
597 | + sort( $this->output[$key]['element'] ); |
|
598 | + $this->output[$key]['element'] = implode( ',', $this->output[$key]['element'] ); |
|
599 | 599 | } |
600 | 600 | } |
601 | 601 | } |