Changeset 13605 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-wp-directory.php
- Timestamp:
- 04/29/2024 03:19:13 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-wp-directory.php
r6690 r13605 200 200 */ 201 201 public function get_language_packs( $type, $slug ) { 202 $http_context = stream_context_create( array(203 'http' => array(204 'user_agent' => 'WordPress.org Translate',205 ),206 ) );207 202 if ( 'plugin' === $type ) { 208 203 $type = 'plugins'; … … 210 205 $type = 'themes'; 211 206 } 212 $json = file_get_contents( "https://api.wordpress.org/translations/$type/1.0/?slug={$slug}", null, $http_context ); 207 208 $json = wp_remote_retrieve_body( 209 wp_safe_remote_get( 210 "https://api.wordpress.org/translations/$type/1.0/?slug={$slug}", 211 array( 212 'user-agent' => 'WordPress.org Translate', 213 ) 214 ) 215 ); 213 216 $language_packs = $json && '{' == $json[0] ? json_decode( $json ) : null; 214 217
Note: See TracChangeset
for help on using the changeset viewer.