Make WordPress Core


Ignore:
Timestamp:
07/18/2008 03:19:12 AM (16 years ago)
Author:
ryan
Message:

Image sideload and wp_upload_dir() fixes from noel. fixes #7342 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/press-this.php

    r8332 r8369  
    3535
    3636            foreach( (array) $_REQUEST['photo_src'] as $key => $image) {
    37                 // escape quote for matching
    38                 $quoted = preg_quote2($image);
    39 
     37               
    4038                // see if files exist in content - we don't want to upload non-used selected files.
    41                 if( strpos($_REQUEST['content'], $quoted) !== false ) {
     39                if( strpos($_REQUEST['content'], $image) !== false ) {
    4240                    $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
     41                     
    4342                    // Replace the POSTED content <img> with correct uploaded ones.
     43                    // escape quote for matching
     44                    $quoted = preg_quote2($image);
    4445                    if( !is_wp_error($upload) ) $content = preg_replace('/<img ([^>]*)src=(\"|\')'.$quoted.'(\2)([^>\/]*)\/*>/is', $upload, $content);
    4546                }
Note: See TracChangeset for help on using the changeset viewer.