Make WordPress Core

Ticket #32668: 32668.diff

File 32668.diff, 1.5 KB (added by rabmalin, 9 years ago)
  • src/wp-admin/themes.php

     
    300300
    301301<?php
    302302$can_delete = current_user_can( 'delete_themes' );
     303$can_install = current_user_can( 'install_themes' );
    303304?>
    304305<table>
    305306        <tr>
     
    312313        <?php foreach ( $broken_themes as $broken_theme ) : ?>
    313314                <tr>
    314315                        <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td>
    315                         <td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
     316                        <td>
     317                           <?php echo $broken_theme->errors()->get_error_message(); ?>
     318                           <?php
     319                           $parent_theme_name = $broken_theme->get( 'Template' );
     320                           $parent_theme = themes_api( 'theme_information', array( 'slug' => urlencode( $parent_theme_name ) ) );
     321                           if ( $can_install && ! is_wp_error( $parent_theme ) ) {
     322                             $install_url = add_query_arg( array(
     323                               'action' => 'install-theme',
     324                               'theme'  => urlencode( $parent_theme_name ),
     325                             ), admin_url( 'update.php' ) );
     326                             $install_url = wp_nonce_url( $install_url, 'install-theme_' . $parent_theme_name );
     327                             ?>
     328                             <br /><a href="<?php echo esc_url( $install_url ); ?>" class="button button-secondary"><?php _e( 'Install Parent Theme' ); ?></a>
     329                             <?php
     330                           }
     331                           ?>
     332                         </td>
     333
    316334                        <?php
    317335                        if ( $can_delete ) {
    318336                                $stylesheet = $broken_theme->get_stylesheet();