@@ 634-640 (lines=7) @@ | ||
631 | } |
|
632 | ||
633 | // background-image in inline style. |
|
634 | if ( strpos( $out, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_backgroundimages', true ) ) { |
|
635 | $out = preg_replace_callback( |
|
636 | '/style=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)/', |
|
637 | array( $this, 'replace_img_callback' ), |
|
638 | $out |
|
639 | ); |
|
640 | } |
|
641 | ||
642 | // act on icon links. |
|
643 | if ( ( strpos( $out, '<link rel="icon"' ) !== false || ( strpos( $out, "<link rel='icon'" ) !== false ) ) && apply_filters( 'autoptimize_filter_imgopt_linkicon', true ) ) { |
|
@@ 965-972 (lines=8) @@ | ||
962 | } |
|
963 | ||
964 | public function process_bgimage( $in ) { |
|
965 | if ( strpos( $in, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_lazyload_backgroundimages', true ) ) { |
|
966 | $out = preg_replace_callback( |
|
967 | '/(<(?:article|aside|body|div|footer|header|p|section|table)[^>]*)\sstyle=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)[^>]*/', |
|
968 | array( $this, 'lazyload_bgimg_callback' ), |
|
969 | $in |
|
970 | ); |
|
971 | return $out; |
|
972 | } |
|
973 | return $in; |
|
974 | } |
|
975 |