Make WordPress Core

Changeset 42313 for branches/3.7


Ignore:
Timestamp:
11/29/2017 04:49:03 PM (7 years ago)
Author:
johnbillion
Message:

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

Merges [42259] to the 3.7 branch.

Location:
branches/3.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/src

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

    r25868 r42313  
    19281928        $attributes[] = 'dir="rtl"';
    19291929
    1930     if ( $lang = get_bloginfo('language') ) {
    1931         if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
    1932             $attributes[] = "lang=\"$lang\"";
    1933 
    1934         if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
    1935             $attributes[] = "xml:lang=\"$lang\"";
     1930    if ( $lang = get_bloginfo( 'language' ) ) {
     1931        if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
     1932            $attributes[] = 'lang="' . esc_attr( $lang ) . '"';
     1933        }
     1934
     1935        if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
     1936            $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
     1937        }
    19361938    }
    19371939
Note: See TracChangeset for help on using the changeset viewer.