Changeset 4125
- Timestamp:
- 09/24/2016 05:06:50 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/class-base.php
r3556 r4125 17 17 new Routes\Plugin_Favorites(); 18 18 new Routes\Commit_Subscriptions(); 19 new Routes\Popular_ Categories();19 new Routes\Popular_Tags(); 20 20 new Routes\Query_Plugins(); 21 21 new Routes\SVN_Access(); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-popular-tags.php
r4124 r4125 9 9 * @package WordPressdotorg_Plugin_Directory 10 10 */ 11 class Popular_ Categories extends Base {11 class Popular_Tags extends Base { 12 12 13 13 function __construct() { 14 register_rest_route( 'plugins/v1', '/popular- categories/?', array(14 register_rest_route( 'plugins/v1', '/popular-tags/?', array( 15 15 'methods' => WP_REST_Server::READABLE, 16 'callback' => array( $this, 'popular_ categories' ),16 'callback' => array( $this, 'popular_tags' ), 17 17 ) ); 18 18 } … … 24 24 * @return array A formatted array of all plugin categories on the site. 25 25 */ 26 function popular_ categories( $request ) {27 $terms = get_terms( 'plugin_ category', array( 'hide_empty' => false, 'orderby' => 'count', 'order' => 'DESC' ) );26 function popular_tags( $request ) { 27 $terms = get_terms( 'plugin_tags', array( 'hide_empty' => false, 'orderby' => 'count', 'order' => 'DESC' ) ); 28 28 29 29 $response = array(); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php
r3897 r4125 205 205 $this->tags = explode( ',', $headers['tags'] ); 206 206 $this->tags = array_map( 'trim', $this->tags ); 207 $this->tags = array_filter( $this->tags ); 208 $this->tags = array_slice( $this->tags, 0, 5 ); 207 209 } 208 210 if ( ! empty( $headers['requires'] ) ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php
r3550 r4125 164 164 // Tags 165 165 if ( ! empty( $this->args->tag ) ) { 166 $query['plugin_ category'] = is_array( $this->args->tag ) ? reset( $this->args->tag ) : $this->args->tag;166 $query['plugin_tag'] = is_array( $this->args->tag ) ? reset( $this->args->tag ) : $this->args->tag; 167 167 } 168 168 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php
r3805 r4125 42 42 break; 43 43 44 case 'popular_ categories':44 case 'popular_tags': 45 45 case 'hot_tags': 46 $this->popular_ categories( $request );46 $this->popular_tags( $request ); 47 47 break; 48 48 … … 177 177 178 178 /** 179 * API Endpoint for the 'popula t_categories' and 'hot_tags' API endpoints.180 */ 181 public function popular_ categories( $request ) {182 if ( false === ( $response = false&& wp_cache_get( $cache_key = $this->popular_ categories_cache_key( $request ), self::CACHE_GROUP ) ) ) {179 * API Endpoint for the 'popular_tags' and 'hot_tags' API endpoints. 180 */ 181 public function popular_tags( $request ) { 182 if ( false === ( $response = false&& wp_cache_get( $cache_key = $this->popular_tags_cache_key( $request ), self::CACHE_GROUP ) ) ) { 183 183 $response = $this->internal_rest_api_call( 'plugins/v1/popular-categories', array( 'locale' => $request->locale ) ); 184 184 … … 200 200 * Generates a cache key for a 'hot_categories' API request. 201 201 */ 202 protected function popular_ categories_cache_key( $request ) {202 protected function popular_tags_cache_key( $request ) { 203 203 return 'hot_categories:' . $request->locale; 204 204 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php
r3792 r4125 57 57 <li><?php printf( __( 'Active installs: %s', 'wporg-plugins' ), '<strong>' . Template::active_installs( false ) . '</strong>' ); ?></li> 58 58 <li><?php printf( __( 'Tested up to: %s', 'wporg-plugins' ), '<strong>' . (string) get_post_meta( $post->ID, 'tested', true ) . '</strong>' ); ?></li> 59 <?php if ( $ categories = get_the_term_list( $post->ID, 'plugin_category', '<div class="tags">', '', '</div>' ) ) : ?>60 <li><?php printf( _n( ' Category: %s', 'Categories: %s', count( get_the_terms( $post, 'plugin_category' ) ), 'wporg-plugins' ), $categories ); ?></li>59 <?php if ( $tags = get_the_term_list( $post->ID, 'plugin_tags', '<div class="tags">', '', '</div>' ) ) : ?> 60 <li><?php printf( _n( 'Tags: %s', 'Tags: %s', count( get_the_terms( $post, 'plugin_tags' ) ), 'wporg-plugins' ), $tags ); ?></li> 61 61 <?php endif; ?> 62 62 </ul>
Note: See TracChangeset
for help on using the changeset viewer.