WordPress.org

Make WordPress Core

Changeset 6408


Ignore:
Timestamp:
12/19/2007 05:44:02 PM (10 years ago)
Author:
ryan
Message:

language_attributes() improvements from ionfish. fixes #5393

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r6364 r6408  
    10011001}
    10021002
    1003 function language_attributes() {
     1003function language_attributes($doctype = 'html') {
     1004    $attributes = array();
    10041005    $output = '';
     1006       
    10051007    if ( $dir = get_bloginfo('text_direction') )
    1006         $output = "dir=\"$dir\"";
     1008        $attributes[] = "dir=\"$dir\"";
     1009   
    10071010    if ( $lang = get_bloginfo('language') ) {
    1008         if ( $dir ) $output .= ' ';
    1009         if ( get_option('html_type') == 'text/html' )
    1010             $output .= "lang=\"$lang\"";
    1011         else $output .= "xml:lang=\"$lang\"";
    1012     }
    1013 
     1011        if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' )
     1012            $attributes[] = "lang=\"$lang\"";
     1013       
     1014        if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
     1015            $attributes[] = "xml:lang=\"$lang\"";
     1016    }
     1017   
     1018    $output = implode(' ', $attributes);
     1019    $output = apply_filters('language_attributes', $output);
    10141020    echo $output;
    10151021}
Note: See TracChangeset for help on using the changeset viewer.