Add get_language_attributes(), which is then used by (...drum roll...) language_attributes().

Props johnbillion, posykrat, PeterRKnight.
Fixes #28180.

Built from https://develop.svn.wordpress.org/trunk@32868


git-svn-id: http://core.svn.wordpress.org/trunk@32839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-06-19 21:36:28 +00:00
parent 0c866cfa79
commit 38037c8d62
2 changed files with 22 additions and 6 deletions

View File

@ -2527,16 +2527,16 @@ function the_search_query() {
} }
/** /**
* Display the language attributes for the html tag. * Get the language attributes for the html tag.
* *
* Builds up a set of html attributes containing the text direction and language * Builds up a set of html attributes containing the text direction and language
* information for the page. * information for the page.
* *
* @since 2.1.0 * @since 4.3.0
* *
* @param string $doctype The type of html document (xhtml|html). * @param string $doctype Optional. The type of html document (xhtml|html). Default html.
*/ */
function language_attributes($doctype = 'html') { function get_language_attributes( $doctype = 'html' ) {
$attributes = array(); $attributes = array();
if ( function_exists( 'is_rtl' ) && is_rtl() ) if ( function_exists( 'is_rtl' ) && is_rtl() )
@ -2556,10 +2556,26 @@ function language_attributes($doctype = 'html') {
* Filter the language attributes for display in the html tag. * Filter the language attributes for display in the html tag.
* *
* @since 2.5.0 * @since 2.5.0
* @since 4.3.0 Added the `$doctype` parameter.
* *
* @param string $output A space-separated list of language attributes. * @param string $output A space-separated list of language attributes.
* @param string $doctype The type of html document (xhtml|html).
*/ */
echo apply_filters( 'language_attributes', $output ); return apply_filters( 'language_attributes', $output, $doctype );
}
/**
* Display the language attributes for the html tag.
*
* Builds up a set of html attributes containing the text direction and language
* information for the page.
*
* @since 2.1.0
*
* @param string $doctype Optional. The type of html document (xhtml|html). Default html.
*/
function language_attributes( $doctype = 'html' ) {
echo get_language_attributes( $doctype );
} }
/** /**

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.3-alpha-32867'; $wp_version = '4.3-alpha-32868';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.