@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | foreach ( Kirki::$panels as $panel_args ) { |
| 189 | 189 | // Extra checks for nested panels. |
| 190 | 190 | if ( isset( $panel_args['panel'] ) ) { |
| 191 | - if ( isset( Kirki::$panels[ $panel_args['panel'] ] ) ) { |
|
| 191 | + if ( isset( Kirki::$panels[$panel_args['panel']] ) ) { |
|
| 192 | 192 | // Set the type to nested. |
| 193 | 193 | $panel_args['type'] = 'kirki-nested'; |
| 194 | 194 | } |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | foreach ( Kirki::$sections as $section_args ) { |
| 211 | 211 | // Extra checks for nested sections. |
| 212 | 212 | if ( isset( $section_args['section'] ) ) { |
| 213 | - if ( isset( Kirki::$sections[ $section_args['section'] ] ) ) { |
|
| 213 | + if ( isset( Kirki::$sections[$section_args['section']] ) ) { |
|
| 214 | 214 | // Set the type to nested. |
| 215 | 215 | $section_args['type'] = 'kirki-nested'; |
| 216 | 216 | // We need to check if the parent section is nested inside a panel. |
| 217 | - $parent_section = Kirki::$sections[ $section_args['section'] ]; |
|
| 217 | + $parent_section = Kirki::$sections[$section_args['section']]; |
|
| 218 | 218 | if ( isset( $parent_section['panel'] ) ) { |
| 219 | 219 | $section_args['panel'] = $parent_section['panel']; |
| 220 | 220 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | $class_name = 'WP_Customize_Control'; |
| 69 | 69 | // Get the classname from the array of control classnames. |
| 70 | 70 | if ( array_key_exists( $args['type'], $this->control_types ) ) { |
| 71 | - $class_name = $this->control_types[ $args['type'] ]; |
|
| 71 | + $class_name = $this->control_types[$args['type']]; |
|
| 72 | 72 | } |
| 73 | 73 | return $class_name; |
| 74 | 74 | |
@@ -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 | /** |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) { |
| 407 | 407 | /* translators: %1$s represents the field ID where the error occurs. */ |
| 408 | 408 | _doing_it_wrong( __METHOD__, sprintf( esc_attr__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_attr( $this->settings ) ), '3.0.10' ); |
| 409 | - unset( $this->partial_refresh[ $id ] ); |
|
| 409 | + unset( $this->partial_refresh[$id] ); |
|
| 410 | 410 | continue; |
| 411 | 411 | } |
| 412 | 412 | } |
@@ -434,10 +434,10 @@ discard block |
||
| 434 | 434 | } |
| 435 | 435 | $settings = array(); |
| 436 | 436 | foreach ( $this->settings as $setting_key => $setting_value ) { |
| 437 | - $settings[ $setting_key ] = $setting_value; |
|
| 437 | + $settings[$setting_key] = $setting_value; |
|
| 438 | 438 | // If we're using serialized options then we need to spice this up. |
| 439 | 439 | if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) { |
| 440 | - $settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]"; |
|
| 440 | + $settings[$setting_key] = "{$this->option_name}[{$setting_value}]"; |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | $this->settings = $settings; |
@@ -566,17 +566,17 @@ discard block |
||
| 566 | 566 | } |
| 567 | 567 | foreach ( $this->output as $key => $output ) { |
| 568 | 568 | if ( empty( $output ) || ! isset( $output['element'] ) ) { |
| 569 | - unset( $this->output[ $key ] ); |
|
| 569 | + unset( $this->output[$key] ); |
|
| 570 | 570 | continue; |
| 571 | 571 | } |
| 572 | 572 | if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) { |
| 573 | - $this->output[ $key ]['sanitize_callback'] = $output['callback']; |
|
| 573 | + $this->output[$key]['sanitize_callback'] = $output['callback']; |
|
| 574 | 574 | } |
| 575 | 575 | // Convert element arrays to strings. |
| 576 | 576 | if ( isset( $output['element'] ) && is_array( $output['element'] ) ) { |
| 577 | - $this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] ); |
|
| 578 | - sort( $this->output[ $key ]['element'] ); |
|
| 579 | - $this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] ); |
|
| 577 | + $this->output[$key]['element'] = array_unique( $this->output[$key]['element'] ); |
|
| 578 | + sort( $this->output[$key]['element'] ); |
|
| 579 | + $this->output[$key]['element'] = implode( ',', $this->output[$key]['element'] ); |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | foreach ( Kirki::$fields as $field ) { |
| 78 | 78 | if ( isset( $field['tooltip'] ) && ! empty( $field['tooltip'] ) ) { |
| 79 | - $this->tooltips_content[ $field['settings'] ] = array( |
|
| 79 | + $this->tooltips_content[$field['settings']] = array( |
|
| 80 | 80 | 'id' => str_replace( array( '[', ']' ), array( '-', '' ), $field['settings'] ), |
| 81 | 81 | 'content' => wp_kses_post( $field['tooltip'] ), |
| 82 | 82 | ); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function add_tooltip( $field_id, $tooltip ) { |
| 96 | 96 | |
| 97 | - $this->tooltips_content[ $field_id ] = array( |
|
| 97 | + $this->tooltips_content[$field_id] = array( |
|
| 98 | 98 | 'id' => sanitize_key( $field_id ), |
| 99 | 99 | 'content' => wp_kses_post( $tooltip ), |
| 100 | 100 | ); |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | return $value; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if ( is_array( $value ) && isset( $output['choice'] ) && isset( $this->value[ $output['choice'] ] ) ) { |
|
| 84 | - $value[ $output['choice'] ] = call_user_func( $output['sanitize_callback'], $this->value[ $output['choice'] ] ); |
|
| 83 | + if ( is_array( $value ) && isset( $output['choice'] ) && isset( $this->value[$output['choice']] ) ) { |
|
| 84 | + $value[$output['choice']] = call_user_func( $output['sanitize_callback'], $this->value[$output['choice']] ); |
|
| 85 | 85 | return $value; |
| 86 | 86 | } |
| 87 | 87 | return call_user_func( $output['sanitize_callback'], $this->value ); |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | if ( is_array( $value ) ) { |
| 108 | 108 | foreach ( array_keys( $value ) as $value_k ) { |
| 109 | - if ( ! is_string( $value[ $value_k ] ) ) { |
|
| 109 | + if ( ! is_string( $value[$value_k] ) ) { |
|
| 110 | 110 | continue; |
| 111 | 111 | } |
| 112 | 112 | if ( isset( $output['choice'] ) ) { |
| 113 | 113 | if ( $output['choice'] === $value_k ) { |
| 114 | - $value[ $output['choice'] ] = str_replace( '$', $value[ $output['choice'] ], $output['value_pattern'] ); |
|
| 114 | + $value[$output['choice']] = str_replace( '$', $value[$output['choice']], $output['value_pattern'] ); |
|
| 115 | 115 | } |
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | - $value[ $value_k ] = str_replace( '$', $value[ $value_k ], $output['value_pattern'] ); |
|
| 118 | + $value[$value_k] = str_replace( '$', $value[$value_k], $output['value_pattern'] ); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | $value = $this->apply_pattern_replace( $output, $value ); |
@@ -145,16 +145,16 @@ discard block |
||
| 145 | 145 | if ( is_array( $options ) ) { |
| 146 | 146 | if ( $option_name ) { |
| 147 | 147 | $subkey = str_replace( array( $option_name, '[', ']' ), '', $replace ); |
| 148 | - $replacement = ( isset( $options[ $subkey ] ) ) ? $options[ $subkey ] : ''; |
|
| 148 | + $replacement = ( isset( $options[$subkey] ) ) ? $options[$subkey] : ''; |
|
| 149 | 149 | break; |
| 150 | 150 | } |
| 151 | - $replacement = ( isset( $options[ $replace ] ) ) ? $options[ $replace ] : ''; |
|
| 151 | + $replacement = ( isset( $options[$replace] ) ) ? $options[$replace] : ''; |
|
| 152 | 152 | break; |
| 153 | 153 | } |
| 154 | 154 | $replacement = get_option( $replace ); |
| 155 | 155 | break; |
| 156 | 156 | case 'site_option': |
| 157 | - $replacement = ( is_array( $options ) && isset( $options[ $replace ] ) ) ? $options[ $replace ] : get_site_option( $replace ); |
|
| 157 | + $replacement = ( is_array( $options ) && isset( $options[$replace] ) ) ? $options[$replace] : get_site_option( $replace ); |
|
| 158 | 158 | break; |
| 159 | 159 | case 'user_meta': |
| 160 | 160 | $user_id = get_current_user_id(); |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | foreach ( $value as $k => $v ) { |
| 172 | 172 | if ( isset( $output['choice'] ) ) { |
| 173 | 173 | if ( $k === $output['choice'] ) { |
| 174 | - $value[ $k ] = str_replace( $search, $replacement, $v ); |
|
| 174 | + $value[$k] = str_replace( $search, $replacement, $v ); |
|
| 175 | 175 | } |
| 176 | 176 | continue; |
| 177 | 177 | } |
| 178 | - $value[ $k ] = str_replace( $search, $replacement, $v ); |
|
| 178 | + $value[$k] = str_replace( $search, $replacement, $v ); |
|
| 179 | 179 | } |
| 180 | 180 | return $value; |
| 181 | 181 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | // If 'choice' is defined check for sub-values too. |
| 219 | 219 | // Fixes https://github.com/aristath/kirki/issues/1416. |
| 220 | - if ( isset( $output['choice'] ) && isset( $value[ $output['choice'] ] ) && $exclude == $value[ $output['choice'] ] ) { |
|
| 220 | + if ( isset( $output['choice'] ) && isset( $value[$output['choice']] ) && $exclude == $value[$output['choice']] ) { |
|
| 221 | 221 | $skip = true; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -275,13 +275,13 @@ discard block |
||
| 275 | 275 | 'background', |
| 276 | 276 | ); |
| 277 | 277 | if ( in_array( $output['property'], $accepts_multiple, true ) ) { |
| 278 | - if ( isset( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) && ! is_array( $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] ) ) { |
|
| 279 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = (array) $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ]; |
|
| 278 | + if ( isset( $this->styles[$output['media_query']][$output['element']][$output['property']] ) && ! is_array( $this->styles[$output['media_query']][$output['element']][$output['property']] ) ) { |
|
| 279 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = (array) $this->styles[$output['media_query']][$output['element']][$output['property']]; |
|
| 280 | 280 | } |
| 281 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 281 | + $this->styles[$output['media_query']][$output['element']][$output['property']][] = $output['prefix'] . $value . $output['units'] . $output['suffix']; |
|
| 282 | 282 | return; |
| 283 | 283 | } |
| 284 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
| 284 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['units'] . $output['suffix']; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | 'background-position' => 'Kirki_Output_Property_Background_Position', |
| 302 | 302 | ) ); |
| 303 | 303 | if ( array_key_exists( $property, $properties ) ) { |
| 304 | - $classname = $properties[ $property ]; |
|
| 304 | + $classname = $properties[$property]; |
|
| 305 | 305 | $obj = new $classname( $property, $value ); |
| 306 | 306 | return $obj->get_value(); |
| 307 | 307 | } |
@@ -45,13 +45,13 @@ |
||
| 45 | 45 | if ( false !== strpos( $output['property'], '%%' ) ) { |
| 46 | 46 | $property = str_replace( '%%', $key, $output['property'] ); |
| 47 | 47 | } |
| 48 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $property ] = $output['prefix'] . $this->process_property_value( $property, $value[ $key ] ) . $output['suffix']; |
|
| 48 | + $this->styles[$output['media_query']][$output['element']][$property] = $output['prefix'] . $this->process_property_value( $property, $value[$key] ) . $output['suffix']; |
|
| 49 | 49 | } |
| 50 | 50 | } elseif ( isset( $output['choice'] ) ) { |
| 51 | 51 | if ( false !== strpos( $output['property'], '%%' ) ) { |
| 52 | 52 | $output['property'] = str_replace( '%%', $key, $output['property'] ); |
| 53 | 53 | } |
| 54 | - $this->styles[ $output['media_query'] ][ $output['element'] ][ $output['property'] ] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['suffix']; |
|
| 54 | + $this->styles[$output['media_query']][$output['element']][$output['property']] = $output['prefix'] . $this->process_property_value( $output['property'], $value ) . $output['suffix']; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | } |