Changeset 42631
- Timestamp:
- 02/01/2018 05:16:15 AM (7 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php
r42343 r42631 146 146 'page' => $paged, 147 147 'per_page' => $per_page, 148 'fields' => array( 149 'last_updated' => true, 150 'icons' => true, 151 'active_installs' => true, 152 ), 153 // Send the locale and installed plugin slugs to the API so it can provide context-sensitive results. 148 // Send the locale to the API so it can provide context-sensitive results. 154 149 'locale' => get_user_locale(), 155 'installed_plugins' => array_keys( $installed_plugins ),156 150 ); 157 151 … … 176 170 177 171 case 'featured': 178 $args['fields']['group'] = true;179 $this->orderby = 'group';180 // No break!181 172 case 'popular': 182 173 case 'new': 183 174 case 'beta': 175 $args['browse'] = $tab; 176 break; 184 177 case 'recommended': 185 178 $args['browse'] = $tab; 179 // Include the list of installed plugins so we can get relevant results. 180 $args['installed_plugins'] = array_keys( $installed_plugins ); 186 181 break; 187 182 -
trunk/src/wp-admin/includes/plugin-install.php
r42459 r42631 100 100 */ 101 101 function plugins_api( $action, $args = array() ) { 102 // include an unmodified $wp_version 103 include( ABSPATH . WPINC . '/version.php' ); 102 104 103 105 if ( is_array( $args ) ) { … … 105 107 } 106 108 107 if ( ! isset( $args->per_page ) ) { 108 $args->per_page = 24; 109 if ( 'query_plugins' == $action ) { 110 if ( ! isset( $args->per_page ) ) { 111 $args->per_page = 24; 112 } 109 113 } 110 114 111 115 if ( ! isset( $args->locale ) ) { 112 116 $args->locale = get_user_locale(); 117 } 118 119 if ( ! isset( $args->wp_version ) ) { 120 $args->wp_version = substr( $wp_version, 0, 3 ); // X.y 113 121 } 114 122 … … 142 150 143 151 if ( false === $res ) { 144 // include an unmodified $wp_version 145 include( ABSPATH . WPINC . '/version.php' ); 146 147 $url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/'; 152 153 $url = 'http://api.wordpress.org/plugins/info/1.2/'; 154 $url = add_query_arg( 155 array( 156 'action' => $action, 157 'request' => $args, 158 ), 159 $url 160 ); 161 162 $http_url = $url; 148 163 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) { 149 164 $url = set_url_scheme( $url, 'https' ); … … 153 168 'timeout' => 15, 154 169 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ), 155 'body' => array(156 'action' => $action,157 'request' => serialize( $args ),158 ),159 170 ); 160 $request = wp_remote_ post( $url, $http_args );171 $request = wp_remote_get( $url, $http_args ); 161 172 162 173 if ( $ssl && is_wp_error( $request ) ) { … … 169 180 headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE 170 181 ); 171 $request = wp_remote_ post( $http_url, $http_args );182 $request = wp_remote_get( $http_url, $http_args ); 172 183 } 173 184 … … 183 194 ); 184 195 } else { 185 $res = maybe_unserialize( wp_remote_retrieve_body( $request ) ); 186 if ( ! is_object( $res ) && ! is_array( $res ) ) { 196 $res = json_decode( wp_remote_retrieve_body( $request ), true ); 197 if ( is_array( $res ) ) { 198 // Object casting is required in order to match the info/1.0 format. 199 $res = (object) $res; 200 } elseif ( null === $res ) { 187 201 $res = new WP_Error( 188 202 'plugins_api_failed', … … 194 208 wp_remote_retrieve_body( $request ) 195 209 ); 210 } 211 212 if ( isset( $res->error ) ) { 213 $res = new WP_Error( 'plugins_api_failed', $res->error ); 196 214 } 197 215 } … … 486 504 'plugin_information', array( 487 505 'slug' => wp_unslash( $_REQUEST['plugin'] ), 488 'is_ssl' => is_ssl(),489 'fields' => array(490 'banners' => true,491 'reviews' => true,492 'downloaded' => false,493 'active_installs' => true,494 ),495 506 ) 496 507 ); … … 708 719 <ul class="contributors"> 709 720 <?php 710 foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) { 711 if ( empty( $contrib_username ) && empty( $contrib_profile ) ) { 712 continue; 721 foreach ( (array) $api->contributors as $contrib_username => $contrib_details ) { 722 $contrib_name = $contrib_details['display_name']; 723 if ( ! $contrib_name ) { 724 $contrin_name = $contrib_username; 713 725 } 714 if ( empty( $contrib_username ) ) { 715 $contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile ); 716 } 717 $contrib_username = sanitize_user( $contrib_username ); 718 if ( empty( $contrib_profile ) ) { 719 echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' alt='' />{$contrib_username}</li>"; 720 } else { 721 echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&s=36' width='18' height='18' alt='' />{$contrib_username}</a></li>"; 722 } 726 $contrib_name = esc_html( $contrib_name ); 727 728 $contrib_profile = esc_url( $contrib_details['profile'] ); 729 $contrib_avatar = esc_url( add_query_arg( 's', '36', $contrib_details['avatar'] ) ); 730 731 echo "<li><a href='{$contrib_profile}' target='_blank'><img src='{$contrib_avatar}' width='18' height='18' alt='' />{$contrib_name}</a></li>"; 723 732 } 724 733 ?> -
trunk/src/wp-admin/update-core.php
r42343 r42631 278 278 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) { 279 279 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $cur_wp_version ); 280 } elseif ( isset( $plugin_data->update->compatibility->{$cur_wp_version} ) ) {281 $compat = $plugin_data->update->compatibility->{$cur_wp_version};282 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)' ), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes );283 280 } else { 284 281 $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $cur_wp_version ); … … 288 285 if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { 289 286 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version ); 290 } elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) {291 $update_compat = $plugin_data->update->compatibility->{$core_update_version};292 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)' ), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes );293 287 } else { 294 288 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $core_update_version ); -
trunk/src/wp-admin/update.php
r42343 r42631 110 110 'slug' => $plugin, 111 111 'fields' => array( 112 'short_description' => false, 113 'sections' => false, 114 'requires' => false, 115 'rating' => false, 116 'ratings' => false, 117 'downloaded' => false, 118 'last_updated' => false, 119 'added' => false, 120 'tags' => false, 121 'compatibility' => false, 122 'homepage' => false, 123 'donate_link' => false, 112 'sections' => false, 124 113 ), 125 114 )
Note: See TracChangeset
for help on using the changeset viewer.