WordPress.org

Make WordPress Core

Changeset 20151


Ignore:
Timestamp:
03/08/12 07:32:42 (3 years ago)
Author:
nacin
Message:

In multisite, list broken themes on network/themes.php instead of on individual Manage Themes pages. see #20103.

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-ms-themes-list-table.php

    r20147 r20151  
    1717 
    1818        $status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all'; 
    19         if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search' ) ) ) 
     19        if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ) ) ) 
    2020            $status = 'all'; 
    2121 
     
    6060            'enabled' => array(), 
    6161            'disabled' => array(), 
    62             'upgrade' => array() 
     62            'upgrade' => array(), 
     63            'broken' => $this->is_site_themes ? array() : wp_get_themes( array( 'errors' => true ) ), 
    6364        ); 
    6465 
     
    7172        } 
    7273 
    73         $current = current_user_can( 'update_themes' ) && ! $this->is_site_themes && get_site_transient( 'update_themes' ); 
     74        $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && get_site_transient( 'update_themes' ); 
    7475 
    7576        foreach ( (array) $themes['all'] as $key => $theme ) { 
     
    8283            $themes[ $filter ][ $key ] = $themes['all'][ $key ]; 
    8384 
    84             if ( $current && isset( $current->response[ $key ] ) ) 
     85            if ( $maybe_update && isset( $current->response[ $key ] ) ) 
    8586                $themes['upgrade'][ $key ] = $themes['all'][ $key ]; 
    8687        } 
     
    206207                case 'upgrade': 
    207208                    $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count ); 
     209                    break; 
     210                case 'broken' : 
     211                    $text = _n( 'Broken <span class="count">(%s)</span>', 'Broken <span class="count">(%s)</span>', $count ); 
    208212                    break; 
    209213            } 
     
    298302        $checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $theme_key ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme->display('Name') . "</label>"; 
    299303 
    300         $description = '<p>' . $theme->display( 'Description' ) . '</p>'; 
    301  
    302304        $id = sanitize_html_class( $theme->get_stylesheet() ); 
    303305 
     
    321323                    break; 
    322324                case 'description': 
    323                     echo "<td class='column-description desc'$style> 
    324                         <div class='theme-description'>" . $theme->display( 'Description' ) . "</div> 
     325                    echo "<td class='column-description desc'$style>"; 
     326                    if ( $theme->errors() ) 
     327                        echo '<p><strong>' . $theme->errors()->get_error_message() . '</strong></p>'; 
     328                    echo "<div class='theme-description'><p>" . $theme->display( 'Description' ) . "</p></div> 
    325329                        <div class='$class second theme-version-author-uri'>"; 
    326330 
  • trunk/wp-admin/network/themes.php

    r20037 r20151  
    4141            $allowed_themes[ $_GET['theme'] ] = true; 
    4242            update_site_option( 'allowedthemes', $allowed_themes ); 
    43             wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); 
     43            wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); 
    4444            exit; 
    4545            break; 
     
    245245</form> 
    246246 
    247 <?php $wp_list_table->views(); ?> 
     247<?php 
     248$wp_list_table->views(); 
     249 
     250if ( 'broken' == $status ) 
     251    echo '<p class="clear">' . __('The following themes are installed but incomplete. Themes must have a stylesheet and a template.') . '</p>'; 
     252?> 
    248253 
    249254<form method="post" action=""> 
  • trunk/wp-admin/themes.php

    r20069 r20151  
    215215<?php 
    216216// List broken themes, if any. 
    217 if ( current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { 
     217if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { 
    218218?> 
    219219 
Note: See TracChangeset for help on using the changeset viewer.