@@ 594-600 (lines=7) @@ | ||
591 | } |
|
592 | ||
593 | // background-image in inline style. |
|
594 | if ( strpos( $out, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_backgroundimages', true ) ) { |
|
595 | $out = preg_replace_callback( |
|
596 | '/style=(?:"|\').*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)/', |
|
597 | array( $this, 'replace_img_callback' ), |
|
598 | $out |
|
599 | ); |
|
600 | } |
|
601 | ||
602 | // lazyload: restore noscript tags + lazyload picture source tags and bgimage. |
|
603 | if ( $this->should_lazyload() ) { |
|
@@ 901-908 (lines=8) @@ | ||
898 | } |
|
899 | ||
900 | public function process_bgimage( $in ) { |
|
901 | if ( strpos( $in, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_lazyload_backgroundimages', true ) ) { |
|
902 | $out = preg_replace_callback( |
|
903 | '/(<(?:article|aside|body|div|footer|header|p|section|table)[^>]*)\sstyle=(?:"|\').*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)[^>]*/', |
|
904 | array( $this, 'lazyload_bgimg_callback' ), |
|
905 | $in |
|
906 | ); |
|
907 | return $out; |
|
908 | } |
|
909 | return $in; |
|
910 | } |
|
911 |