WordPress.org

Making WordPress.org

Changeset 6489


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

Theme Directory: API: In info/1.2 do not vary the response of feature_list based on the UA, only explicit GET variables.

See #111

File:
1 edited

Legend:

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

    r6488 r6489  
    232232        );
    233233
    234         // Get version from user agent since it's not explicitly sent to feature_list requests.
    235         if ( preg_match( '|WordPress/([^;]+)|', $_SERVER['HTTP_USER_AGENT'], $matches ) ) {
     234        // The 1.2+ api expects a `wp_version` field to be sent and does not use the UA.
     235        if ( defined( 'THEMES_API_VERSION' ) && THEMES_API_VERSION >= 1.2 ) {
     236            if ( isset( $this->request->wp_version ) ) {
     237                $wp_version = $this->request->wp_version;
     238            }
     239        } elseif ( preg_match( '|WordPress/([^;]+)|', $_SERVER['HTTP_USER_AGENT'], $matches ) ) {
     240            // Get version from user agent since it's not explicitly sent to feature_list requests in older API branches.
    236241            $wp_version = $matches[1];
    237242        }
Note: See TracChangeset for help on using the changeset viewer.