Changeset 2986
- Timestamp:
- 04/20/2016 11:59:45 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r2927 r2986 142 142 $this->plugin_meta = \plugins_api( 'plugin_information', array( 143 143 'slug' => $post->post_name, 144 'fields' => array( 'active_installs' => true ),145 144 ) ); 146 145 ?> … … 184 183 */ 185 184 public function column_installs( $post ) { 186 if ( ! empty( $this->plugin_meta->active_installs ) ) { 187 echo number_format_i18n( $this->plugin_meta->active_installs ) . '+'; 185 $active_installs = get_post_meta( $post->ID, 'active_installs', true ); 186 if ( $active_installs >= 1000000 ) { 187 _e( '1+ million', 'wporg-plugins' ); 188 } elseif ( $active_installs <= 10 ) { 189 _e( 'Less than 10', 'wporg-plugins' ); 190 } else { 191 printf( "%s+", number_format_i18n( $active_installs ) ); 188 192 } 189 193 } … … 206 210 */ 207 211 public function column_support( $post ) { 208 $resolutions = get_post_meta( $post->ID, 'support_resolutions', true ); 209 $unresolved = empty( $resolutions ) ? 0 : $resolutions['no']; 210 $link_text = sprintf( __( '%d unresolved', 'wporg-plugins' ), $unresolved ); 212 $threads = get_post_meta( $post->ID, 'support_threads', true ); 213 $resolved = get_post_meta( $post->ID, 'support_threads_resolved', true ); 214 $unresolved = max( 0, $threads - $resolved ); 215 $link_text = sprintf( __( '%d unresolved', 'wporg-plugins' ), $unresolved ); 211 216 212 217 printf( '<a href="%s">%s</a>', esc_url( 'https://wordpress.org/support/plugin/' . $post->post_name ), $link_text ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r2621 r2986 10 10 11 11 /** 12 * @param string $plugin_slug12 * @param \WP_Post|int $post Optional. 13 13 * @return int 14 14 */ 15 static function get_active_installs_count( $plugin_slug ) { 16 if ( false === ( $count = wp_cache_get( $plugin_slug, 'plugin_active_installs' ) ) ) { 17 global $wpdb; 18 19 $count = (int) $wpdb->get_var( $wpdb->prepare( 20 "SELECT count FROM rev2_daily_stat_summary WHERE type = 'plugin' AND type_name = %s AND stat = 'active_installs' LIMIT 1", 21 $plugin_slug 22 ) ); 23 wp_cache_add( $plugin_slug, $count, 'plugin_active_installs', 1200 ); 24 } 25 26 if ( $count < 10 ) { 27 return 0; 28 } 29 30 if ( $count >= 1000000 ) { 31 return 1000000; 32 } 33 34 return strval( $count )[0] * pow( 10, floor( log10( $count ) ) ); 15 static function get_active_installs_count( $post = null ) { 16 $post = get_post( $post ); 17 18 return get_post_meta( $post->ID, 'active_installs', true ); 35 19 } 36 20 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php
r2983 r2986 183 183 'header_textdomain' => $this->plugin['TextDomain'], 184 184 'header_description' => $this->plugin['Description'], 185 'support_resolutions' => 0, 185 'support_threads' => 0, 186 'support_threads_resolved' => 0, 186 187 ), 187 188 ) ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-tags.php
r2612 r2986 35 35 36 36 function worg_plugins_template_active_installs( $full = true ) { 37 $count = WordPressdotorg\Plugin_Directory\Template::get_active_installs_count( get_post()->post_name);37 $count = WordPressdotorg\Plugin_Directory\Template::get_active_installs_count(); 38 38 39 if ( ! $count) {39 if ( $count <= 10 ) { 40 40 $text = __( 'Less than 10', 'wporg-plugins' ); 41 41 } elseif ( $count >= 1000000 ) {
Note: See TracChangeset
for help on using the changeset viewer.