Make WordPress Core


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

Themes: Make it possible to delete broken themes.

props ideag, obenland.
fixes #28165.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.