mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Themes: Revert returning the value of locate_template()
in functions that call it.
Because the names of the `get_header()`, `get_footer()`, `get_sidebar()`, and `get_template_part()` functions indicate that a value is returned, some plugins and themes already have `echo get_template_part()` in their codebase. Adding a return value to these functions using the approach in [44678] will cause the two unintended side effects of unexpected content being sent to the browser, and accidental path disclosure. Reverts [44678]. Props davidbinda. See #40969. Built from https://develop.svn.wordpress.org/trunk@44725 git-svn-id: http://core.svn.wordpress.org/trunk@44556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5b6a1ad3b2
commit
2d1d80f4c5
@ -16,10 +16,8 @@
|
|||||||
* "special".
|
* "special".
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 5.1.0 Added the return value.
|
|
||||||
*
|
*
|
||||||
* @param string $name The name of the specialised header.
|
* @param string $name The name of the specialised header.
|
||||||
* @return string The template filename if one is located.
|
|
||||||
*/
|
*/
|
||||||
function get_header( $name = null ) {
|
function get_header( $name = null ) {
|
||||||
/**
|
/**
|
||||||
@ -40,7 +38,7 @@ function get_header( $name = null ) {
|
|||||||
|
|
||||||
$templates[] = 'header.php';
|
$templates[] = 'header.php';
|
||||||
|
|
||||||
return locate_template( $templates, true );
|
locate_template( $templates, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,10 +51,8 @@ function get_header( $name = null ) {
|
|||||||
* "special".
|
* "special".
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 5.1.0 Added the return value.
|
|
||||||
*
|
*
|
||||||
* @param string $name The name of the specialised footer.
|
* @param string $name The name of the specialised footer.
|
||||||
* @return string The template filename if one is located.
|
|
||||||
*/
|
*/
|
||||||
function get_footer( $name = null ) {
|
function get_footer( $name = null ) {
|
||||||
/**
|
/**
|
||||||
@ -77,7 +73,7 @@ function get_footer( $name = null ) {
|
|||||||
|
|
||||||
$templates[] = 'footer.php';
|
$templates[] = 'footer.php';
|
||||||
|
|
||||||
return locate_template( $templates, true );
|
locate_template( $templates, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,10 +86,8 @@ function get_footer( $name = null ) {
|
|||||||
* "special".
|
* "special".
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @since 5.1.0 Added the return value.
|
|
||||||
*
|
*
|
||||||
* @param string $name The name of the specialised sidebar.
|
* @param string $name The name of the specialised sidebar.
|
||||||
* @return string The template filename if one is located.
|
|
||||||
*/
|
*/
|
||||||
function get_sidebar( $name = null ) {
|
function get_sidebar( $name = null ) {
|
||||||
/**
|
/**
|
||||||
@ -114,7 +108,7 @@ function get_sidebar( $name = null ) {
|
|||||||
|
|
||||||
$templates[] = 'sidebar.php';
|
$templates[] = 'sidebar.php';
|
||||||
|
|
||||||
return locate_template( $templates, true );
|
locate_template( $templates, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,11 +128,9 @@ function get_sidebar( $name = null ) {
|
|||||||
* "special".
|
* "special".
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
* @since 5.1.0 Added the return value.
|
|
||||||
*
|
*
|
||||||
* @param string $slug The slug name for the generic template.
|
* @param string $slug The slug name for the generic template.
|
||||||
* @param string $name The name of the specialised template.
|
* @param string $name The name of the specialised template.
|
||||||
* @return string The template filename if one is located.
|
|
||||||
*/
|
*/
|
||||||
function get_template_part( $slug, $name = null ) {
|
function get_template_part( $slug, $name = null ) {
|
||||||
/**
|
/**
|
||||||
@ -162,7 +154,7 @@ function get_template_part( $slug, $name = null ) {
|
|||||||
|
|
||||||
$templates[] = "{$slug}.php";
|
$templates[] = "{$slug}.php";
|
||||||
|
|
||||||
return locate_template( $templates, true, false );
|
locate_template( $templates, true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1-beta3-44724';
|
$wp_version = '5.1-beta3-44725';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user