使WordPress成为核心

变更集54323


忽略:
时间戳:
2022年9月27日上午07:38:40(21个月(之前)
作者:
吉奥罗牌手表
消息:

块:修复没有文件的核心样式的404错误

[54155]破坏了style.css文件的加载,即将前端不存在的style.css文档排队,导致404个HTTO错误。核心块不存在所有这些style.css文件,因为它们应该是没有文件路径的注册样式处理程序。

后续行动[54155].
Props tobiasbg,nendeb55号。
修复#56408,#56614.

文件:
1编辑

图例:

未修改
补充
远离的
  • trunk/src/wp-includes/blocks.php

    54309兰特 54323兰特  
    209209
    210210//检查样式是否应该有“.min”后缀。
    211 $后缀=SCRIPT_DEBUG?“:”。最小值';
    212 $style_uri=插件url($style_path,$metadata['file']);
     211$后缀=SCRIPT_DEBUG?“:”。最小值';
    213212if($is_core_block){
    214213$style_path=“style$suffix.css”;
    215 $style_uri=includes_url(“blocks/”.str_replace(“core/”,“”,$metadata[“name”])。“/style$suffix.css”);
    216     }
    217 
     214    }
    218215$style_path_norm=wp_normalize_path(realpath(目录名($metadata['file']).'/')$样式路径);
    219 $is_theme_block=0==strpos($style_path_norm,$theme_path_norm);
    220 
    221 if($is_theme_block){
    222 $style_uri=获取_theme_file_uri(str_replace($theme_path_norm,'',$style_path_norm));
    223     }
    224 
    225 $style_handle=生成块资产句柄($metadata[“名称”],$field_name,$index);
    226 $has_style_file=false!==$样式路径形式;
    227 $版本=$is_core_block&&isset($metadata['version'])$元数据[“版本”]:false;
    228 $style_uri=$has_style_file$style_uri:false;
    229 $结果=wp_register_style(
     216$has_style_file=''!==$样式路径形式;
     217if($has_style_file){
     218$style_uri=插件url($style_path,$metadata['file']);
     219$is_theme_block=str_starts_with($style_path_norm,$theme_path_norm);
     220if($is_theme_block){
     221$style_uri=获取_theme_file_uri(str_replace($theme_path_norm,'',$style_path_norm));
     222}elseif($is_core_block){
     223$style_uri=includes_url('blocks/'.str_replace('core/','',$metadata['name'])。“/style$suffix.css”);
     224        }
     225}其他{
     226$style_uri=假;
     227    }
     228
     229$style_handle=生成块资产句柄($metadata[“名称”],$field_name,$index);
     230$版本=$is_core_block&&isset($metadata['version'])$元数据[“版本”]:false;
     231$结果=wp_register_style(
    230232$style_handle,
    231233$style_uri,
     
    233235$版本
    234236    );
    235 if(file_exists(str_replace('.css','-rtl.css',$style_path_norm)){
    236 wp_style_add_data($style_handle,'rtl','replace');
    237 }
     237if(!$result){
     238返回false;
     239    }
     240
    238241if($has_style_file){
     242if(file_exists(str_replace('.css','-rtl.css',$style_path_norm)){
     243wp_style_add_data($style_handle,'rtl','replace');
     244        }
     245
    239246wp_style_add_data($style_handle,'path',$style_path_norm);
    240     }
    241 
    242    $rtl_file=str_replace(“$suffix.css”,“-rtl$suffix.css”,$style_path_norm);
    243    if(is_rtl()&&file_exists($rtl_file)){
    244        wp_style_add_data($style_handle,'path',$rtl_file);
    245     }
    246 
    247 返回$结果如何$样式句柄:false;
     247
     248$rtl_file=str_replace(“{$suffix}.css”,“-rtl{$subsix}.css”,$style_path_norm);
     249   if(is_rtl()&&file_exists($rtl_file)){
     250   wp_style_add_data($style_handle,'path',$rtl_file);
     251       }
     252}
     253
     254返回$样式句柄e;
    248255}
    249256
注:请参见TracChangeset(跟踪变更集)获取有关使用变更集查看器的帮助。