Make WordPress Core

Changeset 42273 for branches/4.7


Ignore:
Timestamp:
11/29/2017 04:17:04 PM (9 years ago)
Author:
johnbillion
Message:

Hardening: Add escaping to the language attributes used on html elements.

Merges [42259] to the 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/general-template.php

    r42263 r42273  
    31193119        $attributes[] = 'dir="rtl"';
    31203120
    3121     if ( $lang = get_bloginfo('language') ) {
    3122         if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
    3123             $attributes[] = "lang=\"$lang\"";
    3124 
    3125         if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
    3126             $attributes[] = "xml:lang=\"$lang\"";
     3121    if ( $lang = get_bloginfo( 'language' ) ) {
     3122        if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
     3123            $attributes[] = 'lang="' . esc_attr( $lang ) . '"';
     3124        }
     3125
     3126        if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
     3127            $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
     3128        }
    31273129    }
    31283130
Note: See TracChangeset for help on using the changeset viewer.