@@ 196-200 (lines=5) @@ | ||
193 | */ |
|
194 | public function replace_images_in_content( $content ) { |
|
195 | if ( ! empty ( $this->options['cdn_link'] ) ) { |
|
196 | if ( preg_match_all( '/<img\s[^>]*src=([\"\']??)([^\" >]*?)\1[^>]*>/iU', $content, $matches ) ) { |
|
197 | foreach ( $matches[2] as $image_src ) { |
|
198 | $content = str_replace( $image_src, apply_filters( 'wp_get_attachment_url', $image_src ), $content ); |
|
199 | } |
|
200 | } |
|
201 | ||
202 | if ( preg_match_all( '/<img\s[^>]*srcset=([\"\']??)([^\">]*?)\1[^>]*\/?>/iU', $content, $matches ) ) { |
|
203 | ||
@@ 213-217 (lines=5) @@ | ||
210 | } |
|
211 | } |
|
212 | ||
213 | if ( preg_match_all( '/<a\s[^>]*href=([\"\']??)([^\" >]*?)\1[^>]*>(.*)<\/a>/iU', $content, $matches ) ) { |
|
214 | foreach ( $matches[0] as $link ) { |
|
215 | $content = str_replace( $link[2], apply_filters( 'wp_get_attachment_url', $link[2] ), $content ); |
|
216 | } |
|
217 | } |
|
218 | } |
|
219 | ||
220 | return $content; |