Making WordPress.org

Changeset 13603


Ignore:
Timestamp:
04/29/2024 03:07:46 AM (2 years ago)
Author:
dd32
Message:

WP I18N Teams: Fetch the translation data via wp_http rather than direct file_get_contents().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/inc/locales.php

    r10631 r13603  
    261261        $counts   = $percentages = [];
    262262        foreach ( $projects as $project ) {
    263                 $results = json_decode( file_get_contents( 'https://translate.wordpress.org/api/projects/' . $project ) );
     263                $results = json_decode( wp_remote_retrieve_body( wp_safe_remote_get( 'https://translate.wordpress.org/api/projects/' . $project ) ) );
     264                if ( ! $results ) {
     265                        continue;
     266                }
     267
    264268                foreach ( $results->translation_sets as $set ) {
    265269
     
    294298        }
    295299
    296         set_transient( 'core_translation_data', $percentages, 900 );
     300        set_transient( 'core_translation_data', $percentages, 30 * MINUTE_IN_SECONDS );
    297301
    298302        return $percentages;
Note: See TracChangeset for help on using the changeset viewer.