Skip to content

Commit

Permalink
fix: image url replacement on custom WordPress directory structure, f…
Browse files Browse the repository at this point in the history
…ixes #79, thanks @hackles for reporting
  • Loading branch information
selul committed Mar 11, 2019
1 parent 6932302 commit 980fcef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inc/app_replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function set_properties() {
'directory' => $upload_data['basedir'],
);
$this->upload_resource['url_length'] = strlen( $this->upload_resource['url'] );
$this->upload_resource['content_path'] = str_replace( get_site_url(), '', content_url() );
$this->upload_resource['content_path'] = str_replace( get_home_url(), '', content_url() );

$service_data = $this->settings->get( 'service_data' );

Expand Down
2 changes: 1 addition & 1 deletion inc/tag_replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function process_image_tags( $content, $images = array() ) {

$src = $tmp = $is_slashed ? stripslashes( $images['img_url'][ $index ] ) : $images['img_url'][ $index ];

$src = $tmp = strpos( $src, $this->upload_resource['content_path'] ) === 0 ? untrailingslashit( get_site_url() ) . $src : $src;
$src = $tmp = strpos( $src, $this->upload_resource['content_path'] ) === 0 ? untrailingslashit( get_home_url() ) . $src : $src;

if ( apply_filters( 'optml_ignore_image_link', false, $src ) ||
false !== strpos( $src, Optml_Config::$service_url ) ||
Expand Down

0 comments on commit 980fcef

Please sign in to comment.