Skip to content

Commit

Permalink
Hardening: Add escaping to the language attributes used on html ele…
Browse files Browse the repository at this point in the history
…ments.

Merges [42259] to the 4.1 branch.

Built from https://develop.svn.wordpress.org/branches/4.1@42297


git-svn-id: http://core.svn.wordpress.org/branches/4.1@42126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
johnbillion committed Nov 29, 2017
1 parent 3d3b455 commit e16db41
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions wp-includes/general-template.php
Expand Up @@ -2513,12 +2513,14 @@ function language_attributes($doctype = 'html') {
if ( function_exists( 'is_rtl' ) && is_rtl() )
$attributes[] = 'dir="rtl"';

if ( $lang = get_bloginfo('language') ) {
if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
$attributes[] = "lang=\"$lang\"";
if ( $lang = get_bloginfo( 'language' ) ) {
if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
$attributes[] = 'lang="' . esc_attr( $lang ) . '"';
}

if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
$attributes[] = "xml:lang=\"$lang\"";
if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
$attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
}
}

$output = implode(' ', $attributes);
Expand Down

0 comments on commit e16db41

Please sign in to comment.