@@ 410-418 (lines=9) @@ | ||
407 | <?php |
|
408 | if ( $this->settings_screen_do_remote_http ) { |
|
409 | $AO_banner = get_transient( 'autoptimize_banner' ); |
|
410 | if ( empty( $AO_banner ) ) { |
|
411 | $banner_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_news.html?ao_ver='.AUTOPTIMIZE_PLUGIN_VERSION ); |
|
412 | if ( ! is_wp_error( $banner_resp ) ) { |
|
413 | if ( '200' == wp_remote_retrieve_response_code( $banner_resp ) ) { |
|
414 | $AO_banner = wp_kses_post( wp_remote_retrieve_body( $banner_resp ) ); |
|
415 | set_transient('autoptimize_banner', $AO_banner, DAY_IN_SECONDS); |
|
416 | } |
|
417 | } |
|
418 | } |
|
419 | echo $AO_banner; |
|
420 | } |
|
421 | ?> |
@@ 311-321 (lines=11) @@ | ||
308 | public static function check_service_availability( $return_result = false ) |
|
309 | { |
|
310 | $service_availability_resp = wp_remote_get( 'https://misc.optimizingmatters.com/api/autoptimize_service_availablity.json?from=aomain&ver=' . AUTOPTIMIZE_PLUGIN_VERSION ); |
|
311 | if ( ! is_wp_error( $service_availability_resp ) ) { |
|
312 | if ( '200' == wp_remote_retrieve_response_code( $service_availability_resp ) ) { |
|
313 | $availabilities = json_decode( wp_remote_retrieve_body( $service_availability_resp ), true ); |
|
314 | if ( is_array( $availabilities ) ) { |
|
315 | update_option( 'autoptimize_service_availablity', $availabilities ); |
|
316 | if ( $return_result ) { |
|
317 | return $availabilities; |
|
318 | } |
|
319 | } |
|
320 | } |
|
321 | } |
|
322 | } |
|
323 | ||
324 | /** |
@@ 632-640 (lines=9) @@ | ||
629 | $_img_provider_stat_url = apply_filters( 'autoptimize_filter_extra_imgopt_stat_url', $_img_provider_stat_url ); |
|
630 | ||
631 | // only do the remote call if $_img_provider_stat_url is not empty to make sure no parse_url weirdness results in useless calls. |
|
632 | if ( ! empty( $_img_provider_stat_url ) ) { |
|
633 | $_img_stat_resp = wp_remote_get( $_img_provider_stat_url ); |
|
634 | if ( ! is_wp_error( $_img_stat_resp ) ) { |
|
635 | if ( '200' == wp_remote_retrieve_response_code( $_img_stat_resp ) ) { |
|
636 | $_img_provider_stat = json_decode( wp_remote_retrieve_body( $_img_stat_resp ), true ); |
|
637 | update_option( 'autoptimize_imgopt_provider_stat', $_img_provider_stat ); |
|
638 | } |
|
639 | } |
|
640 | } |
|
641 | } |
|
642 | } |
|
643 |