Changeset 7282 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-ratings.php
- Timestamp:
- 06/07/2018 04:32:31 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-ratings.php
r6287 r7282 29 29 public function widget( $args, $instance ) { 30 30 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ratings', 'wporg-plugins' ) : $instance['title'], $instance, $this->id_base ); 31 $post = get_post(); 31 32 32 $post = get_post(); 33 $rating = get_post_meta( $post->ID, 'rating', true ) ?: 0; 34 $ratings = get_post_meta( $post->ID, 'ratings', true ) ?: array(); 33 if ( class_exists( '\WPORG_Ratings' ) ) { 34 $rating = \WPORG_Ratings::get_avg_rating( 'plugin', $post->post_name ) ?: 0; 35 $ratings = \WPORG_Ratings::get_rating_counts( 'plugin', $post->post_name ) ?: array(); 36 } else { 37 $rating = get_post_meta( $post->ID, 'rating', true ) ?: 0; 38 $ratings = get_post_meta( $post->ID, 'ratings', true ) ?: array(); 39 } 40 35 41 $num_ratings = array_sum( $ratings ); 36 42
Note: See TracChangeset
for help on using the changeset viewer.