WordPress.org

Making WordPress.org

Changeset 6488


Ignore:
Timestamp:
01/31/2018 04:30:38 AM (4 years ago)
Author:
dd32
Message:

API: Theme Directory: In the info/1.2 API default to sending a more complete author response.

See #111.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-themes-api.php

    r6486 r6488  
    339339        }
    340340
    341         // If there is a cached result, return that.
    342         $cache_key = sanitize_key( __METHOD__ . ':' . get_locale() . ':' . md5( serialize( $this->request ) ) );
    343         if ( false !== ( $this->response = wp_cache_get( $cache_key, $this->cache_group ) ) && empty( $this->request->cache_buster ) ) {
    344             return;
    345         }
    346 
    347341        // Set which fields wanted by default:
    348342        $defaults = array(
     
    356350            'template'     => true,
    357351        );
     352        if ( defined( 'THEMES_API_VERSION' ) && THEMES_API_VERSION >= 1.2 ) {
     353            $defaults['extended_author'] = true;
     354        }
    358355
    359356        if ( empty( $this->request->fields ) ) {
     
    361358        }
    362359        $this->fields = array_merge( $this->fields, $defaults, (array) $this->request->fields );
     360
     361        // If there is a cached result, return that.
     362        $cache_key = sanitize_key( __METHOD__ . ':' . get_locale() . ':' . $this->request->slug . ':' . md5( serialize( $this->fields ) ) );
     363        if ( false !== ( $this->response = wp_cache_get( $cache_key, $this->cache_group ) ) && empty( $this->request->cache_buster ) ) {
     364            return;
     365        }
    363366
    364367        if ( !empty( $post ) && 'repopackage' == $post->post_type && $this->request->slug === $post->post_name ) {
     
    440443        );
    441444
    442 
    443445        $this->fields = array_merge( $this->fields, $defaults, (array) $this->request->fields );
    444446
     
    596598        if ( $this->fields['extended_author'] ) {
    597599            $phil->author = (object) array(
     600                'profile' => 'https://profiles.wordpress.org/' . $author->user_nicename,
     601                'avatar' => 'https://secure.gravatar.com/avatar/' . md5( $author->user_email ) . '?s=96&d=monsterid&r=g',
    598602                'user_nicename' => $author->user_nicename,
    599603                'display_name'  => $author->display_name,
Note: See TracChangeset for help on using the changeset viewer.