<!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>[29047] trunk/src: Display plugin install results as "cards" rather than in a list table, first run.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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/29047">29047</a></dd>
<dt>Author</dt> <dd>helen</dd>
<dt>Date</dt> <dd>2014-07-09 20:01:35 +0000 (Wed, 09 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Display plugin install results as "cards" rather than in a list table, first run.

props stephdau, ryelle, tellyworth, melchoyce. see <a href="http://core.trac.wordpress.org/ticket/28785">#28785</a>, <a href="http://core.trac.wordpress.org/ticket/28646">#28646</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsslisttablescss">trunk/src/wp-admin/css/list-tables.css</a></li>
<li><a href="#trunksrcwpadminincludesclasswpplugininstalllisttablephp">trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinswordpressimagesmorepng">trunk/src/wp-includes/js/tinymce/skins/wordpress/images/more.png</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsslisttablescss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/list-tables.css (29046 => 29047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/list-tables.css   2014-07-09 19:18:44 UTC (rev 29046)
+++ trunk/src/wp-admin/css/list-tables.css      2014-07-09 20:01:35 UTC (rev 29047)
</span><span class="lines">@@ -1215,6 +1215,100 @@
</span><span class="cx">  margin: 2.5em 0 8px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/* Plugin card table view */
+.plugin-card {
+       float: left;
+       margin: 0 8px 16px;
+       width: 48.5%;
+       width: -webkit-calc( 50% - 8px );
+       width: calc( 50% - 8px );
+       background-color: #fff;
+       border: 1px solid #dedede;
+       -webkit-box-sizing: border-box;
+       -moz-box-sizing: border-box;
+       box-sizing: border-box;
+}
+
+@media screen and ( max-width: 782px ) {
+       .plugin-card {
+               margin-left: 0;
+               margin-right: 0;
+               width: 100%;
+       }
+}
+
+.plugin-card:nth-child(odd) {
+       clear: both;
+       margin-left: 0;
+}
+
+.plugin-card:nth-child(even) {
+       margin-right: 0
+}
+
+.plugin-card-top {
+       padding: 20px 20px 10px;
+}
+
+div.action-links,
+.plugin-action-buttons {
+       margin: 0; /* Override existing margins */
+}
+
+.plugin-card h4 {
+       float: left;
+       margin: 0 0 12px;
+       font-size: 18px;
+}
+
+.plugin-card .desc {
+       clear: left;
+}
+
+.plugin-action-buttons {
+       float: right;
+       margin-left: 2em;
+       margin-bottom: 1em;
+       text-align: right;
+}
+
+.plugin-action-buttons li {
+       margin-bottom: 10px;
+}
+
+.plugin-card-bottom {
+       clear: both;
+       padding: 12px 20px;
+       background-color: #fafafa;
+       border-top: 1px solid #dedede;
+       overflow: hidden;
+}
+
+.plugin-card-bottom .star-rating {
+       display: inline;
+}
+
+.plugin-card .column-rating {
+       line-height: 23px;
+}
+
+.plugin-card .column-rating,
+.plugin-card .column-updated {
+       margin-bottom: 4px;
+}
+
+.plugin-card .column-rating,
+.plugin-card .column-downloaded {
+       float: left;
+       clear: left;
+}
+
+.plugin-card .column-updated,
+.plugin-card .column-compatibility {
+       float: right;
+       clear: right;
+}
+
</ins><span class="cx"> /* ms */
</span><span class="cx"> /* Background Color for Site Status */
</span><span class="cx"> .wp-list-table .site-deleted {
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpplugininstalllisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php (29046 => 29047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php       2014-07-09 19:18:44 UTC (rev 29046)
+++ trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php  2014-07-09 20:01:35 UTC (rev 29047)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">          if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) )
</span><span class="cx">                  $tab = key( $tabs );
</span><span class="cx"> 
</span><del>-               $args = array( 'page' => $paged, 'per_page' => $per_page );
</del><ins>+                $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => array( 'last_updated' => true, 'downloaded' => true ) );
</ins><span class="cx"> 
</span><span class="cx">          switch ( $tab ) {
</span><span class="cx">                  case 'search':
</span><span class="lines">@@ -154,6 +154,31 @@
</span><span class="cx">          return $display_tabs;
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Override the parent display() so we can provide a different container.
+        */
+       public function display() {
+               $singular = $this->_args['singular'];
+
+               $data_attr = '';
+
+               if ( $singular ) {
+                       $data_attr = " data-wp-lists='list:$singular'";
+               }
+
+               $this->display_tablenav( 'top' );
+
+?>
+<div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
+
+       <div id="the-list"<?php echo $data_attr; ?>>
+               <?php $this->display_rows_or_placeholder(); ?>
+       </div>
+</div>
+<?php
+               $this->display_tablenav( 'bottom' );
+       }
+
</ins><span class="cx">   protected function display_tablenav( $which ) {
</span><span class="cx">          if ( 'top' ==  $which ) { ?>
</span><span class="cx">                  <div class="tablenav top">
</span><span class="lines">@@ -211,52 +236,63 @@
</span><span class="cx">                          $plugin = (array) $plugin;
</span><span class="cx"> 
</span><span class="cx">                  $title = wp_kses( $plugin['name'], $plugins_allowedtags );
</span><del>-                       //Limit description to 400char, and remove any HTML.
-                       $description = strip_tags( $plugin['description'] );
-                       if ( strlen( $description ) > 400 )
-                               $description = mb_substr( $description, 0, 400 ) . '&#8230;';
-                       //remove any trailing entities
-                       $description = preg_replace( '/&[^;\s]{0,6}$/', '', $description );
-                       //strip leading/trailing & multiple consecutive lines
-                       $description = trim( $description );
-                       $description = preg_replace( "|(\r?\n)+|", "\n", $description );
-                       //\n => <br>
-                       $description = nl2br( $description );
</del><ins>+
+                       //Remove any HTML from the description.
+                       $description = strip_tags( $plugin['short_description'] );
</ins><span class="cx">                   $version = wp_kses( $plugin['version'], $plugins_allowedtags );
</span><span class="cx"> 
</span><span class="cx">                  $name = strip_tags( $title . ' ' . $version );
</span><span class="cx"> 
</span><span class="cx">                  $author = $plugin['author'];
</span><del>-                       if ( ! empty( $plugin['author'] ) )
-                               $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '.</cite>';
</del><span class="cx"> 
</span><ins>+                       if ( ! empty( $author ) ) {
+                               $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';
+                       }
+
</ins><span class="cx">                   $author = wp_kses( $author, $plugins_allowedtags );
</span><span class="cx"> 
</span><span class="cx">                  $action_links = array();
</span><del>-                       $action_links[] = '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
-                                                               '&amp;TB_iframe=true&amp;width=600&amp;height=550' ) . '" class="thickbox" title="' .
-                                                               esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '">' . __( 'Details' ) . '</a>';
</del><span class="cx"> 
</span><span class="cx">                  if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
</span><span class="cx">                          $status = install_plugin_install_status( $plugin );
</span><span class="cx"> 
</span><span class="cx">                          switch ( $status['status'] ) {
</span><span class="cx">                                  case 'install':
</span><del>-                                               if ( $status['url'] )
-                                                       $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
</del><ins>+                                                if ( $status['url'] ) {
+                                                       $action_links[] = '<a class="install-now button" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
+                                               }
+
</ins><span class="cx">                                           break;
</span><span class="cx">                                  case 'update_available':
</span><del>-                                               if ( $status['url'] )
-                                                       $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $status['version'] ) ) . '">' . __( 'Update Now' ) . '</a>';
</del><ins>+                                                if ( $status['url'] ) {
+                                                       $action_links[] = '<a class="button" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $status['version'] ) ) . '">' . __( 'Update Now' ) . '</a>';
+                                               }
+
</ins><span class="cx">                                           break;
</span><span class="cx">                                  case 'latest_installed':
</span><span class="cx">                                  case 'newer_installed':
</span><del>-                                               $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>';
</del><ins>+                                                $action_links[] = '<span class="button button-disabled" title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>';
</ins><span class="cx">                                           break;
</span><span class="cx">                          }
</span><span class="cx">                  }
</span><span class="cx"> 
</span><ins>+                       $details_link   = self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
+                                                               '&amp;TB_iframe=true&amp;width=600&amp;height=550' );
+
</ins><span class="cx">                   /**
</span><ins>+                        * Filter the details link for a plugin.
+                        *
+                        * @since 4.0
+                        *
+                        * @param array $details_link Link to view the current plugin's details.
+                        * @param array $plugin       The plugin currently being listed.
+                        */
+                       $details_link = apply_filters( 'plugin_install_details_link', $details_link, $plugin );
+
+                       $action_links[] = '<a href="' . esc_attr( $details_link ) . '" class="thickbox" title="' .
+                                                               esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '">' . __( 'More Details' ) . '</a>';
+
+                       /**
</ins><span class="cx">                    * Filter the install action links for a plugin.
</span><span class="cx">                   *
</span><span class="cx">                   * @since 2.7.0
</span><span class="lines">@@ -266,16 +302,45 @@
</span><span class="cx">                   */
</span><span class="cx">                  $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
</span><span class="cx">          ?>
</span><del>-               <tr>
-                       <td class="name column-name"<?php echo $style['name']; ?>><strong><?php echo $title; ?></strong>
-                               <div class="action-links"><?php if ( !empty( $action_links ) ) echo implode( ' | ', $action_links ); ?></div>
-                       </td>
-                       <td class="vers column-version"<?php echo $style['version']; ?>><?php echo $version; ?></td>
-                       <td class="vers column-rating"<?php echo $style['rating']; ?>>
-                               <?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?>
-                       </td>
-                       <td class="desc column-description"<?php echo $style['description']; ?>><?php echo $description, $author; ?></td>
-               </tr>
</del><ins>+                <div class="plugin-card">
+                       <div class="plugin-card-top">
+                               <div class="name column-name"<?php echo $style['name']; ?>><h4><a href="<?php echo esc_attr( $details_link ) ?>" class="thickbox"><?php echo $title; ?></a></h4>
+                                       <div class="action-links">
+                                               <?php
+                                                       if ( ! empty( $action_links ) ) {
+                                                               echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li>';
+                                                       }
+                                               ?>
+                                       </div>
+                               </div>
+                               <div class="desc column-description"<?php echo $style['description']; ?>>
+                                       <p><?php echo $description ?>
+                                       <span class="authors">
+                                               <?php echo $author; ?>
+                                       </span>
+                                       </p>
+                               </div>
+                       </div>
+                       <div class="plugin-card-bottom">
+                               <div class="vers column-rating"<?php echo $style['rating']; ?>>
+                                       <?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?>
+                                       <span class="num-ratings">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span>
+                               </div>
+                               <div class="column-updated"><?php echo __( '<strong>Last updated:</strong>' ) . ' '. sprintf( '%s ago', human_time_diff( strtotime($plugin['last_updated']) ) ); ?></div>
+                               <div class="column-downloaded"><?php echo sprintf( __('%s downloads'), number_format_i18n( $plugin['downloaded'] ) ); ?></div>
+                               <div class="column-compatibility">
+                               <?php
+                                       if ( ! empty( $plugin['tested'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) {
+                                               echo  __( '<strong>Untested</strong> with your install ');
+                                       } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) {
+                                               echo __( '<strong>Incompatible</strong> with your install ');
+                                       } else {
+                                               echo __( '<strong>Compatible</strong> with your install ');
+                                       }
+                               ?>
+                               </div>
+                       </div>
+               </div>
</ins><span class="cx">           <?php
</span><span class="cx">          }
</span><span class="cx">  }
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinswordpressimagesmorepng"></a>
<div class="binary"><h4>Modified: trunk/src/wp-includes/js/tinymce/skins/wordpress/images/more.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
</div>

</body>
</html>