Make WordPress Core

Changeset 42293 for branches/4.2


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

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

Merges [42259] to the 4.2 branch.

Location:
branches/4.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2

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

    r32051 r42293  
    25232523                $attributes[] = 'dir="rtl"';
    25242524
    2525         if ( $lang = get_bloginfo('language') ) {
    2526                 if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
    2527                         $attributes[] = "lang=\"$lang\"";
    2528 
    2529                 if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
    2530                         $attributes[] = "xml:lang=\"$lang\"";
     2525        if ( $lang = get_bloginfo( 'language' ) ) {
     2526                if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) {
     2527                        $attributes[] = 'lang="' . esc_attr( $lang ) . '"';
     2528                }
     2529
     2530                if ( get_option( 'html_type' ) != 'text/html' || $doctype == 'xhtml' ) {
     2531                        $attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
     2532                }
    25312533        }
    25322534
Note: See TracChangeset for help on using the changeset viewer.