Changeset 29047
- Timestamp:
- 07/09/2014 08:01:35 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/list-tables.css
r28682 r29047 1216 1216 } 1217 1217 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 -webkit-box-sizing: border-box; 1228 -moz-box-sizing: border-box; 1229 box-sizing: border-box; 1230 } 1231 1232 @media screen and ( max-width: 782px ) { 1233 .plugin-card { 1234 margin-left: 0; 1235 margin-right: 0; 1236 width: 100%; 1237 } 1238 } 1239 1240 .plugin-card:nth-child(odd) { 1241 clear: both; 1242 margin-left: 0; 1243 } 1244 1245 .plugin-card:nth-child(even) { 1246 margin-right: 0 1247 } 1248 1249 .plugin-card-top { 1250 padding: 20px 20px 10px; 1251 } 1252 1253 div.action-links, 1254 .plugin-action-buttons { 1255 margin: 0; /* Override existing margins */ 1256 } 1257 1258 .plugin-card h4 { 1259 float: left; 1260 margin: 0 0 12px; 1261 font-size: 18px; 1262 } 1263 1264 .plugin-card .desc { 1265 clear: left; 1266 } 1267 1268 .plugin-action-buttons { 1269 float: right; 1270 margin-left: 2em; 1271 margin-bottom: 1em; 1272 text-align: right; 1273 } 1274 1275 .plugin-action-buttons li { 1276 margin-bottom: 10px; 1277 } 1278 1279 .plugin-card-bottom { 1280 clear: both; 1281 padding: 12px 20px; 1282 background-color: #fafafa; 1283 border-top: 1px solid #dedede; 1284 overflow: hidden; 1285 } 1286 1287 .plugin-card-bottom .star-rating { 1288 display: inline; 1289 } 1290 1291 .plugin-card .column-rating { 1292 line-height: 23px; 1293 } 1294 1295 .plugin-card .column-rating, 1296 .plugin-card .column-updated { 1297 margin-bottom: 4px; 1298 } 1299 1300 .plugin-card .column-rating, 1301 .plugin-card .column-downloaded { 1302 float: left; 1303 clear: left; 1304 } 1305 1306 .plugin-card .column-updated, 1307 .plugin-card .column-compatibility { 1308 float: right; 1309 clear: right; 1310 } 1311 1218 1312 /* ms */ 1219 1313 /* Background Color for Site Status */ -
trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php
r28749 r29047 64 64 $tab = key( $tabs ); 65 65 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 ) ); 67 67 68 68 switch ( $tab ) { … … 153 153 154 154 return $display_tabs; 155 } 156 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 $data_attr = ''; 164 165 if ( $singular ) { 166 $data_attr = " data-wp-lists='list:$singular'"; 167 } 168 169 $this->display_tablenav( 'top' ); 170 171 ?> 172 <div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> 173 174 <div id="the-list"<?php echo $data_attr; ?>> 175 <?php $this->display_rows_or_placeholder(); ?> 176 </div> 177 </div> 178 <?php 179 $this->display_tablenav( 'bottom' ); 155 180 } 156 181 … … 212 237 213 238 $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 ) . '…'; 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 ); 239 240 //Remove any HTML from the description. 241 $description = strip_tags( $plugin['short_description'] ); 225 242 $version = wp_kses( $plugin['version'], $plugins_allowedtags ); 226 243 … … 228 245 229 246 $author = $plugin['author']; 230 if ( ! empty( $plugin['author'] ) ) 231 $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '.</cite>'; 247 248 if ( ! empty( $author ) ) { 249 $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>'; 250 } 232 251 233 252 $author = wp_kses( $author, $plugins_allowedtags ); 234 253 235 254 $action_links = array(); 236 $action_links[] = '<a href="' . self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] .237 '&TB_iframe=true&width=600&height=550' ) . '" class="thickbox" title="' .238 esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '">' . __( 'Details' ) . '</a>';239 255 240 256 if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { … … 243 259 switch ( $status['status'] ) { 244 260 case 'install': 245 if ( $status['url'] ) 246 $action_links[] = '<a class="install-now" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>'; 261 if ( $status['url'] ) { 262 $action_links[] = '<a class="install-now button" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>'; 263 } 264 247 265 break; 248 266 case 'update_available': 249 if ( $status['url'] ) 250 $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $status['version'] ) ) . '">' . __( 'Update Now' ) . '</a>'; 267 if ( $status['url'] ) { 268 $action_links[] = '<a class="button" href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $status['version'] ) ) . '">' . __( 'Update Now' ) . '</a>'; 269 } 270 251 271 break; 252 272 case 'latest_installed': 253 273 case 'newer_installed': 254 $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>';274 $action_links[] = '<span class="button button-disabled" title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>'; 255 275 break; 256 276 } 257 277 } 278 279 $details_link = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . 280 '&TB_iframe=true&width=600&height=550' ); 281 282 /** 283 * Filter the details link for a plugin. 284 * 285 * @since 4.0 286 * 287 * @param array $details_link Link to view the current plugin's details. 288 * @param array $plugin The plugin currently being listed. 289 */ 290 $details_link = apply_filters( 'plugin_install_details_link', $details_link, $plugin ); 291 292 $action_links[] = '<a href="' . esc_attr( $details_link ) . '" class="thickbox" title="' . 293 esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '">' . __( 'More Details' ) . '</a>'; 258 294 259 295 /** … … 267 303 $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); 268 304 ?> 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> 305 <div class="plugin-card"> 306 <div class="plugin-card-top"> 307 <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> 308 <div class="action-links"> 309 <?php 310 if ( ! empty( $action_links ) ) { 311 echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li>'; 312 } 313 ?> 314 </div> 315 </div> 316 <div class="desc column-description"<?php echo $style['description']; ?>> 317 <p><?php echo $description ?> 318 <span class="authors"> 319 <?php echo $author; ?> 320 </span> 321 </p> 322 </div> 323 </div> 324 <div class="plugin-card-bottom"> 325 <div class="vers column-rating"<?php echo $style['rating']; ?>> 326 <?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?> 327 <span class="num-ratings">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span> 328 </div> 329 <div class="column-updated"><?php echo __( '<strong>Last updated:</strong>' ) . ' '. sprintf( '%s ago', human_time_diff( strtotime($plugin['last_updated']) ) ); ?></div> 330 <div class="column-downloaded"><?php echo sprintf( __('%s downloads'), number_format_i18n( $plugin['downloaded'] ) ); ?></div> 331 <div class="column-compatibility"> 332 <?php 333 if ( ! empty( $plugin['tested'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) { 334 echo __( '<strong>Untested</strong> with your install '); 335 } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) { 336 echo __( '<strong>Incompatible</strong> with your install '); 337 } else { 338 echo __( '<strong>Compatible</strong> with your install '); 339 } 340 ?> 341 </div> 342 </div> 343 </div> 279 344 <?php 280 345 }
Note: See TracChangeset
for help on using the changeset viewer.