Make WordPress Core

Changeset 21597


Ignore:
Timestamp:
08/23/2012 08:01:10 PM (12 years ago)
Author:
ryan
Message:

Remove return ref from all calls to get_post()
Return WP_Post from get_default_post_to_edit()
Replace all calls to get_page() with get_post()
see #21309

Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r21322 r21597  
    104104            $deleted = 0;
    105105            foreach( (array) $post_ids as $post_id ) {
    106                 $post_del = & get_post($post_id);
     106                $post_del = get_post($post_id);
    107107
    108108                if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
  • trunk/wp-admin/includes/ajax-actions.php

    r21504 r21597  
    513513        wp_die( -1 );
    514514
    515     if ( !get_page( $id ) )
     515    if ( ! get_post( $id ) )
    516516        wp_die( 1 );
    517517
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r21504 r21597  
    510510                        $find_main_page = (int) $post->post_parent;
    511511                        while ( $find_main_page > 0 ) {
    512                             $parent = get_page( $find_main_page );
     512                            $parent = get_post( $find_main_page );
    513513
    514514                            if ( is_null( $parent ) )
  • trunk/wp-admin/includes/media.php

    r21504 r21597  
    894894 */
    895895function image_media_send_to_editor($html, $attachment_id, $attachment) {
    896     $post =& get_post($attachment_id);
     896    $post = get_post($attachment_id);
    897897    if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
    898898        $url = $attachment['url'];
     
    921921function get_attachment_fields_to_edit($post, $errors = null) {
    922922    if ( is_int($post) )
    923         $post =& get_post($post);
     923        $post = get_post($post);
    924924    if ( is_array($post) )
    925         $post = (object) $post;
     925        $post = new WP_Post( (object) $post );
    926926
    927927    $image_url = wp_get_attachment_url($post->ID);
  • trunk/wp-admin/includes/post.php

    r21300 r21597  
    161161    // Autosave shouldn't save too soon after a real save
    162162    if ( 'autosave' == $post_data['action'] ) {
    163         $post =& get_post( $post_ID );
     163        $post = get_post( $post_ID );
    164164        $now = time();
    165165        $then = strtotime($post->post_date_gmt . ' +0000');
     
    440440        $post->post_parent = 0;
    441441        $post->menu_order = 0;
     442        $post = new WP_Post( $post );
    442443    }
    443444
     
    746747 */
    747748function _fix_attachment_links( $post_ID ) {
    748     $post = & get_post( $post_ID, ARRAY_A );
     749    $post = get_post( $post_ID, ARRAY_A );
    749750    $content = $post['post_content'];
    750751
     
    10131014 */
    10141015function get_sample_permalink($id, $title = null, $name = null) {
    1015     $post = &get_post($id);
     1016    $post = get_post($id);
    10161017    if ( !$post->ID )
    10171018        return array('', '');
     
    10791080function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
    10801081    global $wpdb;
    1081     $post = &get_post($id);
     1082    $post = get_post($id);
    10821083
    10831084    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
  • trunk/wp-admin/includes/template.php

    r21538 r21597  
    706706function the_attachment_links( $id = false ) {
    707707    $id = (int) $id;
    708     $post = & get_post( $id );
     708    $post = get_post( $id );
    709709
    710710    if ( $post->post_type != 'attachment' )
  • trunk/wp-admin/post.php

    r21504 r21597  
    203203    check_admin_referer('trash-post_' . $post_id);
    204204
    205     $post = & get_post($post_id);
     205    $post = get_post($post_id);
    206206
    207207    if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
  • trunk/wp-admin/upload.php

    r20449 r21597  
    5858                return;
    5959
    60             $parent = &get_post( $parent_id );
     60            $parent = get_post( $parent_id );
    6161            if ( !current_user_can( 'edit_post', $parent_id ) )
    6262                wp_die( __( 'You are not allowed to edit this post.' ) );
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r21526 r21597  
    776776        $parent_title = "";
    777777        if ( ! empty( $page->post_parent ) ) {
    778             $parent = get_page( $page->post_parent );
     778            $parent = get_post( $page->post_parent );
    779779            $parent_title = $parent->post_title;
    780780        }
     
    19441944        }
    19451945
    1946         $page = get_page($page_id);
     1946        $page = get_post($page_id);
    19471947        if ( ! $page )
    19481948            return new IXR_Error( 404, __( 'Invalid post ID.' ) );
  • trunk/wp-includes/comment.php

    r21570 r21597  
    13721372            wp_notify_moderator($comment_ID);
    13731373
    1374         $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
     1374        $post = get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
    13751375
    13761376        if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
  • trunk/wp-includes/deprecated.php

    r21568 r21597  
    2727    _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
    2828
    29     $post = &get_post($postid);
     29    $post = get_post($postid);
    3030
    3131    $postdata = array (
     
    18931893    _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_link()' );
    18941894    $id = (int) $id;
    1895     $_post = & get_post($id);
     1895    $_post = get_post($id);
    18961896
    18971897    if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
     
    19221922    _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image_src()' );
    19231923    $id = (int) $id;
    1924     if ( !$post = & get_post($id) )
     1924    if ( !$post = get_post($id) )
    19251925        return false;
    19261926
     
    19671967    _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
    19681968    $id = (int) $id;
    1969     if ( !$post = & get_post($id) )
     1969    if ( !$post = get_post($id) )
    19701970        return false;
    19711971
     
    20242024    _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
    20252025    $id = (int) $id;
    2026     if ( !$post = & get_post($id) )
     2026    if ( !$post = get_post($id) )
    20272027        return false;
    20282028
     
    28022802
    28032803    if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
    2804         $post = & get_post($GLOBALS['post']->post_parent);
     2804        $post = get_post($GLOBALS['post']->post_parent);
    28052805
    28062806    if ( empty($post) )
  • trunk/wp-includes/general-template.php

    r21592 r21597  
    16281628    if ( is_single() || is_page() ) {
    16291629        $id = 0;
    1630         $post = &get_post( $id );
     1630        $post = get_post( $id );
    16311631
    16321632        if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
  • trunk/wp-includes/link-template.php

    r21596 r21597  
    9797        $sample = true;
    9898    } else {
    99         $post = &get_post($id);
     99        $post = get_post($id);
    100100        $sample = false;
    101101    }
     
    179179    global $wp_rewrite;
    180180
    181     $post = &get_post($id);
     181    $post = get_post($id);
    182182
    183183    if ( is_wp_error( $post ) )
     
    896896 */
    897897function get_edit_post_link( $id = 0, $context = 'display' ) {
    898     if ( !$post = &get_post( $id ) )
     898    if ( !$post = get_post( $id ) )
    899899        return;
    900900
     
    925925 */
    926926function edit_post_link( $link = null, $before = '', $after = '', $id = 0 ) {
    927     if ( !$post = &get_post( $id ) )
     927    if ( !$post = get_post( $id ) )
    928928        return;
    929929
     
    955955        _deprecated_argument( __FUNCTION__, '3.0' );
    956956
    957     if ( !$post = &get_post( $id ) )
     957    if ( !$post = get_post( $id ) )
    958958        return;
    959959
     
    12021202function get_adjacent_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true) {
    12031203    if ( $previous && is_attachment() && is_object( $GLOBALS['post'] ) )
    1204         $post = & get_post($GLOBALS['post']->post_parent);
     1204        $post = get_post($GLOBALS['post']->post_parent);
    12051205    else
    12061206        $post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);
     
    13671367function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
    13681368    if ( $previous && is_attachment() )
    1369         $post = & get_post($GLOBALS['post']->post_parent);
     1369        $post = get_post($GLOBALS['post']->post_parent);
    13701370    else
    13711371        $post = get_adjacent_post($in_same_cat, $excluded_categories, $previous);
  • trunk/wp-includes/media.php

    r21351 r21597  
    656656        if ( is_array($size) )
    657657            $size = join('x', $size);
    658         $attachment =& get_post($attachment_id);
     658        $attachment = get_post($attachment_id);
    659659        $default_attr = array(
    660660            'src'   => $src,
  • trunk/wp-includes/post-template.php

    r21559 r21597  
    102102 */
    103103function get_the_title( $id = 0 ) {
    104     $post = &get_post($id);
     104    $post = get_post($id);
    105105
    106106    $title = isset($post->post_title) ? $post->post_title : '';
     
    149149 */
    150150function get_the_guid( $id = 0 ) {
    151     $post = &get_post($id);
     151    $post = get_post($id);
    152152
    153153    return apply_filters('get_the_guid', $post->guid);
     
    277277 */
    278278function has_excerpt( $id = 0 ) {
    279     $post = &get_post( $id );
     279    $post = get_post( $id );
    280280    return ( !empty( $post->post_excerpt ) );
    281281}
     
    475475        $page_id = $wp_query->get_queried_object_id();
    476476
    477         $post = get_page($page_id);
     477        $post = get_post($page_id);
    478478
    479479        $classes[] = 'page-id-' . $page_id;
     
    10161016        $css_class = array('page_item', 'page-item-'.$page->ID);
    10171017        if ( !empty($current_page) ) {
    1018             $_current_page = get_page( $current_page );
     1018            $_current_page = get_post( $current_page );
    10191019            if ( in_array( $page->ID, $_current_page->ancestors ) )
    10201020                $css_class[] = 'current_page_ancestor';
     
    11391139function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
    11401140    $id = intval( $id );
    1141     $_post = & get_post( $id );
     1141    $_post = get_post( $id );
    11421142
    11431143    if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
  • trunk/wp-includes/post.php

    r21572 r21597  
    587587 */
    588588function get_post_mime_type($ID = '') {
    589     $post = & get_post($ID);
     589    $post = get_post($ID);
    590590
    591591    if ( is_object($post) )
     
    33493349
    33503350    if ( $foundid )
    3351         return get_page( $foundid, $output );
     3351        return get_post( $foundid, $output );
    33523352
    33533353    return null;
     
    33693369    $page = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type= %s", $page_title, $post_type ) );
    33703370    if ( $page )
    3371         return get_page($page, $output);
     3371        return get_post( $page, $output );
    33723372
    33733373    return null;
     
    34563456function get_page_uri($page) {
    34573457    if ( ! is_object($page) )
    3458         $page = get_page($page);
     3458        $page = get_post( $page );
    34593459    $uri = $page->post_name;
    34603460
    34613461    foreach ( $page->ancestors as $parent ) {
    3462         $uri = get_page($parent)->post_name . "/" . $uri;
     3462        $uri = get_post( $parent )->post_name . "/" . $uri;
    34633463    }
    34643464
     
    37173717        return true;
    37183718    if ( $id = url_to_postid($url) ) {
    3719         $post = & get_post($id);
     3719        $post = get_post($id);
    37203720        if ( 'attachment' == $post->post_type )
    37213721            return true;
     
    40134013function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) {
    40144014    $post_id = (int) $post_id;
    4015     if ( !$post =& get_post( $post_id ) )
     4015    if ( !$post = get_post( $post_id ) )
    40164016        return false;
    40174017
     
    40354035function wp_update_attachment_metadata( $post_id, $data ) {
    40364036    $post_id = (int) $post_id;
    4037     if ( !$post =& get_post( $post_id ) )
     4037    if ( !$post = get_post( $post_id ) )
    40384038        return false;
    40394039
     
    40534053function wp_get_attachment_url( $post_id = 0 ) {
    40544054    $post_id = (int) $post_id;
    4055     if ( !$post =& get_post( $post_id ) )
     4055    if ( !$post = get_post( $post_id ) )
    40564056        return false;
    40574057
     
    40924092function wp_get_attachment_thumb_file( $post_id = 0 ) {
    40934093    $post_id = (int) $post_id;
    4094     if ( !$post =& get_post( $post_id ) )
     4094    if ( !$post = get_post( $post_id ) )
    40954095        return false;
    40964096    if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
     
    41144114function wp_get_attachment_thumb_url( $post_id = 0 ) {
    41154115    $post_id = (int) $post_id;
    4116     if ( !$post =& get_post( $post_id ) )
     4116    if ( !$post = get_post( $post_id ) )
    41174117        return false;
    41184118    if ( !$url = wp_get_attachment_url( $post->ID ) )
     
    41414141function wp_attachment_is_image( $post_id = 0 ) {
    41424142    $post_id = (int) $post_id;
    4143     if ( !$post =& get_post( $post_id ) )
     4143    if ( !$post = get_post( $post_id ) )
    41444144        return false;
    41454145
     
    41724172        if ( is_numeric($mime) ) {
    41734173            $mime = (int) $mime;
    4174             if ( $post =& get_post( $mime ) ) {
     4174            if ( $post = get_post( $mime ) ) {
    41754175                $post_id = (int) $post->ID;
    41764176                $ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid);
  • trunk/wp-includes/query.php

    r21585 r21597  
    21292129                $q['name'] = $q['pagename'];
    21302130                $where .= " AND ($wpdb->posts.ID = '$reqpage')";
    2131                 $reqpage_obj = get_page($reqpage);
     2131                $reqpage_obj = get_post( $reqpage );
    21322132                if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) {
    21332133                    $this->is_attachment = true;
     
    29762976        } elseif ( $this->is_posts_page ) {
    29772977            $page_for_posts = get_option('page_for_posts');
    2978             $this->queried_object = get_page( $page_for_posts );
     2978            $this->queried_object = get_post( $page_for_posts );
    29792979            $this->queried_object_id = (int) $this->queried_object->ID;
    29802980        } elseif ( $this->is_singular && !is_null($this->post) ) {
  • trunk/wp-includes/taxonomy.php

    r21559 r21597  
    30743074 */
    30753075function get_the_taxonomies($post = 0, $args = array() ) {
    3076     if ( is_int($post) )
    3077         $post =& get_post($post);
    3078     elseif ( !is_object($post) )
    3079         $post =& $GLOBALS['post'];
     3076    $post = get_post( $post );
    30803077
    30813078    $args = wp_parse_args( $args, array(
     
    31233120 */
    31243121function get_post_taxonomies($post = 0) {
    3125     $post =& get_post($post);
     3122    $post = get_post( $post );
    31263123
    31273124    return get_object_taxonomies($post);
Note: See TracChangeset for help on using the changeset viewer.