@@ 617-623 (lines=7) @@ | ||
614 | } |
|
615 | ||
616 | // background-image in inline style. |
|
617 | if ( strpos( $out, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_backgroundimages', true ) ) { |
|
618 | $out = preg_replace_callback( |
|
619 | '/style=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)/', |
|
620 | array( $this, 'replace_img_callback' ), |
|
621 | $out |
|
622 | ); |
|
623 | } |
|
624 | ||
625 | // act on icon links. |
|
626 | if ( ( strpos( $out, '<link rel="icon"' ) !== false || ( strpos( $out, "<link rel='icon'" ) !== false ) ) && apply_filters( 'autoptimize_filter_imgopt_linkicon', true ) ) { |
|
@@ 939-946 (lines=8) @@ | ||
936 | } |
|
937 | ||
938 | public function process_bgimage( $in ) { |
|
939 | if ( strpos( $in, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_lazyload_backgroundimages', true ) ) { |
|
940 | $out = preg_replace_callback( |
|
941 | '/(<(?:article|aside|body|div|footer|header|p|section|table)[^>]*)\sstyle=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)[^>]*/', |
|
942 | array( $this, 'lazyload_bgimg_callback' ), |
|
943 | $in |
|
944 | ); |
|
945 | return $out; |
|
946 | } |
|
947 | return $in; |
|
948 | } |
|
949 |