Make WordPress Core


Ignore:
Timestamp:
06/06/2012 08:34:24 PM (12 years ago)
Author:
nacin
Message:

Theme Customizer: Block non-existent or non-allowed themes, unless the non-allowed theme is the active theme. Support a user having edit_theme_options xor switch_themes. fixes #20852.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/theme.php

    r20752 r21010  
    1212 * @since 2.8.0
    1313 *
    14  * @param string $template Template directory of the theme to delete
     14 * @param string $stylesheet Stylesheet of the theme to delete
    1515 * @param string $redirect Redirect to page when complete.
    1616 * @return mixed
    1717 */
    18 function delete_theme($template, $redirect = '') {
     18function delete_theme($stylesheet, $redirect = '') {
    1919    global $wp_filesystem;
    2020
    21     if ( empty($template) )
     21    if ( empty($stylesheet) )
    2222        return false;
    2323
    2424    ob_start();
    2525    if ( empty( $redirect ) )
    26         $redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template);
     26        $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . $stylesheet, 'delete-theme_' . $stylesheet);
    2727    if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
    2828        $data = ob_get_contents();
     
    6262
    6363    $themes_dir = trailingslashit( $themes_dir );
    64     $theme_dir = trailingslashit($themes_dir . $template);
     64    $theme_dir = trailingslashit($themes_dir . $stylesheet);
    6565    $deleted = $wp_filesystem->delete($theme_dir, true);
    6666
    6767    if ( ! $deleted )
    68         return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $template) );
     68        return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $stylesheet) );
    6969
    7070    // Force refresh of theme update information
Note: See TracChangeset for help on using the changeset viewer.