Code Duplication    Length = 7-8 lines in 2 locations

classes/autoptimizeImages.php 2 locations

@@ 636-642 (lines=7) @@
633
        }
634
635
        // background-image in inline style.
636
        if ( strpos( $out, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_backgroundimages', true ) ) {
637
            $out = preg_replace_callback(
638
                '/style=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)/',
639
                array( $this, 'replace_img_callback' ),
640
                $out
641
            );
642
        }
643
644
        // act on icon links.
645
        if ( ( strpos( $out, '<link rel="icon"' ) !== false || ( strpos( $out, "<link rel='icon'" ) !== false ) ) && apply_filters( 'autoptimize_filter_imgopt_linkicon', true ) ) {
@@ 974-981 (lines=8) @@
971
    }
972
973
    public function process_bgimage( $in ) {
974
        if ( strpos( $in, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_lazyload_backgroundimages', true ) ) {
975
            $out = preg_replace_callback(
976
                '/(<(?:article|aside|body|div|footer|header|p|section|table)[^>]*)\sstyle=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)[^>]*/',
977
                array( $this, 'lazyload_bgimg_callback' ),
978
                $in
979
            );
980
            return $out;
981
        }
982
        return $in;
983
    }
984