mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-28 23:27:39 +02:00
KSES: Allow lang
, xml:lang
, dir
attributes globally.
Globally permit the `lang`, `xml:lang`, and `dir` attributes on all elements rather than a subset in accordance with the HTML specification. Props upsuper, SergeyBiryukov, mukesh27, audrasjb. Fixes #54699. Built from https://develop.svn.wordpress.org/trunk@52968 git-svn-id: http://core.svn.wordpress.org/trunk@52557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
799d6d616c
commit
d89f6097c4
@ -82,15 +82,9 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
),
|
),
|
||||||
'article' => array(
|
'article' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'aside' => array(
|
'aside' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'audio' => array(
|
'audio' => array(
|
||||||
'autoplay' => true,
|
'autoplay' => true,
|
||||||
@ -101,14 +95,10 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'src' => true,
|
'src' => true,
|
||||||
),
|
),
|
||||||
'b' => array(),
|
'b' => array(),
|
||||||
'bdo' => array(
|
'bdo' => array(),
|
||||||
'dir' => true,
|
|
||||||
),
|
|
||||||
'big' => array(),
|
'big' => array(),
|
||||||
'blockquote' => array(
|
'blockquote' => array(
|
||||||
'cite' => true,
|
'cite' => true,
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'br' => array(),
|
'br' => array(),
|
||||||
'button' => array(
|
'button' => array(
|
||||||
@ -120,17 +110,13 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'caption' => array(
|
'caption' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
),
|
),
|
||||||
'cite' => array(
|
'cite' => array(),
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
),
|
|
||||||
'code' => array(),
|
'code' => array(),
|
||||||
'col' => array(
|
'col' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'char' => true,
|
'char' => true,
|
||||||
'charoff' => true,
|
'charoff' => true,
|
||||||
'span' => true,
|
'span' => true,
|
||||||
'dir' => true,
|
|
||||||
'valign' => true,
|
'valign' => true,
|
||||||
'width' => true,
|
'width' => true,
|
||||||
),
|
),
|
||||||
@ -149,16 +135,10 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'dfn' => array(),
|
'dfn' => array(),
|
||||||
'details' => array(
|
'details' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'open' => true,
|
'open' => true,
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'div' => array(
|
'div' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'dl' => array(),
|
'dl' => array(),
|
||||||
'dt' => array(),
|
'dt' => array(),
|
||||||
@ -166,15 +146,9 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'fieldset' => array(),
|
'fieldset' => array(),
|
||||||
'figure' => array(
|
'figure' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'figcaption' => array(
|
'figcaption' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'font' => array(
|
'font' => array(
|
||||||
'color' => true,
|
'color' => true,
|
||||||
@ -183,9 +157,6 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
),
|
),
|
||||||
'footer' => array(
|
'footer' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'h1' => array(
|
'h1' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
@ -207,15 +178,9 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
),
|
),
|
||||||
'header' => array(
|
'header' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'hgroup' => array(
|
'hgroup' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'hr' => array(
|
'hr' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
@ -254,9 +219,6 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
),
|
),
|
||||||
'main' => array(
|
'main' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'map' => array(
|
'map' => array(
|
||||||
'name' => true,
|
'name' => true,
|
||||||
@ -267,9 +229,6 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
),
|
),
|
||||||
'nav' => array(
|
'nav' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'object' => array(
|
'object' => array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
@ -283,9 +242,6 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
),
|
),
|
||||||
'p' => array(
|
'p' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'pre' => array(
|
'pre' => array(
|
||||||
'width' => true,
|
'width' => true,
|
||||||
@ -296,16 +252,10 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
's' => array(),
|
's' => array(),
|
||||||
'samp' => array(),
|
'samp' => array(),
|
||||||
'span' => array(
|
'span' => array(
|
||||||
'dir' => true,
|
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'section' => array(
|
'section' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'small' => array(),
|
'small' => array(),
|
||||||
'strike' => array(),
|
'strike' => array(),
|
||||||
@ -313,9 +263,6 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'sub' => array(),
|
'sub' => array(),
|
||||||
'summary' => array(
|
'summary' => array(
|
||||||
'align' => true,
|
'align' => true,
|
||||||
'dir' => true,
|
|
||||||
'lang' => true,
|
|
||||||
'xml:lang' => true,
|
|
||||||
),
|
),
|
||||||
'sup' => array(),
|
'sup' => array(),
|
||||||
'table' => array(
|
'table' => array(
|
||||||
@ -324,7 +271,6 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'border' => true,
|
'border' => true,
|
||||||
'cellpadding' => true,
|
'cellpadding' => true,
|
||||||
'cellspacing' => true,
|
'cellspacing' => true,
|
||||||
'dir' => true,
|
|
||||||
'rules' => true,
|
'rules' => true,
|
||||||
'summary' => true,
|
'summary' => true,
|
||||||
'width' => true,
|
'width' => true,
|
||||||
@ -343,7 +289,6 @@ if ( ! CUSTOM_TAGS ) {
|
|||||||
'char' => true,
|
'char' => true,
|
||||||
'charoff' => true,
|
'charoff' => true,
|
||||||
'colspan' => true,
|
'colspan' => true,
|
||||||
'dir' => true,
|
|
||||||
'headers' => true,
|
'headers' => true,
|
||||||
'height' => true,
|
'height' => true,
|
||||||
'nowrap' => true,
|
'nowrap' => true,
|
||||||
@ -1237,7 +1182,7 @@ function wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) {
|
|||||||
* Determines whether an attribute is allowed.
|
* Determines whether an attribute is allowed.
|
||||||
*
|
*
|
||||||
* @since 4.2.3
|
* @since 4.2.3
|
||||||
* @since 5.0.0 Add support for `data-*` wildcard attributes.
|
* @since 5.0.0 Added support for `data-*` wildcard attributes.
|
||||||
*
|
*
|
||||||
* @param string $name The attribute name. Passed by reference. Returns empty string when not allowed.
|
* @param string $name The attribute name. Passed by reference. Returns empty string when not allowed.
|
||||||
* @param string $value The attribute value. Passed by reference. Returns a filtered value.
|
* @param string $value The attribute value. Passed by reference. Returns a filtered value.
|
||||||
@ -1271,7 +1216,9 @@ function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowe
|
|||||||
* Note: the attribute name should only contain `A-Za-z0-9_-` chars,
|
* Note: the attribute name should only contain `A-Za-z0-9_-` chars,
|
||||||
* double hyphens `--` are not accepted by WordPress.
|
* double hyphens `--` are not accepted by WordPress.
|
||||||
*/
|
*/
|
||||||
if ( strpos( $name_low, 'data-' ) === 0 && ! empty( $allowed_attr['data-*'] ) && preg_match( '/^data(?:-[a-z0-9_]+)+$/', $name_low, $match ) ) {
|
if ( strpos( $name_low, 'data-' ) === 0 && ! empty( $allowed_attr['data-*'] )
|
||||||
|
&& preg_match( '/^data(?:-[a-z0-9_]+)+$/', $name_low, $match )
|
||||||
|
) {
|
||||||
/*
|
/*
|
||||||
* Add the whole attribute name to the allowed attributes and set any restrictions
|
* Add the whole attribute name to the allowed attributes and set any restrictions
|
||||||
* for the `data-*` attribute values for the current element.
|
* for the `data-*` attribute values for the current element.
|
||||||
@ -2552,7 +2499,9 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
|
|||||||
* Helper function to add global attributes to a tag in the allowed HTML list.
|
* Helper function to add global attributes to a tag in the allowed HTML list.
|
||||||
*
|
*
|
||||||
* @since 3.5.0
|
* @since 3.5.0
|
||||||
* @since 5.0.0 Add support for `data-*` wildcard attributes.
|
* @since 5.0.0 Added support for `data-*` wildcard attributes.
|
||||||
|
* @since 6.0.0 Added `dir`, `lang`, and `xml:lang` to global attributes.
|
||||||
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @ignore
|
* @ignore
|
||||||
*
|
*
|
||||||
@ -2567,11 +2516,14 @@ function _wp_add_global_attributes( $value ) {
|
|||||||
'aria-labelledby' => true,
|
'aria-labelledby' => true,
|
||||||
'aria-hidden' => true,
|
'aria-hidden' => true,
|
||||||
'class' => true,
|
'class' => true,
|
||||||
|
'data-*' => true,
|
||||||
|
'dir' => true,
|
||||||
'id' => true,
|
'id' => true,
|
||||||
|
'lang' => true,
|
||||||
'style' => true,
|
'style' => true,
|
||||||
'title' => true,
|
'title' => true,
|
||||||
'role' => true,
|
'role' => true,
|
||||||
'data-*' => true,
|
'xml:lang' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( true === $value ) {
|
if ( true === $value ) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-52967';
|
$wp_version = '6.0-alpha-52968';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user