mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Deprecate get_current_theme(). Use (string) wp_get_theme() to get the translated name of the theme. Keep the current_theme option for now. see #20103, see #20138.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bf97881f98
commit
a8d45a288f
@ -2916,7 +2916,9 @@ function debug_fclose( $fp ) {
|
|||||||
* broken, if it is missing style.css; index.php is optional.
|
* broken, if it is missing style.css; index.php is optional.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
* @global array $wp_themes Stores the working themes.
|
* @deprecated 3.4.0
|
||||||
|
* @deprecated Use wp_get_themes()
|
||||||
|
* @see wp_get_themes()
|
||||||
*
|
*
|
||||||
* @return array Theme list with theme data.
|
* @return array Theme list with theme data.
|
||||||
*/
|
*/
|
||||||
@ -2941,6 +2943,9 @@ function get_themes() {
|
|||||||
* Retrieve theme data.
|
* Retrieve theme data.
|
||||||
*
|
*
|
||||||
* @since 1.5.0
|
* @since 1.5.0
|
||||||
|
* @deprecated 3.4.0
|
||||||
|
* @deprecated Use wp_get_theme()
|
||||||
|
* @see wp_get_theme()
|
||||||
*
|
*
|
||||||
* @param string $theme Theme name.
|
* @param string $theme Theme name.
|
||||||
* @return array|null Null, if theme name does not exist. Theme data, if exists.
|
* @return array|null Null, if theme name does not exist. Theme data, if exists.
|
||||||
@ -2950,6 +2955,25 @@ function get_theme( $theme ) {
|
|||||||
|
|
||||||
$themes = get_themes();
|
$themes = get_themes();
|
||||||
if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
|
if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
|
||||||
return $themes[$theme];
|
return $themes[ $theme ];
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve current theme name.
|
||||||
|
*
|
||||||
|
* @since 1.5.0
|
||||||
|
* @deprecated 3.4.0
|
||||||
|
* @deprecated Use (string) wp_get_theme()
|
||||||
|
* @see wp_get_theme()
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function get_current_theme() {
|
||||||
|
_deprecated_function( __FUNCTION__, '3.4', 'get_current_theme()' );
|
||||||
|
|
||||||
|
if ( $theme = get_option( 'current_theme' ) )
|
||||||
|
return $theme;
|
||||||
|
|
||||||
|
return wp_get_theme()->get('Name');
|
||||||
}
|
}
|
@ -356,24 +356,6 @@ function get_theme_roots() {
|
|||||||
return $theme_roots;
|
return $theme_roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve current theme display name.
|
|
||||||
*
|
|
||||||
* If the 'current_theme' option has already been set, then it will be returned
|
|
||||||
* instead. If it is not set, then each theme will be iterated over until both
|
|
||||||
* the current stylesheet and current template name.
|
|
||||||
*
|
|
||||||
* @since 1.5.0
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function get_current_theme() {
|
|
||||||
if ( $theme = get_option( 'current_theme' ) )
|
|
||||||
return $theme;
|
|
||||||
|
|
||||||
return wp_get_theme()->get('Name');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a directory that contains themes.
|
* Register a directory that contains themes.
|
||||||
*
|
*
|
||||||
@ -791,7 +773,9 @@ function validate_current_theme() {
|
|||||||
function get_theme_mods() {
|
function get_theme_mods() {
|
||||||
$theme_slug = get_option( 'stylesheet' );
|
$theme_slug = get_option( 'stylesheet' );
|
||||||
if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) {
|
if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) {
|
||||||
$theme_name = get_current_theme();
|
$theme_name = get_option( 'current_theme' );
|
||||||
|
if ( false === $theme_name )
|
||||||
|
$theme_name = wp_get_theme()->get('Name');
|
||||||
$mods = get_option( "mods_$theme_name" ); // Deprecated location.
|
$mods = get_option( "mods_$theme_name" ); // Deprecated location.
|
||||||
if ( is_admin() && false !== $mods ) {
|
if ( is_admin() && false !== $mods ) {
|
||||||
update_option( "theme_mods_$theme_slug", $mods );
|
update_option( "theme_mods_$theme_slug", $mods );
|
||||||
@ -878,7 +862,12 @@ function remove_theme_mod( $name ) {
|
|||||||
*/
|
*/
|
||||||
function remove_theme_mods() {
|
function remove_theme_mods() {
|
||||||
delete_option( 'theme_mods_' . get_option( 'stylesheet' ) );
|
delete_option( 'theme_mods_' . get_option( 'stylesheet' ) );
|
||||||
delete_option( 'mods_' . get_current_theme() );
|
|
||||||
|
// Old style.
|
||||||
|
$theme_name = get_option( 'current_theme' );
|
||||||
|
if ( false === $theme_name )
|
||||||
|
$theme_name = wp_get_theme()->get('Name');
|
||||||
|
delete_option( 'mods_' . $theme_name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user