Code Duplication    Length = 9-11 lines in 3 locations

classes/autoptimizeConfig.php 1 location

@@ 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
    ?>

classes/autoptimizeExtra.php 1 location

@@ 616-624 (lines=9) @@
613
            $_img_provider_stat_url = apply_filters( 'autoptimize_filter_extra_imgopt_stat_url', $_img_provider_stat_url );
614
615
            // only do the remote call if $_img_provider_stat_url is not empty to make sure no parse_url weirdness results in useless calls.
616
            if ( ! empty( $_img_provider_stat_url ) ) {
617
                $_img_stat_resp = wp_remote_get( $_img_provider_stat_url );
618
                if ( ! is_wp_error( $_img_stat_resp ) ) {
619
                    if ( '200' == wp_remote_retrieve_response_code( $_img_stat_resp ) ) {
620
                        $_img_provider_stat = json_decode( wp_remote_retrieve_body( $_img_stat_resp ), true );
621
                        update_option( 'autoptimize_imgopt_provider_stat', $_img_provider_stat );
622
                    }
623
                }
624
            }
625
        }
626
    }
627

classes/autoptimizeUtils.php 1 location

@@ 396-406 (lines=11) @@
393
    public static function check_service_availability( $return_result = false )
394
    {
395
        $service_availability_resp = wp_remote_get( 'https://misc.optimizingmatters.com/api/autoptimize_service_availablity.json?from=aomain&ver=' . AUTOPTIMIZE_PLUGIN_VERSION );
396
        if ( ! is_wp_error( $service_availability_resp ) ) {
397
            if ( '200' == wp_remote_retrieve_response_code( $service_availability_resp ) ) {
398
                $availabilities = json_decode( wp_remote_retrieve_body( $service_availability_resp ), true );
399
                if ( is_array( $availabilities ) ) {
400
                    update_option( 'autoptimize_service_availablity', $availabilities );
401
                    if ( $return_result ) {
402
                        return $availabilities;
403
                    }
404
                }
405
            }
406
        }
407
    }
408
409
    /**