Ticket #31865: 31865.diff
File 31865.diff, 7.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-wp-plugin-install-list-table.php
class WP_Plugin_Install_List_Table exten 93 93 * Filter tabs not associated with a menu item on the Plugin Install screen. 94 94 * 95 95 * @since 2.7.0 96 96 * 97 97 * @param array $nonmenu_tabs The tabs that don't have a Menu item on the Plugin Install screen. 98 98 */ 99 99 $nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs ); 100 100 101 101 // If a non-valid menu tab has been selected, And it's not a non-menu action. 102 102 if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) ) 103 103 $tab = key( $tabs ); 104 104 105 105 $args = array( 106 106 'page' => $paged, 107 107 'per_page' => $per_page, 108 'fields' => array( 'last_updated' => true, 'downloaded' => true, 'icons' => true ), 108 'fields' => array( 109 'last_updated' => true, 110 'icons' => true, 111 'active_installs' => true 112 ), 109 113 // Send the locale and installed plugin slugs to the API so it can provide context-sensitive results. 110 114 'locale' => get_locale(), 111 115 'installed_plugins' => $this->get_installed_plugin_slugs(), 112 116 ); 113 117 114 118 switch ( $tab ) { 115 119 case 'search': 116 120 $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; 117 121 $term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : ''; 118 122 119 123 switch ( $type ) { 120 124 case 'tag': 121 125 $args['tag'] = sanitize_title_with_dashes( $term ); 122 126 break; 123 127 case 'term': … … class WP_Plugin_Install_List_Table exten 466 470 <p><?php echo $description; ?></p> 467 471 <p class="authors"><?php echo $author; ?></p> 468 472 </div> 469 473 </div> 470 474 <div class="plugin-card-bottom"> 471 475 <div class="vers column-rating"> 472 476 <?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?> 473 477 <span class="num-ratings">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span> 474 478 </div> 475 479 <div class="column-updated"> 476 480 <strong><?php _e( 'Last Updated:' ); ?></strong> <span title="<?php echo esc_attr( date_i18n( $date_format, $last_updated_timestamp ) ); ?>"> 477 481 <?php printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) ); ?> 478 482 </span> 479 483 </div> 480 484 <div class="column-downloaded"> 481 <?php echo sprintf( _n( '%s download', '%s downloads', $plugin['downloaded'] ), number_format_i18n( $plugin['downloaded'] ) ); ?> 485 <?php 486 if ( $plugin['active_installs'] >= 1000000 ) { 487 $active_installs_text = _x( '1+ Million', 'Active plugin installs' ); 488 } else { 489 $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; 490 } 491 printf( __( '%s Active Installs' ), $active_installs_text ); 492 ?> 482 493 </div> 483 494 <div class="column-compatibility"> 484 495 <?php 485 496 if ( ! empty( $plugin['tested'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) { 486 497 echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress' ) . '</span>'; 487 498 } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) { 488 499 echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>'; 489 500 } else { 490 501 echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>'; 491 502 } 492 503 ?> 493 504 </div> 494 505 </div> 495 506 </div> 496 507 <?php -
src/wp-admin/includes/plugin-install.php
function install_plugin_install_status($ 336 336 /** 337 337 * Display plugin information in dialog box form. 338 338 * 339 339 * @since 2.7.0 340 340 */ 341 341 function install_plugin_information() { 342 342 global $tab; 343 343 344 344 if ( empty( $_REQUEST['plugin'] ) ) { 345 345 return; 346 346 } 347 347 348 348 $api = plugins_api( 'plugin_information', array( 349 349 'slug' => wp_unslash( $_REQUEST['plugin'] ), 350 350 'is_ssl' => is_ssl(), 351 'fields' => array( 'banners' => true, 'reviews' => true ) 351 'fields' => array( 352 'banners' => true, 353 'reviews' => true, 354 'downloaded' => false, 355 'active_installs' => true 356 ) 352 357 ) ); 353 358 354 359 if ( is_wp_error( $api ) ) { 355 360 wp_die( $api ); 356 361 } 357 362 358 363 $plugins_allowedtags = array( 359 364 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ), 360 365 'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ), 361 366 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 362 367 'div' => array( 'class' => array() ), 'span' => array( 'class' => array() ), 363 368 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 364 369 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 365 370 'img' => array( 'src' => array(), 'class' => array(), 'alt' => array() ) 366 371 ); … … function install_plugin_information() { 446 451 <div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'> 447 452 <div class="fyi"> 448 453 <ul> 449 454 <?php if ( ! empty( $api->version ) ) { ?> 450 455 <li><strong><?php _e( 'Version:' ); ?></strong> <?php echo $api->version; ?></li> 451 456 <?php } if ( ! empty( $api->author ) ) { ?> 452 457 <li><strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?></li> 453 458 <?php } if ( ! empty( $api->last_updated ) ) { ?> 454 459 <li><strong><?php _e( 'Last Updated:' ); ?></strong> <span title="<?php echo esc_attr( date_i18n( $date_format, $last_updated_timestamp ) ); ?>"> 455 460 <?php printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) ); ?> 456 461 </span></li> 457 462 <?php } if ( ! empty( $api->requires ) ) { ?> 458 463 <li><strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?></li> 459 464 <?php } if ( ! empty( $api->tested ) ) { ?> 460 465 <li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?></li> 461 <?php } if ( ! empty( $api->downloaded ) ) { ?> 462 <li><strong><?php _e( 'Downloaded:' ); ?></strong> <?php printf( _n( '%s time', '%s times', $api->downloaded ), number_format_i18n( $api->downloaded ) ); ?></li> 466 <?php } if ( ! empty( $api->active_installs ) ) { ?> 467 <li><strong><?php _e( 'Active Installs:' ); ?></strong> <?php 468 if ( $api->active_installs >= 1000000 ) { 469 _ex( '1+ Million', 'Active plugin installs' ); 470 } else { 471 echo number_format_i18n( $api->active_installs ) . '+'; 472 } 473 ?></li> 463 474 <?php } if ( ! empty( $api->slug ) && empty( $api->external ) ) { ?> 464 475 <li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e( 'WordPress.org Plugin Page »' ); ?></a></li> 465 476 <?php } if ( ! empty( $api->homepage ) ) { ?> 466 477 <li><a target="_blank" href="<?php echo esc_url( $api->homepage ); ?>"><?php _e( 'Plugin Homepage »' ); ?></a></li> 467 478 <?php } if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) { ?> 468 479 <li><a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin »' ); ?></a></li> 469 480 <?php } ?> 470 481 </ul> 471 482 <?php if ( ! empty( $api->rating ) ) { ?> 472 483 <h3><?php _e( 'Average Rating' ); ?></h3> 473 484 <?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?> 474 485 <small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small> 475 486 <?php } 476 487 477 488 if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {