Changeset 52291
- Timestamp:
- 11/30/2021 08:00:09 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r52069 r52291 84 84 85 85 $script_handle = generate_block_asset_handle( $metadata['name'], $field_name ); 86 $script_asset_path = realpath( 87 dirname( $metadata['file'] ) . '/' . 88 substr_replace( $script_path, '.asset.php', - strlen( '.js' ) ) 86 $script_asset_path = wp_normalize_path( 87 realpath( 88 dirname( $metadata['file'] ) . '/' . 89 substr_replace( $script_path, '.asset.php', - strlen( '.js' ) ) 90 ) 89 91 ); 90 92 if ( ! file_exists( $script_asset_path ) ) { … … 101 103 return false; 102 104 } 103 $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC ); 105 // Path needs to be normalized to work in Windows env. 106 $wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC ); 107 $script_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $script_path ) ); 108 $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm ); 109 104 110 $script_uri = $is_core_block ? 105 includes_url( str_replace( ABSPATH . WPINC, '', realpath( dirname( $metadata['file'] ) . '/' . $script_path )) ) :111 includes_url( str_replace( $wpinc_path_norm, '', $script_path_norm ) ) : 106 112 plugins_url( $script_path, $metadata['file'] ); 107 113 $script_asset = require $script_asset_path; … … 140 146 return false; 141 147 } 142 $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC ); 148 $wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC ); 149 $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm ); 143 150 if ( $is_core_block && ! wp_should_load_separate_core_block_assets() ) { 144 151 return false; … … 233 240 return false; 234 241 } 235 $metadata['file'] = $metadata_file;242 $metadata['file'] = wp_normalize_path( $metadata_file ); 236 243 237 244 /**
Note: See TracChangeset
for help on using the changeset viewer.