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

Fixes #31865

Built from https://develop.svn.wordpress.org/trunk@31990


git-svn-id: http://core.svn.wordpress.org/trunk@31969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2015-04-02 23:49:27 +00:00
parent 213fd6fd24
commit 02403eadd1
3 changed files with 28 additions and 6 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 ) ) { ?>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-beta3-31989';
$wp_version = '4.2-beta3-31990';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.