Skip to content

Commit

Permalink
fix: better replacement for relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
preda-bogdan authored and selul committed May 29, 2019
1 parent 4ec00fb commit c18be2f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion inc/tag_replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,17 @@ public function process_image_tags( $content, $images = array() ) {
$src = $tmp = untrailingslashit( $this->upload_resource['content_host'] ) . $src;

$new_src = $is_slashed ? addcslashes( $src, '/' ) : $src;
$image_tag = str_replace( $images['img_url'][ $index ], $new_src, $image_tag );
$image_tag = str_replace(
array(
'"' . $images['img_url'][ $index ] . '"',
"'" . $images['img_url'][ $index ] . "'",
),
array(
'"' . $new_src . '"',
"'" . $new_src . "''",
),
$image_tag
);
$images['img_url'][ $index ] = $new_src;
}

Expand Down

0 comments on commit c18be2f

Please sign in to comment.