mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Standardise on performing api.WordPress.org requests over SSL when possible, falling back to non-SSL when appropriate.
This also standardises the `User-Agent` used when communicating with WordPress.org, allowing for more consistent version detection. Fixes #42004. git-svn-id: https://develop.svn.wordpress.org/trunk@41605 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -131,10 +131,15 @@ function wp_get_popular_importers() {
|
||||
|
||||
if ( ! $popular_importers ) {
|
||||
$url = add_query_arg( array(
|
||||
'locale' => get_user_locale(),
|
||||
'locale' => $locale,
|
||||
'version' => $wp_version,
|
||||
), 'http://api.wordpress.org/core/importers/1.1/' );
|
||||
$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() );
|
||||
$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ) );
|
||||
|
||||
if ( wp_http_supports( array( 'ssl' ) ) ) {
|
||||
$url = set_url_scheme( $url, 'https' );
|
||||
}
|
||||
|
||||
$response = wp_remote_get( $url, $options );
|
||||
$popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user