<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[20236] trunk/wp-admin: Visually merge a plugin with its update notice.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/20236">20236</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-03-21 16:19:27 +0000 (Wed, 21 Mar 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Visually merge a plugin with its update notice. Same applies to themes in the network admin. Move from 'update automatically' to 'update now'. fixes <a href="http://core.trac.wordpress.org/ticket/20273">#20273</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmindevcss">trunk/wp-admin/css/wp-admin.dev.css</a></li>
<li><a href="#trunkwpadminincludesclasswpmsthemeslisttablephp">trunk/wp-admin/includes/class-wp-ms-themes-list-table.php</a></li>
<li><a href="#trunkwpadminincludesclasswppluginslisttablephp">trunk/wp-admin/includes/class-wp-plugins-list-table.php</a></li>
<li><a href="#trunkwpadminincludesthemephp">trunk/wp-admin/includes/theme.php</a></li>
<li><a href="#trunkwpadminincludesupdatephp">trunk/wp-admin/includes/update.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.dev.css (20235 => 20236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.dev.css        2012-03-21 15:04:52 UTC (rev 20235)
+++ trunk/wp-admin/css/wp-admin.dev.css        2012-03-21 16:19:27 UTC (rev 20236)
</span><span class="lines">@@ -4425,15 +4425,30 @@
</span><span class="cx">         padding: 5px 7px 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#wpbody-content .plugins .plugin-title, #wpbody-content .plugins .theme-title {
</del><ins>+.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 {
</ins><span class="cx">         padding-right: 12px;
</span><span class="cx">         white-space:nowrap;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.plugins .second, .plugins .row-actions-visible {
</del><ins>+.plugins .second,
+.plugins .row-actions-visible {
</ins><span class="cx">         padding: 0 0 5px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.plugins .update .second,
+.plugins .update .row-actions-visible {
+        padding-bottom: 0;
+}
+
</ins><span class="cx"> .plugins-php .widefat tfoot th,
</span><span class="cx"> .plugins-php .widefat tfoot td {
</span><span class="cx">         border-top-style: solid;
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpmsthemeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-ms-themes-list-table.php (20235 => 20236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2012-03-21 15:04:52 UTC (rev 20235)
+++ trunk/wp-admin/includes/class-wp-ms-themes-list-table.php        2012-03-21 16:19:27 UTC (rev 20236)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">                         $allowed_where = 'network';
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && get_site_transient( 'update_themes' );
</del><ins>+                $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current = get_site_transient( 'update_themes' );
</ins><span class="cx">
</span><span class="cx">                 foreach ( (array) $themes['all'] as $key => $theme ) {
</span><span class="cx">                         if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) {
</span><span class="lines">@@ -79,11 +79,13 @@
</span><span class="cx">                                 continue;
</span><span class="cx">                         }
</span><span class="cx">
</span><ins>+                        if ( $maybe_update && isset( $current->response[ $key ] ) ) {
+                                $themes['all'][ $key ]->update = true;
+                                $themes['upgrade'][ $key ] = $themes['all'][ $key ];
+                        }
+
</ins><span class="cx">                         $filter = $theme->is_allowed( $allowed_where, $this->site_id ) ? 'enabled' : 'disabled';
</span><span class="cx">                         $themes[ $filter ][ $key ] = $themes['all'][ $key ];
</span><del>-
-                        if ( $maybe_update && isset( $current->response[ $key ] ) )
-                                $themes['upgrade'][ $key ] = $themes['all'][ $key ];
</del><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( $s ) {
</span><span class="lines">@@ -261,7 +263,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function single_row( $key, $theme ) {
</span><del>-                global $status, $page, $s;
</del><ins>+                global $status, $page, $s, $totals;
</ins><span class="cx">
</span><span class="cx">                 $context = $status;
</span><span class="cx">
</span><span class="lines">@@ -305,6 +307,9 @@
</span><span class="cx">
</span><span class="cx">                 $id = sanitize_html_class( $theme->get_stylesheet() );
</span><span class="cx">
</span><ins>+                if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) )
+                        $class .= ' update';
+
</ins><span class="cx">                 echo "<tr id='$id' class='$class'>";
</span><span class="cx">
</span><span class="cx">                 list( $columns, $hidden ) = $this->get_column_info();
</span></span></pre></div>
<a id="trunkwpadminincludesclasswppluginslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-plugins-list-table.php (20235 => 20236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-plugins-list-table.php        2012-03-21 15:04:52 UTC (rev 20235)
+++ trunk/wp-admin/includes/class-wp-plugins-list-table.php        2012-03-21 16:19:27 UTC (rev 20236)
</span><span class="lines">@@ -65,10 +65,14 @@
</span><span class="cx">                         if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
</span><span class="cx">                                 $plugins['dropins'] = get_dropins();
</span><span class="cx">
</span><del>-                        $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;
</del><ins>+                        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 ];
+                                        }
+                                }
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="lines">@@ -100,9 +104,6 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( !current_user_can( 'update_plugins' ) )
-                        $plugins['upgrade'] = array();
-
</del><span class="cx">                 if ( $s ) {
</span><span class="cx">                         $status = 'search';
</span><span class="cx">                         $plugins['search'] = array_filter( $plugins['all'], array( &$this, '_search_callback' ) );
</span><span class="lines">@@ -312,7 +313,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function single_row( $plugin_file, $plugin_data ) {
</span><del>-                global $status, $page, $s;
</del><ins>+                global $status, $page, $s, $totals;
</ins><span class="cx">
</span><span class="cx">                 $context = $status;
</span><span class="cx">
</span><span class="lines">@@ -394,6 +395,8 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $id = sanitize_title( $plugin_name );
</span><ins>+                if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
+                        $class .= ' update';
</ins><span class="cx">
</span><span class="cx">                 echo "<tr id='$id' class='$class'>";
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/theme.php (20235 => 20236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/theme.php        2012-03-21 15:04:52 UTC (rev 20235)
+++ trunk/wp-admin/includes/theme.php        2012-03-21 16:19:27 UTC (rev 20236)
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx">                         else if ( empty($update['package']) )
</span><span class="cx">                                 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']);
</span><span class="cx">                         else
</span><del>-                                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 );
</del><ins>+                                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 );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminincludesupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/update.php (20235 => 20236)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/update.php        2012-03-21 15:04:52 UTC (rev 20235)
+++ trunk/wp-admin/includes/update.php        2012-03-21 16:19:27 UTC (rev 20236)
</span><span class="lines">@@ -199,7 +199,7 @@
</span><span class="cx">                 else if ( empty($r->package) )
</span><span class="cx">                         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 );
</span><span class="cx">                 else
</span><del>-                        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) );
</del><ins>+                        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) );
</ins><span class="cx">
</span><span class="cx">                 do_action( "in_plugin_update_message-$file", $plugin_data, $r );
</span><span class="cx">
</span><span class="lines">@@ -271,7 +271,7 @@
</span><span class="cx">         else if ( empty( $r['package'] ) )
</span><span class="cx">                 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'] );
</span><span class="cx">         else
</span><del>-                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) );
</del><ins>+                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) );
</ins><span class="cx">
</span><span class="cx">         do_action( "in_theme_update_message-$theme_key", $theme, $r );
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>