Index: /sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php (revision 6495)
+++ /sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php (revision 6496)
@@ -36,19 +36,32 @@
static $plugins_info_fields_defaults = array(
- 'added' => true,
- 'compatibility' => true,
- 'contributors' => true,
- 'downloaded' => true,
- 'downloadlink' => true,
- 'donate_link' => true,
- 'homepage' => true,
- 'last_updated' => true,
- 'rating' => true,
- 'ratings' => true,
- 'requires' => true,
- 'requires_php' => true,
- 'sections' => true,
- 'tags' => true,
- 'tested' => true,
+ 'added' => true,
+ 'compatibility' => true,
+ 'contributors' => false,
+ 'bare_contributors' => true,
+ 'downloaded' => true,
+ 'downloadlink' => true,
+ 'donate_link' => true,
+ 'homepage' => true,
+ 'last_updated' => true,
+ 'rating' => true,
+ 'ratings' => true,
+ 'requires' => true,
+ 'requires_php' => true,
+ 'sections' => true,
+ 'tags' => true,
+ 'tested' => true,
+ );
+
+ // Alterations made to default fields in the info/1.2 API.
+ static $plugins_info_fields_defaults_12 = array(
+ 'downloaded' => false,
+ 'bare_contributors' => false,
+ 'compatibility' => false,
+ 'description' => false,
+ 'banners' => true,
+ 'reviews' => true,
+ 'active_installs' => true,
+ 'contributors' => true,
);
@@ -72,4 +85,16 @@
);
+ // Alterations made to the default fields in the info/1.2 API.
+ static $query_plugins_fields_defaults_12 = array(
+ 'compatibility' => false,
+ 'sections' => false,
+ 'contributors' => false,
+ 'versions' => false,
+ 'screenshots' => false,
+ 'last_updated' => true,
+ 'icons' => true,
+ 'active_installs' => true,
+ );
+
public function __construct( $args ) {
$args = (object) $args;
@@ -105,7 +130,15 @@
if ( 'plugin_information' == $method ) {
- $fields = array_merge( $fields, self::$plugins_info_fields_defaults );
+ $fields = array_merge(
+ $fields,
+ self::$plugins_info_fields_defaults,
+ ( defined( 'PLUGINS_API_VERSION' ) && PLUGINS_API_VERSION >= 1.2 ) ? self::$plugins_info_fields_defaults_12 : array()
+ );
} elseif ( 'query_plugins' == $method ) {
- $fields = array_merge( $fields, self::$query_plugins_fields_defaults );
+ $fields = array_merge(
+ $fields,
+ self::$query_plugins_fields_defaults,
+ ( defined( 'PLUGINS_API_VERSION' ) && PLUGINS_API_VERSION >= 1.2 ) ? self::$query_plugins_fields_defaults_12 : array()
+ );
} else {
return array();
@@ -117,12 +150,4 @@
$fields['compatibility'] = false;
$fields['description'] = false;
- }
-
- // In the 1.2+ version of the info API, we default to returning a more detailed list of contributors.
- // This can be enabled in older versions of the API by passing the 'contributors' field.
- if ( defined( 'PLUGINS_API_VERSION' ) && PLUGINS_API_VERSION >= 1.2 ) {
- $fields['contributors'] = true;
- } elseif ( ! isset( $this->requested_fields['contributors'] ) ) {
- $fields['bare_contributors'] = true;
}
Index: /sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php (revision 6495)
+++ /sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api.php (revision 6496)
@@ -169,5 +169,5 @@
// Back-compatible routines.
- // WordPress 4.x and older need a "bare" contributor map
+ // WordPress 4.9 and older need a "bare" contributor map [ user => profile ]
if ( ! empty( $fields['bare_contributors'] ) ) {
$contribs = $response['contributors'];