Changeset 59253
- Timestamp:
- 10/18/2024 02:24:46 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r59213 r59253 2315 2315 */ 2316 2316 protected static function compute_style_properties( $styles, $settings = array(), $properties = null, $theme_json = null, $selector = null, $use_root_padding = null ) { 2317 if ( empty( $styles ) ) { 2318 return array(); 2319 } 2320 2317 2321 if ( null === $properties ) { 2318 2322 $properties = static::PROPERTIES_METADATA; 2319 2323 } 2320 2321 $declarations = array(); 2322 if ( empty( $styles ) ) { 2323 return $declarations; 2324 } 2325 2324 $declarations = array(); 2326 2325 $root_variable_duplicates = array(); 2326 $root_style_length = strlen( '--wp--style--root--' ); 2327 2327 2328 2328 foreach ( $properties as $css_property => $value_path ) { 2329 if ( ! is_array( $value_path ) ) { 2330 continue; 2331 } 2332 2333 $is_root_style = str_starts_with( $css_property, '--wp--style--root--' ); 2334 if ( $is_root_style && ( static::ROOT_BLOCK_SELECTOR !== $selector || ! $use_root_padding ) ) { 2335 continue; 2336 } 2337 2329 2338 $value = static::get_property_value( $styles, $value_path, $theme_json ); 2330 2339 2331 if ( str_starts_with( $css_property, '--wp--style--root--' ) && ( static::ROOT_BLOCK_SELECTOR !== $selector || ! $use_root_padding ) ) {2332 continue;2333 }2334 2340 /* 2335 2341 * Root-level padding styles don't currently support strings with CSS shorthand values. … … 2340 2346 } 2341 2347 2342 if ( str_starts_with( $css_property, '--wp--style--root--' ) && $use_root_padding ) { 2343 $root_variable_duplicates[] = substr( $css_property, strlen( '--wp--style--root--' ) ); 2344 } 2345 2346 /* 2347 * Look up protected properties, keyed by value path. 2348 * Skip protected properties that are explicitly set to `null`. 2349 */ 2350 if ( is_array( $value_path ) ) { 2351 $path_string = implode( '.', $value_path ); 2352 if ( 2353 isset( static::PROTECTED_PROPERTIES[ $path_string ] ) && 2354 _wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null 2355 ) { 2356 continue; 2357 } 2348 if ( $is_root_style && $use_root_padding ) { 2349 $root_variable_duplicates[] = substr( $css_property, $root_style_length ); 2358 2350 } 2359 2351 … … 2384 2376 $has_missing_value = empty( $value ) && ! is_numeric( $value ); 2385 2377 if ( $has_missing_value || is_array( $value ) ) { 2378 continue; 2379 } 2380 2381 /* 2382 * Look up protected properties, keyed by value path. 2383 * Skip protected properties that are explicitly set to `null`. 2384 */ 2385 $path_string = implode( '.', $value_path ); 2386 if ( 2387 isset( static::PROTECTED_PROPERTIES[ $path_string ] ) && 2388 _wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null 2389 ) { 2386 2390 continue; 2387 2391 }
Note: See TracChangeset
for help on using the changeset viewer.