WordPress.org

Make WordPress Core

Changeset 29924


Ignore:
Timestamp:
10/16/2014 07:45:26 PM (7 years ago)
Author:
ocean90
Message:

Themes: Make it possible to delete broken themes.

props ideag, obenland.
fixes #28165.

Location:
trunk/src/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/themes.css

    r29674 r29924  
    581581}
    582582
     583.broken-themes a.delete-theme,
    583584.theme-overlay .theme-actions .delete-theme {
    584585    color: #a00;
    585     position: absolute;
    586     right: 10px;
    587     bottom: 5px;
    588586    text-decoration: none;
    589587    border-color: transparent;
     
    593591}
    594592
     593.theme-overlay .theme-actions .delete-theme {
     594    position: absolute;
     595    right: 10px;
     596    bottom: 5px;
     597}
     598
     599.broken-themes a.delete-theme:hover,
     600.broken-themes a.delete-theme:focus,
    595601.theme-overlay .theme-actions .delete-theme:hover,
    596602.theme-overlay .theme-actions .delete-theme:focus {
     
    17301736        padding: 0;
    17311737    }
    1732 }
     1738
     1739    .broken-themes table {
     1740        width: 100%;
     1741    }
     1742}
  • trunk/src/wp-admin/js/theme.js

    r29786 r29924  
    16601660        themes.Run.init();
    16611661    }
     1662
     1663    $( '.broken-themes .delete-theme' ).on( 'click', function() {
     1664        return confirm( _wpThemeSettings.settings.confirmDelete );
     1665    });
    16621666});
    16631667
  • trunk/src/wp-admin/themes.php

    r29596 r29924  
    247247<p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
    248248
     249<?php
     250$can_delete = current_user_can( 'delete_themes' );
     251?>
    249252<table>
    250253    <tr>
    251254        <th><?php _ex('Name', 'theme name'); ?></th>
    252255        <th><?php _e('Description'); ?></th>
     256        <?php if ( $can_delete ) { ?>
     257            <th></th>
     258        <?php } ?>
     259        </tr>
    253260    </tr>
    254 <?php
    255     foreach ( $broken_themes as $broken_theme ) {
    256         echo "
     261    <?php foreach ( $broken_themes as $broken_theme ) : ?>
    257262        <tr>
    258              <td>" . ( $broken_theme->get( 'Name' ) ? $broken_theme->get( 'Name' ) : $broken_theme->get_stylesheet() ) . "</td>
    259              <td>" . $broken_theme->errors()->get_error_message() . "</td>
    260         </tr>";
    261     }
    262 ?>
     263            <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td>
     264            <td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
     265            <?php
     266            if ( $can_delete ) {
     267                $stylesheet = $broken_theme->get_stylesheet();
     268                $delete_url = add_query_arg( array(
     269                    'action'     => 'delete',
     270                    'stylesheet' => urlencode( $stylesheet ),
     271                ), admin_url( 'themes.php' ) );
     272                $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet );
     273                ?>
     274                <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a></td>
     275                <?php
     276            }
     277            ?>
     278        </tr>
     279    <?php endforeach; ?>
    263280</table>
    264281</div>
Note: See TracChangeset for help on using the changeset viewer.