@@ -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( $control_types[ $key ] ); |
|
| 170 | + unset( $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 | } |
@@ -67,9 +67,9 @@ |
||
| 67 | 67 | |
| 68 | 68 | // Make sure that every row is an array, not an object. |
| 69 | 69 | foreach ( $sanitized as $key => $_value ) { |
| 70 | - $sanitized[ $key ] = (array) $_value; |
|
| 70 | + $sanitized[$key] = (array) $_value; |
|
| 71 | 71 | if ( empty( $_value ) ) { |
| 72 | - unset( $sanitized[ $key ] ); |
|
| 72 | + unset( $sanitized[$key] ); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -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[ $font ]['subsets'] ) ) { |
|
| 134 | - foreach ( $this->googlefonts[ $font ]['subsets'] as $subset ) { |
|
| 133 | + if ( isset( $this->googlefonts[$font]['subsets'] ) ) { |
|
| 134 | + foreach ( $this->googlefonts[$font]['subsets'] as $subset ) { |
|
| 135 | 135 | $this->subsets[] = $subset; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -101,19 +101,19 @@ 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 ( $value as $k => $v ) { |
| 108 | - $value[ $k ] = str_replace( '$', $value[ $k ], $output['value_pattern'] ); |
|
| 108 | + $value[$k] = str_replace( '$', $value[$k], $output['value_pattern'] ); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) { |
| 113 | 113 | $option_type = 'theme_mod'; |
| 114 | 114 | $option_name = false; |
| 115 | - if ( isset( Kirki::$config[ $this->config_id ] ) ) { |
|
| 116 | - $config = Kirki::$config[ $this->config_id ]; |
|
| 115 | + if ( isset( Kirki::$config[$this->config_id] ) ) { |
|
| 116 | + $config = Kirki::$config[$this->config_id]; |
|
| 117 | 117 | $option_type = ( isset( $config['option_type'] ) ) ? $config['option_type'] : 'theme_mod'; |
| 118 | 118 | if ( 'option' === $option_type || 'site_option' === $option_type ) { |
| 119 | 119 | $option_name = ( isset( $config['option_name'] ) ) ? $config['option_name'] : false; |
@@ -130,16 +130,16 @@ discard block |
||
| 130 | 130 | if ( is_array( $options ) ) { |
| 131 | 131 | if ( $option_name ) { |
| 132 | 132 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
| 133 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
| 133 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
| 134 | 134 | break; |
| 135 | 135 | } |
| 136 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
| 136 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | $replacement = get_option( $replace ); |
| 140 | 140 | break; |
| 141 | 141 | case 'site_option': |
| 142 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
| 142 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
| 143 | 143 | break; |
| 144 | 144 | case 'user_meta': |
| 145 | 145 | $user_id = get_current_user_id(); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $replacement = ( false === $replacement ) ? '' : $replacement; |
| 155 | 155 | if ( is_array( $value ) ) { |
| 156 | 156 | foreach ( $value as $k => $v ) { |
| 157 | - $value[ $k ] = str_replace( $search, $replacement, $value[ $v ] ); |
|
| 157 | + $value[$k] = str_replace( $search, $replacement, $value[$v] ); |
|
| 158 | 158 | } |
| 159 | 159 | return $value; |
| 160 | 160 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | // If 'choice' is defined check for sub-values too. |
| 201 | 201 | // Fixes https://github.com/aristath/kirki/issues/1416. |
| 202 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
| 202 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
| 203 | 203 | $skip = true; |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -257,13 +257,13 @@ discard block |
||
| 257 | 257 | 'background', |
| 258 | 258 | ); |
| 259 | 259 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
| 260 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
| 261 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
| 260 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
| 261 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
| 262 | 262 | } |
| 263 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 263 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 264 | 264 | return; |
| 265 | 265 | } |
| 266 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 266 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
| 284 | 284 | ) ); |
| 285 | 285 | if ( array_key_exists( $property, $properties ) ) { |
| 286 | - $classname = $properties[ $property ]; |
|
| 286 | + $classname = $properties[$property]; |
|
| 287 | 287 | $obj = new $classname( $property, $value ); |
| 288 | 288 | return $obj->get_value(); |
| 289 | 289 | } |
@@ -335,13 +335,13 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | // Get the config arguments, and merge them with the defaults. |
| 337 | 337 | $config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array(); |
| 338 | - if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) { |
|
| 339 | - $config_defaults = Kirki::$config[ $this->kirki_config ]; |
|
| 338 | + if ( 'global' !== $this->kirki_config && isset( Kirki::$config[$this->kirki_config] ) ) { |
|
| 339 | + $config_defaults = Kirki::$config[$this->kirki_config]; |
|
| 340 | 340 | } |
| 341 | 341 | $config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array(); |
| 342 | 342 | foreach ( $config_defaults as $key => $value ) { |
| 343 | - if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value != $defaults[ $key ] ) { |
|
| 344 | - $defaults[ $key ] = $value; |
|
| 343 | + if ( isset( $defaults[$key] ) && ! empty( $value ) && $value != $defaults[$key] ) { |
|
| 344 | + $defaults[$key] = $value; |
|
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
@@ -392,11 +392,11 @@ discard block |
||
| 392 | 392 | // Get all arguments with their values. |
| 393 | 393 | $args = get_object_vars( $this ); |
| 394 | 394 | foreach ( $args as $key => $default_value ) { |
| 395 | - $args[ $key ] = $this->$key; |
|
| 395 | + $args[$key] = $this->$key; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | // Add the field to the static $fields variable properly indexed. |
| 399 | - Kirki::$fields[ $this->settings ] = $args; |
|
| 399 | + Kirki::$fields[$this->settings] = $args; |
|
| 400 | 400 | |
| 401 | 401 | } |
| 402 | 402 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
| 541 | 541 | /* translators: %1$s represents the field ID where the error occurs. */ |
| 542 | 542 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
| 543 | - unset( $this->partial_refresh[ $id ] ); |
|
| 543 | + unset( $this->partial_refresh[$id] ); |
|
| 544 | 544 | continue; |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -568,10 +568,10 @@ discard block |
||
| 568 | 568 | } |
| 569 | 569 | $settings = array(); |
| 570 | 570 | foreach ( $this->settings as $setting_key => $setting_value ) { |
| 571 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $setting_value ); |
|
| 571 | + $settings[sanitize_key( $setting_key )] = esc_attr( $setting_value ); |
|
| 572 | 572 | // If we're using serialized options then we need to spice this up. |
| 573 | 573 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
| 574 | - $settings[ sanitize_key( $setting_key ) ] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
| 574 | + $settings[sanitize_key( $setting_key )] = esc_attr( $this->option_name ) . '[' . esc_attr( $setting_value ) . ']'; |
|
| 575 | 575 | } |
| 576 | 576 | } |
| 577 | 577 | $this->settings = $settings; |