+ if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ) {
+ return;
+ }
+
+ $response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
+ foreach ( $response['plugins'] as &$plugin ) {
+ $plugin = (object) $plugin;
+ if ( isset( $plugin->compatibility ) ) {
+ $plugin->compatibility = (object) $plugin->compatibility;
+ foreach ( $plugin->compatibility as &$data ) {
+ $data = (object) $data;
+ }
+ }
+ }
+ unset( $plugin, $data );
+ foreach ( $response['no_update'] as &$plugin ) {
+ $plugin = (object) $plugin;
+ }
+ unset( $plugin );
+
+ if ( is_array( $response ) ) {
+ $new_option->response = $response['plugins'];
+ $new_option->translations = $response['translations'];
+ // TODO: Perhaps better to store no_update in a separate transient with an expiry?
+ $new_option->no_update = $response['no_update'];
+ } else {