Skip to content

Commit

Permalink
Remove hardcoded wp-uploads URL
Browse files Browse the repository at this point in the history
  • Loading branch information
simultech committed Oct 20, 2016
1 parent c44f2eb commit efddf67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions shorthand_connect/includes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ function sh_get_story_path($post_id, $story_id) {
return $destination_path;
}

function sh_get_story_url($post_id, $story_id) {
WP_Filesystem();
$destination = wp_upload_dir();
$destination_url = $destination['url'].'/shorthand/'.$post_id.'/'.$story_id;
return $destination_url;
}

function sh_copy_story($post_id, $story_id) {

// Set the maximum memory limit for the entire operation (this is already called later by unzip_file, but lets do it earlier)
Expand Down
2 changes: 1 addition & 1 deletion shorthand_connect/shorthand_connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function shand_save_shorthand_story( $post_id, $post, $update ) {
update_post_meta($post_id, 'story_path', $story_path);

// Get path to the assets
$assets_path = get_site_url().substr($story_path, strpos($story_path, '/wp-content/uploads'));
$assets_path = sh_get_story_url($post_id, $safe_story_id);

// Save the head and body
$body = shand_fix_content_paths($assets_path, file_get_contents($story_path.'/component_article.html'));
Expand Down

0 comments on commit efddf67

Please # to comment.