Make WordPress Core

Changeset 20040


Ignore:
Timestamp:
02/29/2012 08:07:22 PM (13 years ago)
Author:
nacin
Message:

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.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/deprecated.php

    r20029 r20040  
    29172917 *
    29182918 * @since 1.5.0
    2919  * @global array $wp_themes Stores the working themes.
     2919 * @deprecated 3.4.0
     2920 * @deprecated Use wp_get_themes()
     2921 * @see wp_get_themes()
    29202922 *
    29212923 * @return array Theme list with theme data.
     
    29422944 *
    29432945 * @since 1.5.0
     2946 * @deprecated 3.4.0
     2947 * @deprecated Use wp_get_theme()
     2948 * @see wp_get_theme()
    29442949 *
    29452950 * @param string $theme Theme name.
     
    29512956    $themes = get_themes();
    29522957    if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
    2953         return $themes[$theme];
     2958        return $themes[ $theme ];
    29542959    return null;
    29552960}
     2961
     2962/**
     2963 * Retrieve current theme name.
     2964 *
     2965 * @since 1.5.0
     2966 * @deprecated 3.4.0
     2967 * @deprecated Use (string) wp_get_theme()
     2968 * @see wp_get_theme()
     2969 *
     2970 * @return string
     2971 */
     2972function get_current_theme() {
     2973    _deprecated_function( __FUNCTION__, '3.4', 'get_current_theme()' );
     2974
     2975    if ( $theme = get_option( 'current_theme' ) )
     2976        return $theme;
     2977
     2978    return wp_get_theme()->get('Name');
     2979}
  • trunk/wp-includes/theme.php

    r20033 r20040  
    355355    }
    356356    return $theme_roots;
    357 }
    358 
    359 /**
    360  * Retrieve current theme display name.
    361  *
    362  * If the 'current_theme' option has already been set, then it will be returned
    363  * instead. If it is not set, then each theme will be iterated over until both
    364  * the current stylesheet and current template name.
    365  *
    366  * @since 1.5.0
    367  *
    368  * @return string
    369  */
    370 function get_current_theme() {
    371     if ( $theme = get_option( 'current_theme' ) )
    372         return $theme;
    373 
    374     return wp_get_theme()->get('Name');
    375357}
    376358
     
    792774    $theme_slug = get_option( 'stylesheet' );
    793775    if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) {
    794         $theme_name = get_current_theme();
     776        $theme_name = get_option( 'current_theme' );
     777        if ( false === $theme_name )
     778            $theme_name = wp_get_theme()->get('Name');
    795779        $mods = get_option( "mods_$theme_name" ); // Deprecated location.
    796780        if ( is_admin() && false !== $mods ) {
     
    879863function remove_theme_mods() {
    880864    delete_option( 'theme_mods_' . get_option( 'stylesheet' ) );
    881     delete_option( 'mods_' . get_current_theme() );
     865
     866    // Old style.
     867    $theme_name = get_option( 'current_theme' );
     868    if ( false === $theme_name )
     869        $theme_name = wp_get_theme()->get('Name');
     870    delete_option( 'mods_' . $theme_name );
    882871}
    883872
Note: See TracChangeset for help on using the changeset viewer.