From a484b6a634c258b1b996e689f394f956883a0141 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 19 Jun 2015 21:35:22 +0000 Subject: [PATCH] Add `get_language_attributes()`, which is then used by (...drum roll...) `language_attributes()`. Props johnbillion, posykrat, PeterRKnight. Fixes #28180. git-svn-id: https://develop.svn.wordpress.org/trunk@32868 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/general-template.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 1945c6738f..65585fbf9c 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -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 * 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(); 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. * * @since 2.5.0 + * @since 4.3.0 Added the `$doctype` parameter. * * @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 ); } /**