Code Duplication    Length = 12-13 lines in 2 locations

classes/autoptimizeConfig.php 1 location

@@ 441-453 (lines=13) @@
438
    <div class="autoptimize_banner hidden">
439
    <ul>
440
    <?php
441
    if ( $this->settings_screen_do_remote_http ) {
442
        $ao_banner = get_transient( 'autoptimize_banner' );
443
        if ( empty( $ao_banner ) ) {
444
            $banner_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_news.html?ao_ver=' . AUTOPTIMIZE_PLUGIN_VERSION );
445
            if ( ! is_wp_error( $banner_resp ) ) {
446
                if ( '200' == wp_remote_retrieve_response_code( $banner_resp ) ) {
447
                    $ao_banner = wp_kses_post( wp_remote_retrieve_body( $banner_resp ) );
448
                    set_transient( 'autoptimize_banner', $ao_banner, WEEK_IN_SECONDS );
449
                }
450
            }
451
        }
452
        echo $ao_banner;
453
    }
454
    ?>
455
        <li><?php _e( "Need help? <a href='https://wordpress.org/plugins/autoptimize/faq/'>Check out the FAQ here</a>.", 'autoptimize' ); ?></li>
456
        <li><?php _e( 'Happy with Autoptimize?', 'autoptimize' ); ?><br /><a href="<?php echo network_admin_url(); ?>plugin-install.php?tab=search&type=author&s=optimizingmatters"><?php _e( 'Try my other plugins!', 'autoptimize' ); ?></a></li>

classes/autoptimizeCriticalCSSSettings.php 1 location

@@ 72-83 (lines=12) @@
69
            $ccss_explanation = '';
70
71
            // get the HTML with the explanation of what critical CSS is.
72
            if ( $this->settings_screen_do_remote_http ) {
73
                $ccss_explanation = get_transient( 'ccss_explain_ao26' );
74
                if ( empty( $ccss_explanation ) ) {
75
                    $ccss_expl_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_ccss_explain_ao26.html?ao_ver=' . AUTOPTIMIZE_PLUGIN_VERSION );
76
                    if ( ! is_wp_error( $ccss_expl_resp ) ) {
77
                        if ( '200' == wp_remote_retrieve_response_code( $ccss_expl_resp ) ) {
78
                            $ccss_explanation = wp_kses_post( wp_remote_retrieve_body( $ccss_expl_resp ) );
79
                            set_transient( 'ccss_explain_ao26', $ccss_explanation, WEEK_IN_SECONDS );
80
                        }
81
                    }
82
                }
83
            }
84
85
            // placeholder text in case HTML is empty.
86
            if ( empty( $ccss_explanation ) ) {