Make WordPress Core

Changeset 42289


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

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

Merges [42259] to the 4.3 branch.

Location:
branches/4.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3

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

    r33606 r42289  
    26282628        $attributes[] = 'dir="rtl"';
    26292629
    2630     if ( $lang = get_bloginfo('language') ) {
    2631         if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
    2632             $attributes[] = "lang=\"$lang\"";
    2633 
    2634         if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
    2635             $attributes[] = "xml:lang=\"$lang\"";
     2630    if ( $lang = get_bloginfo( 'language' ) ) {
     2631        if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
     2632            $attributes[] = 'lang="' . esc_attr( $lang ) . '"';
     2633        }
     2634
     2635        if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
     2636            $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
     2637        }
    26362638    }
    26372639
Note: See TracChangeset for help on using the changeset viewer.