diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
index f5b8b47e5e..4f36a87f0f 100644
|
a
|
b
|
function register_block_script_handle( $metadata, $field_name ) {
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $script_handle = generate_block_asset_handle( $metadata['name'], $field_name ); |
| 86 | | $script_asset_path = realpath( |
| | 86 | $script_asset_path = wp_normalize_path( realpath( |
| 87 | 87 | dirname( $metadata['file'] ) . '/' . |
| 88 | 88 | substr_replace( $script_path, '.asset.php', - strlen( '.js' ) ) |
| 89 | | ); |
| | 89 | ) ); |
| 90 | 90 | if ( ! file_exists( $script_asset_path ) ) { |
| 91 | 91 | _doing_it_wrong( |
| 92 | 92 | __FUNCTION__, |
| … |
… |
function register_block_script_handle( $metadata, $field_name ) {
|
| 100 | 100 | ); |
| 101 | 101 | return false; |
| 102 | 102 | } |
| 103 | | $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC ); |
| | 103 | // Path needs to be normalized to work in Windows env. |
| | 104 | $wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC ); |
| | 105 | $script_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $script_path ) ); |
| | 106 | $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm ); |
| | 107 | |
| 104 | 108 | $script_uri = $is_core_block ? |
| 105 | | includes_url( str_replace( ABSPATH . WPINC, '', realpath( dirname( $metadata['file'] ) . '/' . $script_path ) ) ) : |
| | 109 | includes_url( str_replace( $wpinc_path_norm, '', $script_path_norm ) ): |
| 106 | 110 | plugins_url( $script_path, $metadata['file'] ); |
| 107 | 111 | $script_asset = require $script_asset_path; |
| 108 | 112 | $script_dependencies = isset( $script_asset['dependencies'] ) ? $script_asset['dependencies'] : array(); |
| … |
… |
function register_block_style_handle( $metadata, $field_name ) {
|
| 139 | 143 | if ( empty( $metadata[ $field_name ] ) ) { |
| 140 | 144 | return false; |
| 141 | 145 | } |
| 142 | | $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC ); |
| | 146 | $wpinc_path_norm = wp_normalize_path( ABSPATH . WPINC ); |
| | 147 | $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], $wpinc_path_norm ); |
| 143 | 148 | if ( $is_core_block && ! wp_should_load_separate_core_block_assets() ) { |
| 144 | 149 | return false; |
| 145 | 150 | } |
| … |
… |
function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
|
| 232 | 237 | if ( ! is_array( $metadata ) || empty( $metadata['name'] ) ) { |
| 233 | 238 | return false; |
| 234 | 239 | } |
| 235 | | $metadata['file'] = $metadata_file; |
| | 240 | $metadata['file'] = wp_normalize_path( $metadata_file ); |
| 236 | 241 | |
| 237 | 242 | /** |
| 238 | 243 | * Filters the metadata provided for registering a block type. |