使WordPress成为核心

变更集42880


忽略:
时间戳:
2018年3月27日12:53:20 AM(6年(之前)
作者:
谢尔盖·比尤科夫
消息:

格式:允许使用文本转换在里面安全_过滤器_属性()

为添加单元测试安全_过滤器_属性()

比尔吉雷道具,juiiee8487,danielbachhuber。
修复#42729

位置:
大旅行箱
文件:
2编辑

图例:

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

    42860兰特 42880兰特  
    19651965*@自4.4.0起增加了对“min-height`、max-height'、min-width`和max-width”的支持。
    19661966*@自4.6.0起增加了对“list-style-type”的支持。
     1967*@自5.0.0起添加了对“文本转换”的支持。
    19671968     *
    19681969*@param array$attr允许的CSS属性列表。
     
    20072008'字母间距',
    20082009'线条高度',
     2010'文本对齐',
    20092011'文本删除',
    20102012'文本相关',
    2011 '文本-对齐',
     2013'文本-转型',
    20122014
    20132015“高度”,
  • trunk/tests/phpunit/tests/kses.php

    42860兰特 42880兰特  
    733733$this->assertEquals(“<{$element}>”,wp_kses_attr($element,$attribute,array('foo'=>false),array());
    734734    }
     735
     736    /**
     737*测试safecss_filter_attr()函数。
     738     *
     739*@票42729
     740*@dataProvider data_test_safecss_filter_attr
     741     *
     742*@param string$css css规则的字符串。
     743*@param string$应为CSS规则的预期字符串。
     744     */
     745公共函数test_safecss_filter_attr($css,$expected){
     746$this->assertSame($expected,safecss_filter_attr($css));
     747    }
     748
     749    /**
     750*test_safecss_filter_attr()的数据提供程序。
     751     *
     752*@return数组{
     753*@类型数组{
     754*@string string$css css规则字符串。
     755*@string string$应为CSS规则的预期字符串。
     756     *     }
     757     * }
     758     */
     759公共函数data_test_safecss_filter_attr(){
     760返回数组(
     761//输入为空,输出为空。
     762阵列(
     763“css”=>“”,
     764“预期”=>“”,
     765            ),
     766//不允许使用任意属性名。
     767阵列(
     768“css”=>“foo:bar”,
     769“应为”=>“”,
     770            ),
     771//单个属性名,具有单个值。
     772阵列(
     773“css”=>“margin-top:2px”,
     774“预期”=>“margin-top:2px”,
     775            ),
     776//不支持反斜杠\。
     777阵列(
     778“css”=>“margin-top:\2px”,
     779“应为”=>“”,
     780            ),
     781//不支持花括号}。
     782阵列(
     783“css”=>“margin-bottom:2px}”,
     784“应为”=>“”,
     785            ),
     786//单个属性名称,具有单个文本值。
     787阵列(
     788“css”=>“文本转换:大写”,
     789“预期”=>“文本转换:大写”,
     790            ),
     791//只支持小写属性名。
     792阵列(
     793“css”=>“文本转换:大写”,
     794“应为”=>“”,
     795            ),
     796//大写属性值通过。
     797阵列(
     798“css”=>“text-transform:无”,
     799“预期”=>“文本转换:无”,
     800            ),
     801//具有多个值的单个属性。
     802阵列(
     803“css”=>“font:bold 15px arial,sans-serif”,
     804“预期”=>“font:bold 15px arial,sans-serif”,
     805            ),
     806//多个属性,具有单个值。
     807阵列(
     808“css”=>“font-weight:bold;”;字体大小:15px',
     809“预期”=>“font-weight:bold;字体大小:15px',
     810            ),
     811//多个属性,用空格分隔。
     812阵列(
     813“css”=>“font-weight:bold;”;字体大小:15px',
     814“预期”=>“font-weight:bold;字体大小:15px',
     815            ),
     816//多个属性,具有多个值。
     817阵列(
     818“css”=>“边距:10px 20px;填充:5px 10px’,
     819“预期”=>“边距:10px 20px;填充:5px 10px’,
     820),
     821//括号(不受支持。
     822阵列(
     823'css'=>'背景:绿色url(“foo.jpg”)无重复固定中心',
     824“应为”=>“”,
     825            ),
     826        );
     827    }
    735828}
注:请参见TracChangeset(跟踪变更集)以获取有关使用变更集查看器的帮助。