WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7/wp-includes/post.php

    r10150 r10253  
    216216        else
    217217            return $null;
    218     } elseif ( is_object($post) ) {
     218    } elseif ( is_object($post) && empty($post->filter) ) {
    219219        _get_post_ancestors($post);
    220220        wp_cache_add($post->ID, $post, 'posts');
    221221        $_post = &$post;
    222222    } else {
     223        if ( is_object($post) )
     224            $post = $post->ID;
    223225        $post = (int) $post;
    224226        if ( ! $_post = wp_cache_get($post, 'posts') ) {
     
    740742    $custom = get_post_custom($post_id);
    741743
    742     return $custom[$key];
     744    return isset($custom[$key]) ? $custom[$key] : null;
    743745}
    744746
     
    793795        foreach ( array_keys(get_object_vars($post)) as $field )
    794796            $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
     797        $post->filter = $context;
    795798    } else {
    796799        if ( !isset($post['ID']) )
     
    798801        foreach ( array_keys($post) as $field )
    799802            $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
    800     }
     803        $post['filter'] = $context;
     804    }
     805
    801806    return $post;
    802807}
     
    25362541            if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location
    25372542                $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location
     2543            elseif ( false !== strpos($file, 'wp-content/uploads') )
     2544                $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
     2545            else
     2546                $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir.
    25382547        }
    25392548    }
Note: See TracChangeset for help on using the changeset viewer.