|
@@ 604-610 (lines=7) @@
|
| 601 |
|
} |
| 602 |
|
|
| 603 |
|
// background-image in inline style. |
| 604 |
|
if ( strpos( $out, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_backgroundimages', true ) ) { |
| 605 |
|
$out = preg_replace_callback( |
| 606 |
|
'/style=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)/', |
| 607 |
|
array( $this, 'replace_img_callback' ), |
| 608 |
|
$out |
| 609 |
|
); |
| 610 |
|
} |
| 611 |
|
|
| 612 |
|
// lazyload: restore noscript tags + lazyload picture source tags and bgimage. |
| 613 |
|
if ( $this->should_lazyload() ) { |
|
@@ 916-923 (lines=8) @@
|
| 913 |
|
} |
| 914 |
|
|
| 915 |
|
public function process_bgimage( $in ) { |
| 916 |
|
if ( strpos( $in, 'background-image:' ) !== false && apply_filters( 'autoptimize_filter_imgopt_lazyload_backgroundimages', true ) ) { |
| 917 |
|
$out = preg_replace_callback( |
| 918 |
|
'/(<(?:article|aside|body|div|footer|header|p|section|table)[^>]*)\sstyle=(?:"|\')[^<>]*?background-image:\s?url\((?:"|\')?([^"\')]*)(?:"|\')?\)[^>]*/', |
| 919 |
|
array( $this, 'lazyload_bgimg_callback' ), |
| 920 |
|
$in |
| 921 |
|
); |
| 922 |
|
return $out; |
| 923 |
|
} |
| 924 |
|
return $in; |
| 925 |
|
} |
| 926 |
|
|