language_attributes() improvements from ionfish. fixes #5393

git-svn-id: http://svn.automattic.com/wordpress/trunk@6408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-12-19 17:44:02 +00:00
parent d7d770ef7c
commit d958376904
1 changed files with 13 additions and 7 deletions

View File

@ -1000,17 +1000,23 @@ function the_search_query() {
echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) ); echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
} }
function language_attributes() { function language_attributes($doctype = 'html') {
$attributes = array();
$output = ''; $output = '';
if ( $dir = get_bloginfo('text_direction') ) if ( $dir = get_bloginfo('text_direction') )
$output = "dir=\"$dir\""; $attributes[] = "dir=\"$dir\"";
if ( $lang = get_bloginfo('language') ) { if ( $lang = get_bloginfo('language') ) {
if ( $dir ) $output .= ' '; if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' )
if ( get_option('html_type') == 'text/html' ) $attributes[] = "lang=\"$lang\"";
$output .= "lang=\"$lang\"";
else $output .= "xml: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; echo $output;
} }