Changeset 13605
- Timestamp:
- 04/29/2024 03:19:13 AM (5 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-language-pack.php
r13161 r13605 275 275 */ 276 276 private function get_plugin_stable_tag( $plugin_slug ) { 277 $plugin = @file_get_contents( "https://api.wordpress.org/plugins/info/1.0/{$plugin_slug}.json?fields=stable_tag" ); 277 $plugin = wp_remote_retrieve_body( 278 wp_safe_remote_get( 279 "https://api.wordpress.org/plugins/info/1.0/{$plugin_slug}.json?fields=stable_tag" 280 ) 281 ); 278 282 if ( ! $plugin ) { 279 283 return false; … … 292 296 */ 293 297 private function get_latest_theme_version( $theme_slug ) { 294 $theme = @file_get_contents( "https://api.wordpress.org/themes/info/1.1/?action=theme_information&request[slug]={$theme_slug}" ); 298 $theme = wp_remote_retrieve_body( 299 wp_safe_remote_get( 300 "https://api.wordpress.org/themes/info/1.1/?action=theme_information&request[slug]={$theme_slug}" 301 ) 302 ); 295 303 if ( ! $theme ) { 296 304 return false; … … 309 317 */ 310 318 private function get_latest_plugin_version( $plugin_slug ) { 311 $plugin = @file_get_contents( "https://api.wordpress.org/plugins/info/1.0/{$plugin_slug}.json" ); 319 $plugin = wp_remote_retrieve_body( 320 wp_safe_remote_get( 321 "https://api.wordpress.org/plugins/info/1.0/{$plugin_slug}.json" 322 ) 323 ); 312 324 if ( ! $plugin ) { 313 325 return false; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-plugin-directory/inc/cli/class-set-plugin-project.php
r7096 r13605 287 287 */ 288 288 private function get_plugin_details( $slug ) { 289 $http_context = $this->get_http_context(); 290 $json = @file_get_contents( "https://api.wordpress.org/plugins/info/1.0/{$slug}.json?fields=stable_tag,short_description", false, $http_context ); 289 $json = wp_remote_retrieve_body( 290 wp_safe_remote_get( 291 "https://api.wordpress.org/plugins/info/1.0/{$slug}.json?fields=stable_tag,short_description", 292 array( 293 'user-agent' => 'WordPress.org Translate', 294 ) 295 ) 296 ); 291 297 292 298 $details = $json && '{' == $json[0] ? json_decode( $json ) : null; … … 299 305 } 300 306 301 /**302 * Creates a stream context with a default HTTP user-agent.303 *304 * @return resource Stream context with a default HTTP user-agent.305 */306 private function get_http_context() {307 return stream_context_create( array(308 'http' => array(309 'user_agent' => 'WordPress.org Translate',310 ),311 ) );312 }313 307 } -
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 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-wp-plugins.php
r6851 r13605 150 150 $project->icon = $this->get_plugin_icon( $project, 64 ); 151 151 152 $http_context = stream_context_create( array( 153 'http' => array( 154 'user_agent' => 'WordPress.org Translate', 155 ), 156 ) ); 157 $json = file_get_contents( "https://api.wordpress.org/translations/plugins/1.0/?slug={$project_slug}", null, $http_context ); 152 $json = wp_remote_retrieve_body( 153 wp_safe_remote_get( 154 "https://api.wordpress.org/translations/plugins/1.0/?slug={$project_slug}", 155 array( 156 'user-agent' => 'WordPress.org Translate', 157 ) 158 ) 159 ); 158 160 $language_packs = $json && '{' == $json[0] ? json_decode( $json ) : null; 159 161
Note: See TracChangeset
for help on using the changeset viewer.