Visually merge a plugin with its update notice. Same applies to themes in the network admin. Move from 'update automatically' to 'update now'. fixes #20273.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-03-21 16:19:27 +00:00
parent d7c0402090
commit 29bc67a989
5 changed files with 41 additions and 18 deletions

View File

@ -4425,15 +4425,30 @@ input.button-highlighted,
padding: 5px 7px 0;
}
#wpbody-content .plugins .plugin-title, #wpbody-content .plugins .theme-title {
.plugins .update th,
.plugins .update td {
border-bottom: 0;
}
.plugin-update-tr td {
border-top: 0;
}
#wpbody-content .plugins .plugin-title,
#wpbody-content .plugins .theme-title {
padding-right: 12px;
white-space:nowrap;
}
.plugins .second, .plugins .row-actions-visible {
.plugins .second,
.plugins .row-actions-visible {
padding: 0 0 5px;
}
.plugins .update .second,
.plugins .update .row-actions-visible {
padding-bottom: 0;
}
.plugins-php .widefat tfoot th,
.plugins-php .widefat tfoot td {
border-top-style: solid;

View File

@ -71,7 +71,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$allowed_where = 'network';
}
$maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && get_site_transient( 'update_themes' );
$maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current = get_site_transient( 'update_themes' );
foreach ( (array) $themes['all'] as $key => $theme ) {
if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) {
@ -79,11 +79,13 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
continue;
}
if ( $maybe_update && isset( $current->response[ $key ] ) ) {
$themes['all'][ $key ]->update = true;
$themes['upgrade'][ $key ] = $themes['all'][ $key ];
}
$filter = $theme->is_allowed( $allowed_where, $this->site_id ) ? 'enabled' : 'disabled';
$themes[ $filter ][ $key ] = $themes['all'][ $key ];
if ( $maybe_update && isset( $current->response[ $key ] ) )
$themes['upgrade'][ $key ] = $themes['all'][ $key ];
}
if ( $s ) {
@ -261,7 +263,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
}
function single_row( $key, $theme ) {
global $status, $page, $s;
global $status, $page, $s, $totals;
$context = $status;
@ -305,6 +307,9 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
$id = sanitize_html_class( $theme->get_stylesheet() );
if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) )
$class .= ' update';
echo "<tr id='$id' class='$class'>";
list( $columns, $hidden ) = $this->get_column_info();

View File

@ -65,10 +65,14 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
$plugins['dropins'] = get_dropins();
$current = get_site_transient( 'update_plugins' );
foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
if ( isset( $current->response[ $plugin_file ] ) )
$plugins['upgrade'][ $plugin_file ] = $plugin_data;
if ( current_user_can( 'update_plugins' ) ) {
$current = get_site_transient( 'update_plugins' );
foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
if ( isset( $current->response[ $plugin_file ] ) ) {
$plugins['all'][ $plugin_file ]['update'] = true;
$plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ];
}
}
}
}
@ -100,9 +104,6 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
}
if ( !current_user_can( 'update_plugins' ) )
$plugins['upgrade'] = array();
if ( $s ) {
$status = 'search';
$plugins['search'] = array_filter( $plugins['all'], array( &$this, '_search_callback' ) );
@ -312,7 +313,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
function single_row( $plugin_file, $plugin_data ) {
global $status, $page, $s;
global $status, $page, $s, $totals;
$context = $status;
@ -394,6 +395,8 @@ class WP_Plugins_List_Table extends WP_List_Table {
}
$id = sanitize_title( $plugin_name );
if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
$class .= ' update';
echo "<tr id='$id' class='$class'>";

View File

@ -135,7 +135,7 @@ function theme_update_available( $theme ) {
else if ( empty($update['package']) )
printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a>. <em>Automatic update is unavailable for this theme.</em>') . '</strong></p>', $theme_name, $details_url, $update['new_version']);
else
printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a> or <a href="%4$s" %5$s>update automatically</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );
printf( '<p><strong>' . __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s details</a> or <a href="%4$s" %5$s>update now</a>.') . '</strong></p>', $theme_name, $details_url, $update['new_version'], $update_url, $update_onclick );
}
}
}

View File

@ -199,7 +199,7 @@ function wp_plugin_update_row( $file, $plugin_data ) {
else if ( empty($r->package) )
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 update is unavailable for this plugin.</em>'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
else
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">update automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) );
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">update now</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url( self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file) );
do_action( "in_plugin_update_message-$file", $plugin_data, $r );
@ -271,7 +271,7 @@ function wp_theme_update_row( $theme_key, $theme ) {
else if ( empty( $r['package'] ) )
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 update is unavailable for this theme.</em>'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] );
else
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">update 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) );
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">update now</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) );
do_action( "in_theme_update_message-$theme_key", $theme, $r );