| @@ 231-241 (lines=11) @@ | ||
| 228 | $html_images = self::from_html( $post_id ); |
|
| 229 | $inserted_images = array(); |
|
| 230 | ||
| 231 | foreach ( $html_images as $html_image ) { |
|
| 232 | $src = wp_parse_url( $html_image['src'] ); |
|
| 233 | // strip off any query strings from src. |
|
| 234 | if ( ! empty( $src['scheme'] ) && ! empty( $src['host'] ) ) { |
|
| 235 | $inserted_images[] = $src['scheme'] . '://' . $src['host'] . $src['path']; |
|
| 236 | } elseif ( ! empty( $src['host'] ) ) { |
|
| 237 | $inserted_images[] = set_url_scheme( 'http://' . $src['host'] . $src['path'] ); |
|
| 238 | } else { |
|
| 239 | $inserted_images[] = site_url( '/' ) . $src['path']; |
|
| 240 | } |
|
| 241 | } |
|
| 242 | foreach ( $images as $i => $image ) { |
|
| 243 | if ( ! in_array( $image['src'], $inserted_images, true ) ) { |
|
| 244 | unset( $images[ $i ] ); |
|
| @@ 223-233 (lines=11) @@ | ||
| 220 | $html_images = self::from_html( $post_id ); |
|
| 221 | $inserted_images = array(); |
|
| 222 | ||
| 223 | foreach ( $html_images as $html_image ) { |
|
| 224 | $src = wp_parse_url( $html_image['src'] ); |
|
| 225 | // strip off any query strings from src |
|
| 226 | if ( ! empty( $src['scheme'] ) && ! empty( $src['host'] ) ) { |
|
| 227 | $inserted_images[] = $src['scheme'] . '://' . $src['host'] . $src['path']; |
|
| 228 | } elseif ( ! empty( $src['host'] ) ) { |
|
| 229 | $inserted_images[] = set_url_scheme( 'http://' . $src['host'] . $src['path'] ); |
|
| 230 | } else { |
|
| 231 | $inserted_images[] = site_url( '/' ) . $src['path']; |
|
| 232 | } |
|
| 233 | } |
|
| 234 | foreach ( $images as $i => $image ) { |
|
| 235 | if ( ! in_array( $image['src'], $inserted_images ) ) { |
|
| 236 | unset( $images[ $i ] ); |
|