@@ 313-323 (lines=11) @@ | ||
310 | public static function check_service_availability( $return_result = false ) |
|
311 | { |
|
312 | $service_availability_resp = wp_remote_get( 'https://misc.optimizingmatters.com/api/autoptimize_service_availablity.json?from=aomain&ver=' . AUTOPTIMIZE_PLUGIN_VERSION ); |
|
313 | if ( ! is_wp_error( $service_availability_resp ) ) { |
|
314 | if ( '200' == wp_remote_retrieve_response_code( $service_availability_resp ) ) { |
|
315 | $availabilities = json_decode( wp_remote_retrieve_body( $service_availability_resp ), true ); |
|
316 | if ( is_array( $availabilities ) ) { |
|
317 | autoptimizeOptionWrapper::update_option( 'autoptimize_service_availablity', $availabilities ); |
|
318 | if ( $return_result ) { |
|
319 | return $availabilities; |
|
320 | } |
|
321 | } |
|
322 | } |
|
323 | } |
|
324 | return null; |
|
325 | } |
|
326 |
@@ 1294-1302 (lines=9) @@ | ||
1291 | ||
1292 | // only do the remote call if $url is not empty to make sure no parse_url |
|
1293 | // weirdness results in useless calls. |
|
1294 | if ( ! empty( $url ) ) { |
|
1295 | $response = wp_remote_get( $url ); |
|
1296 | if ( ! is_wp_error( $response ) ) { |
|
1297 | if ( '200' == wp_remote_retrieve_response_code( $response ) ) { |
|
1298 | $stats = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
1299 | autoptimizeOptionWrapper::update_option( 'autoptimize_imgopt_provider_stat', $stats ); |
|
1300 | } |
|
1301 | } |
|
1302 | } |
|
1303 | } |
|
1304 | } |
|
1305 |