WordPress.org

Making WordPress.org

Changeset 3543


Ignore:
Timestamp:
06/22/2016 01:10:16 PM (2 years ago)
Author:
tellyworth
Message:

Plugin directory: use WP_Http to query the translate API.

See #1691, #1692

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php

    r3519 r3543  
    434434        $api_url = esc_url_raw( 'https://translate.wordpress.org/api/projects/wp-plugins/' . $slug . '/' . $branch, array( 'https' ) );
    435435
     436        $http = new \WP_Http();
     437        $result = $http->request( $api_url );
     438
    436439        $out = array();
    437         if ( $json = file_get_contents( $api_url ) ) {
     440        if ( !is_wp_error( $result ) ) {
     441            $json = $result['body'];
    438442            if ( $data = json_decode( $json ) ) {
    439443                if ( isset( $data->translation_sets ) ) {
Note: See TracChangeset for help on using the changeset viewer.