Making WordPress.org

Changeset 4125


Ignore:
Timestamp:
09/24/2016 05:06:50 AM (10 years ago)
Author:
dd32
Message:

Plugin Directory: Switch from Categories back to Tags.

See #1719

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  
    1717                new Routes\Plugin_Favorites();
    1818                new Routes\Commit_Subscriptions();
    19                 new Routes\Popular_Categories();
     19                new Routes\Popular_Tags();
    2020                new Routes\Query_Plugins();
    2121                new Routes\SVN_Access();
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-popular-tags.php

    r4124 r4125  
    99 * @package WordPressdotorg_Plugin_Directory
    1010 */
    11 class Popular_Categories extends Base {
     11class Popular_Tags extends Base {
    1212
    1313        function __construct() {
    14                 register_rest_route( 'plugins/v1', '/popular-categories/?', array(
     14                register_rest_route( 'plugins/v1', '/popular-tags/?', array(
    1515                        'methods'  => WP_REST_Server::READABLE,
    16                         'callback' => array( $this, 'popular_categories' ),
     16                        'callback' => array( $this, 'popular_tags' ),
    1717                ) );
    1818        }
    … …  
    2424         * @return array A formatted array of all plugin categories on the site.
    2525         */
    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' ) );
    2828
    2929                $response = array();
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php

    r3897 r4125  
    205205                        $this->tags = explode( ',', $headers['tags'] );
    206206                        $this->tags = array_map( 'trim', $this->tags );
     207                        $this->tags = array_filter( $this->tags );
     208                        $this->tags = array_slice( $this->tags, 0, 5 );
    207209                }
    208210                if ( ! empty( $headers['requires'] ) ) {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php

    r3550 r4125  
    164164                        // Tags
    165165                        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;
    167167                        }
    168168
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php

    r3805 r4125  
    4242                                break;
    4343
    44                         case 'popular_categories':
     44                        case 'popular_tags':
    4545                        case 'hot_tags':
    46                                 $this->popular_categories( $request );
     46                                $this->popular_tags( $request );
    4747                                break;
    4848
    … …  
    177177
    178178        /**
    179          * API Endpoint for the 'populat_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 ) ) ) {
    183183                        $response = $this->internal_rest_api_call( 'plugins/v1/popular-categories', array( 'locale' => $request->locale ) );
    184184
    … …  
    200200         * Generates a cache key for a 'hot_categories' API request.
    201201         */
    202         protected function popular_categories_cache_key( $request ) {
     202        protected function popular_tags_cache_key( $request ) {
    203203                return 'hot_categories:' . $request->locale;
    204204        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php

    r3792 r4125  
    5757                        <li><?php printf( __( 'Active installs: %s', 'wporg-plugins' ), '<strong>' . Template::active_installs( false ) . '</strong>' ); ?></li>
    5858                        <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>
    6161                        <?php endif; ?>
    6262                </ul>
Note: See TracChangeset for help on using the changeset viewer.