Changeset 3420 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php
- Timestamp:
- 06/17/2016 08:27:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php
r2836 r3420 27 27 28 28 return $tonesque->color(); 29 } 30 31 /** 32 * Returns the two latest reviews of a specific plugin. 33 * 34 * @global \wpdb $wpdb WordPress database abstraction object. 35 * 36 * @todo Populate with review title/content. 37 * 38 * @param string $plugin_slug The plugin slug. 39 * @return array|false 40 */ 41 public static function get_plugin_reviews( $plugin_slug ) { 42 if ( false === ( $reviews = wp_cache_get( "{$plugin_slug}_reviews", 'wporg-plugins' ) ) ) { 43 global $wpdb; 44 45 $reviews = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM ratings WHERE object_type = 'plugin' AND object_slug = %s ORDER BY review_id DESC LIMIT 2", $plugin_slug ) ); 46 wp_cache_set( "{$plugin_slug}_reviews", $reviews, 'wporg-plugins', HOUR_IN_SECONDS ); 47 } 48 49 return $reviews; 29 50 } 30 51
Note: See TracChangeset
for help on using the changeset viewer.