Plugins Browser: Replace the download count with the number of Active installs of the plugin.

Fixes #31865


git-svn-id: https://develop.svn.wordpress.org/trunk@31990 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2015-04-02 23:48:26 +00:00
parent bd13a5ec12
commit 248c73b1cf
2 changed files with 27 additions and 5 deletions

View File

@ -105,7 +105,11 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$args = array(
'page' => $paged,
'per_page' => $per_page,
'fields' => array( 'last_updated' => true, 'downloaded' => true, 'icons' => true ),
'fields' => array(
'last_updated' => true,
'icons' => true,
'active_installs' => true
),
// Send the locale and installed plugin slugs to the API so it can provide context-sensitive results.
'locale' => get_locale(),
'installed_plugins' => $this->get_installed_plugin_slugs(),
@ -478,7 +482,14 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
</span>
</div>
<div class="column-downloaded">
<?php echo sprintf( _n( '%s download', '%s downloads', $plugin['downloaded'] ), number_format_i18n( $plugin['downloaded'] ) ); ?>
<?php
if ( $plugin['active_installs'] >= 1000000 ) {
$active_installs_text = _x( '1+ Million', 'Active plugin installs' );
} else {
$active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+';
}
printf( __( '%s Active Installs' ), $active_installs_text );
?>
</div>
<div class="column-compatibility">
<?php

View File

@ -348,7 +348,12 @@ function install_plugin_information() {
$api = plugins_api( 'plugin_information', array(
'slug' => wp_unslash( $_REQUEST['plugin'] ),
'is_ssl' => is_ssl(),
'fields' => array( 'banners' => true, 'reviews' => true )
'fields' => array(
'banners' => true,
'reviews' => true,
'downloaded' => false,
'active_installs' => true
)
) );
if ( is_wp_error( $api ) ) {
@ -458,8 +463,14 @@ function install_plugin_information() {
<li><strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?></li>
<?php } if ( ! empty( $api->tested ) ) { ?>
<li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?></li>
<?php } if ( ! empty( $api->downloaded ) ) { ?>
<li><strong><?php _e( 'Downloaded:' ); ?></strong> <?php printf( _n( '%s time', '%s times', $api->downloaded ), number_format_i18n( $api->downloaded ) ); ?></li>
<?php } if ( ! empty( $api->active_installs ) ) { ?>
<li><strong><?php _e( 'Active Installs:' ); ?></strong> <?php
if ( $api->active_installs >= 1000000 ) {
_ex( '1+ Million', 'Active plugin installs' );
} else {
echo number_format_i18n( $api->active_installs ) . '+';
}
?></li>
<?php } if ( ! empty( $api->slug ) && empty( $api->external ) ) { ?>
<li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e( 'WordPress.org Plugin Page &#187;' ); ?></a></li>
<?php } if ( ! empty( $api->homepage ) ) { ?>