|
@@ 187-191 (lines=5) @@
|
| 184 |
|
*/ |
| 185 |
|
public function replace_images_in_content( $content ) { |
| 186 |
|
if ( ! empty ( $this->options['cdn_link'] ) ) { |
| 187 |
|
if ( preg_match_all( '/<img\s[^>]*src=([\"\']??)([^\" >]*?)\1[^>]*>/iU', $content, $matches ) ) { |
| 188 |
|
foreach ( $matches[2] as $image_src ) { |
| 189 |
|
$content = str_replace( $image_src, $this->replace_image_url( $image_src ), $content ); |
| 190 |
|
} |
| 191 |
|
} |
| 192 |
|
|
| 193 |
|
if ( preg_match_all( '/<img\s[^>]*srcset=([\"\']??)([^\">]*?)\1[^>]*\/?>/iU', $content, $matches ) ) { |
| 194 |
|
|
|
@@ 204-208 (lines=5) @@
|
| 201 |
|
} |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
if ( preg_match_all( '/<a\s[^>]*href=([\"\']??)([^\" >]*?)\1[^>]*>(.*)<\/a>/iU', $content, $matches ) ) { |
| 205 |
|
foreach ( $matches[0] as $link ) { |
| 206 |
|
$content = str_replace( $link[2], $this->replace_image_url( $link[2] ), $content ); |
| 207 |
|
} |
| 208 |
|
} |
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
return $content; |