@@ 642-648 (lines=7) @@ | ||
639 | } |
|
640 | ||
641 | // background-image in inline style. |
|
642 | if ( strpos( $out, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_backgroundimages', true ) ) { |
|
643 | $out = preg_replace_callback( |
|
644 | '/style=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)/', |
|
645 | array( $this, 'replace_img_callback' ), |
|
646 | $out |
|
647 | ); |
|
648 | } |
|
649 | ||
650 | // act on icon links. |
|
651 | if ( ( strpos( $out, '<link rel="icon"' ) !== false || ( strpos( $out, "<link rel='icon'" ) !== false ) ) && apply_filters( 'autoptimize_filter_imgopt_linkicon', true ) ) { |
|
@@ 980-987 (lines=8) @@ | ||
977 | } |
|
978 | ||
979 | public function process_bgimage( $in ) { |
|
980 | if ( strpos( $in, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_lazyload_backgroundimages', true ) ) { |
|
981 | $out = preg_replace_callback( |
|
982 | '/(<(?:article|aside|body|div|footer|header|p|section|span|table)[^>]*)\sstyle=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)[^>]*/', |
|
983 | array( $this, 'lazyload_bgimg_callback' ), |
|
984 | $in |
|
985 | ); |
|
986 | return $out; |
|
987 | } |
|
988 | return $in; |
|
989 | } |
|
990 |