Make WordPress Core

Changeset 16141


Ignore:
Timestamp:
11/01/2010 08:08:25 PM (14 years ago)
Author:
nacin
Message:

Add theme updates to the network themes screen. props PeteMall, see #14897.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

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

    r16037 r16141  
    242242}
    243243
     244function wp_theme_update_rows() {
     245    if ( !current_user_can('update_themes' ) )
     246        return;
     247
     248    $themes = get_site_transient( 'update_themes' );
     249    if ( isset($themes->response) && is_array($themes->response) ) {
     250        $themes = array_keys( $themes->response );
     251
     252        foreach( $themes as $theme ) {
     253            add_action( "after_theme_row_$theme", 'wp_theme_update_row', 10, 2 );
     254        }
     255    }
     256}
     257add_action( 'admin_init', 'wp_theme_update_rows' );
     258
     259function wp_theme_update_row( $theme_key, $theme ) {
     260    $current = get_site_transient( 'update_themes' );
     261    if ( !isset( $current->response[ $theme_key ] ) )
     262        return false;
     263    $r = $current->response[ $theme_key ];
     264    $themes_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
     265    $theme_name = wp_kses( $theme['Name'], $themes_allowedtags );
     266
     267    $details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400");
     268
     269    echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
     270    if ( ! current_user_can('update_themes') )
     271        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r->new_version );
     272    else if ( empty( $r['package'] ) )
     273        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic upgrade is unavailable for this plugin.</em>'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] );
     274    else
     275        printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">upgrade automatically</a>.'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'], wp_nonce_url( self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key) );
     276
     277    do_action( "in_theme_update_message-$theme_key", $theme, $r );
     278
     279    echo '</div></td></tr>';
     280}
    244281
    245282function wp_update_core($current, $feedback = '') {
  • trunk/wp-admin/network/themes.php

    r16128 r16141  
    6565
    6666$wp_list_table->prepare_items();
     67add_thickbox();
    6768
    6869add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' ), 'default' => 999) );
Note: See TracChangeset for help on using the changeset viewer.