Make WordPress Core


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

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

Merges [42259] to the 4.8 branch.

Location:
branches/4.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

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

    r42262 r42269  
    31533153        $attributes[] = 'dir="rtl"';
    31543154
    3155     if ( $lang = get_bloginfo('language') ) {
    3156         if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
    3157             $attributes[] = "lang=\"$lang\"";
    3158 
    3159         if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
    3160             $attributes[] = "xml:lang=\"$lang\"";
     3155    if ( $lang = get_bloginfo( 'language' ) ) {
     3156        if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
     3157            $attributes[] = 'lang="' . esc_attr( $lang ) . '"';
     3158        }
     3159
     3160        if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
     3161            $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
     3162        }
    31613163    }
    31623164
Note: See TracChangeset for help on using the changeset viewer.