From d8876f4dba8653d897d562458c56bf3a100a45e7 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 19 Dec 2007 17:44:02 +0000 Subject: [PATCH] language_attributes() improvements from ionfish. fixes #5393 git-svn-id: https://develop.svn.wordpress.org/trunk@6408 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/general-template.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 5dcea03c2d..5ed1f46eda 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -1000,17 +1000,23 @@ function the_search_query() { echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) ); } -function language_attributes() { +function language_attributes($doctype = 'html') { + $attributes = array(); $output = ''; + if ( $dir = get_bloginfo('text_direction') ) - $output = "dir=\"$dir\""; + $attributes[] = "dir=\"$dir\""; + if ( $lang = get_bloginfo('language') ) { - if ( $dir ) $output .= ' '; - if ( get_option('html_type') == 'text/html' ) - $output .= "lang=\"$lang\""; - else $output .= "xml:lang=\"$lang\""; + if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' ) + $attributes[] = "lang=\"$lang\""; + + if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) + $attributes[] = "xml:lang=\"$lang\""; } - + + $output = implode(' ', $attributes); + $output = apply_filters('language_attributes', $output); echo $output; }