Make WordPress Core

Ticket #28785: 28785-plugin-card-table-draft.5-alt.diff

File 28785-plugin-card-table-draft.5-alt.diff, 9.2 KB (added by ryelle, 11 years ago)
  • wp-admin/css/list-tables.css

     
    12151215        margin: 2.5em 0 8px;
    12161216}
    12171217
     1218/* Plugin card table view */
     1219.plugin-card {
     1220        float: left;
     1221        margin: 0 8px 16px;
     1222        width: 48.5%;
     1223        width: -webkit-calc( 50% - 8px );
     1224        width: calc( 50% - 8px );
     1225        background-color: #fff;
     1226        border: 1px solid #dedede;
     1227        box-sizing: border-box;
     1228}
     1229@media screen and ( max-width: 782px ) {
     1230        .plugin-card {
     1231                margin-left: 0;
     1232                margin-right: 0;
     1233                width: 100%;
     1234        }
     1235}
     1236.plugin-card:nth-child(odd) {
     1237        clear: both;
     1238        margin-left: 0;
     1239}
     1240.plugin-card:nth-child(even) {
     1241        margin-right: 0
     1242}
     1243.plugin-card-top {
     1244        padding: 20px 20px 10px;
     1245}
     1246div.action-links,
     1247.plugin-action-buttons {
     1248        margin: 0; /* Override existing margins */
     1249}
     1250.plugin-card h4 {
     1251        float: left;
     1252        margin: 0 0 12px;
     1253        font-size: 18px;
     1254}
     1255.plugin-card .desc {
     1256        clear: left;
     1257}
     1258.plugin-action-buttons {
     1259        float: right;
     1260        margin-left: 2em;
     1261        margin-bottom: 1em;
     1262        text-align: right;
     1263}
     1264.plugin-action-buttons li {
     1265        margin-bottom: 10px;
     1266}
     1267.plugin-card-bottom {
     1268        clear: both;
     1269        padding: 12px 20px;
     1270        background-color: #fafafa;
     1271        border-top: 1px solid #dedede;
     1272        overflow: hidden;
     1273}
     1274.plugin-card-bottom .star-rating {
     1275        display: inline;
     1276}
     1277.plugin-card .column-rating {
     1278        line-height: 23px;
     1279}
     1280.plugin-card .column-rating,
     1281.plugin-card .column-updated {
     1282        margin-bottom: 4px;
     1283}
     1284.plugin-card .column-rating,
     1285.plugin-card .column-downloaded {
     1286        float: left;
     1287        clear: left;
     1288}
     1289.plugin-card .column-updated,
     1290.plugin-card .column-compatibility {
     1291        float: right;
     1292        clear: right;
     1293}
     1294
    12181295/* ms */
    12191296/* Background Color for Site Status */
    12201297.wp-list-table .site-deleted {
  • wp-admin/includes/class-wp-plugin-install-list-table.php

     
    6363                if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) )
    6464                        $tab = key( $tabs );
    6565
    66                 $args = array( 'page' => $paged, 'per_page' => $per_page );
     66                $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => array( 'last_updated' => true, 'downloaded' => true ) );
    6767
    6868                switch ( $tab ) {
    6969                        case 'search':
     
    154154                return $display_tabs;
    155155        }
    156156
     157        /**
     158         * Override the parent display() so we can provide a different container.
     159         */
     160        public function display() {
     161                $singular = $this->_args['singular'];
     162
     163                $this->display_tablenav( 'top' );
     164
     165?>
     166<div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
     167
     168        <div id="the-list"<?php
     169                if ( $singular ) {
     170                        echo " data-wp-lists='list:$singular'";
     171                } ?>>
     172                <?php $this->display_rows_or_placeholder(); ?>
     173        </div>
     174</div>
     175<?php
     176                $this->display_tablenav( 'bottom' );
     177        }
     178
    157179        protected function display_tablenav( $which ) {
    158180                if ( 'top' ==  $which ) { ?>
    159181                        <div class="tablenav top">
     
    211233                                $plugin = (array) $plugin;
    212234
    213235                        $title = wp_kses( $plugin['name'], $plugins_allowedtags );
    214                         //Limit description to 400char, and remove any HTML.
    215                         $description = strip_tags( $plugin['description'] );
    216                         if ( strlen( $description ) > 400 )
    217                                 $description = mb_substr( $description, 0, 400 ) . '&#8230;';
    218                         //remove any trailing entities
    219                         $description = preg_replace( '/&[^;\s]{0,6}$/', '', $description );
    220                         //strip leading/trailing & multiple consecutive lines
    221                         $description = trim( $description );
    222                         $description = preg_replace( "|(\r?\n)+|", "\n", $description );
    223                         //\n => <br>
    224                         $description = nl2br( $description );
     236                        //Remove any HTML from the description.
     237                        $description = strip_tags( $plugin['short_description'] );
    225238                        $version = wp_kses( $plugin['version'], $plugins_allowedtags );
    226239
    227240                        $name = strip_tags( $title . ' ' . $version );
     
    228241
    229242                        $author = $plugin['author'];
    230243                        if ( ! empty( $plugin['author'] ) )
    231                                 $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '.</cite>';
     244                                $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';
    232245
    233246                        $author = wp_kses( $author, $plugins_allowedtags );
    234247
    235248                        $action_links = array();
    236                         $action_links[] = '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
    237                                                                 '&amp;TB_iframe=true&amp;width=600&amp;height=550' ) . '" class="thickbox" title="' .
    238                                                                 esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '">' . __( 'Details' ) . '</a>';
    239249
    240250                        if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
    241251                                $status = install_plugin_install_status( $plugin );
     
    243253                                switch ( $status['status'] ) {
    244254                                        case 'install':
    245255                                                if ( $status['url'] )
    246                                                         $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
     256                                                        $action_links[] = '<a class="install-now button" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
    247257                                                break;
    248258                                        case 'update_available':
    249259                                                if ( $status['url'] )
    250                                                         $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $status['version'] ) ) . '">' . __( 'Update Now' ) . '</a>';
     260                                                        $action_links[] = '<a class="button" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $status['version'] ) ) . '">' . __( 'Update Now' ) . '</a>';
    251261                                                break;
    252262                                        case 'latest_installed':
    253263                                        case 'newer_installed':
    254                                                 $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>';
     264                                                $action_links[] = '<span class="button button-disabled" title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>';
    255265                                                break;
    256266                                }
    257267                        }
    258268
     269                        $action_links[] = '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
     270                                                                '&amp;TB_iframe=true&amp;width=600&amp;height=550' ) . '" class="thickbox" title="' .
     271                                                                esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '">' . __( 'More Details' ) . '</a>';
     272
    259273                        /**
    260274                         * Filter the install action links for a plugin.
    261275                         *
     
    266280                         */
    267281                        $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
    268282                ?>
    269                 <tr>
    270                         <td class="name column-name"<?php echo $style['name']; ?>><strong><?php echo $title; ?></strong>
    271                                 <div class="action-links"><?php if ( !empty( $action_links ) ) echo implode( ' | ', $action_links ); ?></div>
    272                         </td>
    273                         <td class="vers column-version"<?php echo $style['version']; ?>><?php echo $version; ?></td>
    274                         <td class="vers column-rating"<?php echo $style['rating']; ?>>
    275                                 <?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?>
    276                         </td>
    277                         <td class="desc column-description"<?php echo $style['description']; ?>><?php echo $description, $author; ?></td>
    278                 </tr>
     283                <div class="plugin-card">
     284                        <div class="plugin-card-top">
     285                                <div class="name column-name"<?php echo $style['name']; ?>><h4><?php echo $title; ?></h4>
     286                                        <div class="action-links"><?php if ( !empty( $action_links ) ) echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li>'; ?></div>
     287                                </div>
     288                                <div class="desc column-description"<?php echo $style['description']; ?>>
     289                                        <p><?php echo $description ?>
     290                                        <span class="authors">
     291                                                <?php echo $author; ?>
     292                                                <?php if ( count( $plugin['contributors'] ) > 1 ) echo sprintf( __( '+ %d more' ), count( $plugin['contributors'] ) -1 ); ?>.
     293                                        </span>
     294                                        </p>
     295                                </div>
     296                        </div>
     297                        <div class="plugin-card-bottom">
     298                                <div class="vers column-rating"<?php echo $style['rating']; ?>>
     299                                        <?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?>
     300                                        <span class="num-ratings">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span>
     301                                </div>
     302                                <div class="column-updated"><?php echo __('<strong>Last updated:</strong>') . ' '. sprintf( '%s ago', human_time_diff( strtotime($plugin['last_updated']) ) ); ?></div>
     303                                <div class="column-downloaded"><?php echo sprintf( __('%s downloads'), number_format_i18n( $plugin['downloaded'] ) ); ?></div>
     304                                <div class="column-compatibility">
     305                                <?php
     306                                        if ( ! empty( $plugin['tested'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) )
     307                                                echo  __('<strong>Untested</strong> with your install');
     308
     309                                        else if ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) )
     310                                                echo __('<strong>Incompatible</strong> with your install');
     311                                        else
     312                                                echo __('<strong>Compatible</strong> with your install');
     313                                ?>
     314                                </div>
     315                        </div>
     316                </div>
    279317                <?php
    280318                }
    281319        }