WordPress.org

Make WordPress Core

Changeset 3092


Ignore:
Timestamp:
11/15/05 22:55:24 (8 years ago)
Author:
ryan
Message:

Renaming. object and subpost are now attachment. post_type is post_mime_type.

Location:
trunk
Files:
11 edited

Legend:

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

    r3079 r3092  
    6060    add_meta($post_ID); 
    6161 
    62     // Reunite any orphaned subposts with their parent 
     62    // Reunite any orphaned attachments with their parent 
    6363    if ( $_POST['temp_ID'] ) 
    6464        relocate_children($_POST['temp_ID'], $post_ID); 
  • trunk/wp-admin/inline-uploading.php

    r3073 r3092  
    66    die(__('You do not have permission to edit posts.')); 
    77 
    8 $wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object', 'flickrtag'); 
     8$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment', 'flickrtag'); 
    99 
    1010for ($i=0; $i<count($wpvarstoreset); $i += 1) { 
     
    3838case 'delete': 
    3939 
    40 wp_delete_object($object); 
     40wp_delete_attachment($attachment); 
    4141 
    4242header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&start=$start"); 
     
    5656$filename = basename($file); 
    5757 
    58 // Construct the object array 
    59 $object = array( 
     58// Construct the attachment array 
     59$attachment = array( 
    6060    'post_title' => $imgtitle ? $imgtitle : $filename, 
    6161    'post_content' => $descr, 
    62     'post_status' => 'object', 
     62    'post_status' => 'attachment', 
    6363    'post_parent' => $post, 
    64     'post_type' => $_FILES['image']['type'], 
     64    'post_mime_type' => $_FILES['image']['type'], 
    6565    'guid' => $url 
    6666    ); 
    6767 
    6868// Save the data 
    69 $id = wp_attach_object($object, $post); 
    70  
    71 // Generate the object's postmeta. 
     69$id = wp_insert_attachment($attachment, $file, $post); 
     70 
     71// Generate the attachment's postmeta. 
    7272$imagesize = getimagesize($file); 
    7373$imagedata['width'] = $imagesize['0']; 
     
    8282if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) { 
    8383    if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 ) 
    84         $error = wp_create_thumbnail($file['file'], 128); 
     84        $error = wp_create_thumbnail($file, 128); 
    8585    elseif ( $imagedata['height'] > 96 ) 
    8686        $error = wp_create_thumbnail($file, 96); 
     
    110110 
    111111if ( $last ) 
    112     $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post") - $num; 
     112    $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image' $and_post") - $num; 
    113113else 
    114114    $start = (int) $start; 
     
    120120    $sort = "ID"; 
    121121 
    122 $images = $wpdb->get_results("SELECT ID, post_date, post_title, guid FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post ORDER BY $sort LIMIT $start, $double", ARRAY_A); 
     122$images = $wpdb->get_results("SELECT ID, post_date, post_title, guid FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image' $and_post ORDER BY $sort LIMIT $start, $double", ARRAY_A); 
    123123 
    124124if ( count($images) > $num ) { 
     
    144144    $images = array_slice( $images, 0, $num ); 
    145145    $__delete = __('DELETE'); 
    146     $__subpost_on = __('SUBPOST <strong>ON</strong>'); 
    147     $__subpost_off = __('SUBPOST <strong>OFF</strong>'); 
     146    $__attachment_on = __('ATTACHMENT <strong>ON</strong>'); 
    148147    $__thumbnail_on = __('THUMBNAIL <strong>ON</strong>'); 
    149148    $__thumbnail_off = __('THUMBNAIL <strong>OFF</strong>'); 
     
    152151    $__confirmdelete = __('Delete this photo from the server?'); 
    153152    $__nothumb = __('There is no thumbnail associated with this photo.'); 
    154     $images_script .= "subposton = '$__subpost_on';\nsubpostoff = '$__subpost_off';\n"; 
     153    $images_script .= "attachmenton = '$__attachment_on';\nattachmentoff = '$__attachment_off';\n"; 
    155154    $images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n"; 
    156155    foreach ( $images as $key => $image ) { 
    157156        $meta = get_post_meta($image['ID'], 'imagedata', true); 
    158157        if (!is_array($meta)) { 
    159             wp_delete_object($image['ID']); 
     158            wp_delete_attachment($image['ID']); 
    160159            continue; 
    161160        } 
     
    176175        $xpadding = (128 - $image['uwidth']) / 2; 
    177176        $ypadding = (96 - $image['uheight']) / 2; 
    178         $object = $image['ID']; 
     177        $attachment = $image['ID']; 
    179178        $images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n"; 
    180         $href = get_subpost_link($object); 
     179        $href = get_attachment_link($attachment); 
    181180        $images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n"; 
    182181        $images_html .= " 
    183182<div id='target$i' class='imagewrap left'> 
    184183    <div id='popup$i' class='popup'> 
    185         <a id=\"L$i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__subpost_on</a> 
     184        <a id=\"L$i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__attachment_on</a> 
    186185        <a id=\"I$i\" onclick=\"if($thumb)toggleImage($i);else alert('$__nothumb');return false;\" href=\"javascript:void();\">$thumbtext</a> 
    187         <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;object=$object&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a> 
     186        <a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;attachment=$attachment&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a> 
    188187        <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a> 
    189188    </div> 
     
    245244    o=document.getElementById('link'+n); 
    246245    oi=document.getElementById('L'+n); 
    247     if ( oi.innerHTML == subposton ) { 
     246    if ( oi.innerHTML == attachmenton ) { 
    248247        o.href = eval('href'+n+'b'); 
    249         oi.innerHTML = subpostoff; 
     248        oi.innerHTML = attachmentoff; 
    250249    } else { 
    251250        o.href = eval('href'+n+'a'); 
    252         oi.innerHTML = subposton; 
     251        oi.innerHTML = attachmenton; 
    253252    } 
    254253} 
  • trunk/wp-admin/upgrade-functions.php

    r3091 r3092  
    3131    } 
    3232     
    33     if ( $wp_current_db_version < 3091 ) 
     33    if ( $wp_current_db_version < 3092 ) 
    3434        upgrade_160(); 
    3535 
     
    241241 
    242242function upgrade_160() { 
    243     global $wpdb, $table_prefix; 
    244      
     243    global $wpdb, $table_prefix, $wp_current_db_version; 
     244 
    245245    populate_roles_160(); 
    246246 
     
    299299            $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status='publish' AND category_id = '$cat_id'"); 
    300300            $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 
     301        } 
     302    } 
     303     
     304    // Some alpha versions used a post status of object instead of attachment and put 
     305    // the mime type in post_type instead of post_mime_type. 
     306    if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) { 
     307        $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'"); 
     308        foreach ($objects as $object) { 
     309            $wpdb->query("UPDATE $wpdb->posts SET post_status = 'attachment', 
     310            post_mime_type = '$object->post_type', 
     311            post_type = '', 
     312            guid = '$guid' 
     313            WHERE ID = $object->ID"); 
     314             
     315            $meta = get_post_meta($postid, 'imagedata', true); 
     316            if ( ! empty($meta['file']) ) 
     317                add_post_meta($object->ID, '_wp_attached_file', $meta['file']); 
    301318        } 
    302319    } 
  • trunk/wp-admin/upgrade-schema.php

    r3041 r3092  
    107107  post_category int(4) NOT NULL default '0', 
    108108  post_excerpt text NOT NULL, 
    109   post_status enum('publish','draft','private','static','object') NOT NULL default 'publish', 
     109  post_status enum('publish','draft','private','static','object','attachment') NOT NULL default 'publish', 
    110110  comment_status enum('open','closed','registered_only') NOT NULL default 'open', 
    111111  ping_status enum('open','closed') NOT NULL default 'open', 
     
    121121  menu_order int(11) NOT NULL default '0', 
    122122  post_type varchar(100) NOT NULL, 
     123  post_mime_type varchar(100) NOT NULL, 
    123124  PRIMARY KEY  (ID), 
    124125  KEY post_name (post_name) 
  • trunk/wp-includes/classes.php

    r3089 r3092  
    3131    var $is_comments_popup = false; 
    3232    var $is_admin = false; 
    33     var $is_subpost = false; 
     33    var $is_attachment = false; 
    3434 
    3535    function init_query_flags() { 
     
    5151        $this->is_paged = false; 
    5252        $this->is_admin = false; 
    53         $this->is_subpost = false; 
     53        $this->is_attachment = false; 
    5454    } 
    5555     
     
    9292        $qv['p'] =  (int) $qv['p']; 
    9393 
    94         if ( ('' != $qv['subpost']) || $qv['subpost_id'] ) { 
     94        // Compat.  Map subpost to attachment. 
     95        if ( '' != $qv['subpost'] ) 
     96            $qv['attachment'] = $qv['subpost']; 
     97        if ( '' != $qv['subpost_id'] ) 
     98            $qv['attachment_id'] = $qv['subpost_id']; 
     99             
     100        if ( ('' != $qv['attachment']) || $qv['attachment_id'] ) { 
    95101            $this->is_single = true; 
    96             $this->is_subpost = true; 
     102            $this->is_attachment = true; 
    97103        } 
    98104 
     
    215221        } 
    216222 
    217         if ( ! ($this->is_subpost || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) { 
     223        if ( ! ($this->is_attachment || $this->is_archive || $this->is_single || $this->is_page || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup)) { 
    218224            $this->is_home = true; 
    219225        } 
     
    335341        } 
    336342 
     343        // Compat.  Map subpost to attachment. 
     344        if ( '' != $q['subpost'] ) 
     345            $q['attachment'] = $q['subpost']; 
     346        if ( '' != $q['subpost_id'] ) 
     347            $q['attachment_id'] = $q['subpost_id']; 
     348 
    337349        if ('' != $q['name']) { 
    338350            $q['name'] = sanitize_title($q['name']); 
     
    342354            $q['name'] = $q['pagename']; 
    343355            $where .= " AND post_name = '" . $q['pagename'] . "'"; 
    344         } elseif ('' != $q['subpost']) { 
    345             $q['subpost'] = sanitize_title($q['subpost']); 
    346             $q['name'] = $q['subpost']; 
    347             $where .= " AND post_name = '" . $q['subpost'] . "'"; 
     356        } elseif ('' != $q['attachment']) { 
     357            $q['attachment'] = sanitize_title($q['attachment']); 
     358            $q['name'] = $q['attachment']; 
     359            $where .= " AND post_name = '" . $q['attachment'] . "'"; 
    348360        } 
    349361 
     
    356368            $q['p'] = intval($q['comments_popup']); 
    357369 
    358         // If a subpost is requested by number, let it supercede any post number. 
    359         if ( ($q['subpost_id'] != '') && (intval($q['subpost_id']) != 0) ) 
    360             $q['p'] = (int) $q['subpost_id']; 
     370        // If a attachment is requested by number, let it supercede any post number. 
     371        if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) ) 
     372            $q['p'] = (int) $q['attachment_id']; 
    361373 
    362374        // If a post number is specified, load that post 
     
    539551        } 
    540552 
    541         if ( $this->is_subpost ) { 
    542             $where .= ' AND (post_status = "object")'; 
     553        if ( $this->is_attachment ) { 
     554            $where .= ' AND (post_status = "attachment")'; 
    543555        } elseif ($this->is_page) { 
    544556            $where .= ' AND (post_status = "static")'; 
     
    554566        } 
    555567 
    556         if (! $this->is_subpost ) 
    557             $where .= ' AND post_status != "object"'; 
     568        if (! $this->is_attachment ) 
     569            $where .= ' AND post_status != "attachment"'; 
    558570 
    559571        // Apply filters on where and join prior to paging so that any 
     
    12001212                    $sub1feed2 = $sub1 . $feedregex2; 
    12011213                    $sub1 .= '?$'; 
    1202                     $sub2 = $submatchbase . '/subpost/([^/]+)/'; 
     1214                    $sub2 = $submatchbase . '/attachment/([^/]+)/'; 
    12031215                    $sub2tb = $sub2 . $trackbackregex; 
    12041216                    $sub2feed = $sub2 . $feedregex; 
    12051217                    $sub2feed2 = $sub2 . $feedregex2; 
    12061218                    $sub2 .= '?$'; 
    1207                     $subquery = $index . '?subpost=' . $this->preg_index(1); 
     1219                    $subquery = $index . '?attachment=' . $this->preg_index(1); 
    12081220                    $subtbquery = $subquery . '&tb=1'; 
    12091221                    $subfeedquery = $subquery . '&feed=' . $this->preg_index(2); 
     
    13821394 
    13831395class WP { 
    1384     var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'subpost', 'subpost_id'); 
     1396    var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id'); 
    13851397 
    13861398    var $private_query_vars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging'); 
  • trunk/wp-includes/functions-post.php

    r3091 r3092  
    132132        $wpdb->query( 
    133133            "INSERT INTO $wpdb->posts 
    134             (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_type) 
     134            (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) 
    135135            VALUES 
    136             ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_type')"); 
     136            ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); 
    137137            $post_ID = $wpdb->insert_id;             
    138138    } 
     
    204204} 
    205205 
    206 function wp_attach_object($object, $post_parent = 0) { 
     206function wp_insert_attachment($object, $file, $post_parent = 0) { 
    207207    global $wpdb, $user_ID; 
    208208     
     
    218218    $comment_status  = apply_filters('comment_status_pre', $comment_status); 
    219219    $ping_status     = apply_filters('ping_status_pre',    $ping_status); 
    220     $post_type       = apply_filters('post_type_pre',      $post_type); 
     220    $post_mime_type  = apply_filters('post_mime_type_pre', $post_mime_type); 
    221221 
    222222    // Make sure we set a valid category 
     
    229229        $post_author = $user_ID; 
    230230 
    231     $post_status = 'object'; 
     231    $post_status = 'attachment'; 
    232232 
    233233    // Get the post ID. 
     
    291291            post_parent = '$post_parent', 
    292292            menu_order = '$menu_order', 
    293             post_type = '$post_type', 
     293            post_mime_type = '$post_mime_type', 
    294294            guid = '$guid' 
    295295            WHERE ID = $post_ID"); 
     
    297297        $wpdb->query( 
    298298            "INSERT INTO $wpdb->posts 
    299             (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_type, guid) 
     299            (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) 
    300300            VALUES 
    301             ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_type', '$guid')"); 
     301            ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); 
    302302            $post_ID = $wpdb->insert_id;             
    303303    } 
     
    310310    wp_set_post_cats('', $post_ID, $post_category); 
    311311 
     312    add_post_meta($post_ID, '_wp_attached_file', $file); 
     313 
    312314    clean_post_cache($post_ID); 
    313315 
    314316    if ( $update) { 
    315         do_action('edit_object', $post_ID); 
     317        do_action('edit_attachment', $post_ID); 
    316318    } else { 
    317         do_action('attach_object', $post_ID); 
     319        do_action('add_attachment', $post_ID); 
    318320    } 
    319321     
     
    321323} 
    322324 
    323 function wp_delete_object($postid) { 
     325function wp_delete_attachment($postid) { 
    324326    global $wpdb; 
    325327    $postid = (int) $postid; 
     
    328330        return $post; 
    329331 
    330     if ( 'object' != $post->post_status ) 
     332    if ( 'attachment' != $post->post_status ) 
    331333        return false; 
    332334 
    333     $obj_meta = get_post_meta($postid, 'imagedata', true); 
     335    $meta = get_post_meta($postid, 'imagedata', true); 
     336    $file = get_post_meta($postid, '_wp_attached_file', true); 
    334337 
    335338    $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid"); 
     
    341344    $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid"); 
    342345 
    343     @ unlink($obj_meta['file']); 
    344  
    345     do_action('delete_object', $postid); 
     346    if ( ! empty($meta['file']) ) 
     347        @ unlink($meta['file']); 
     348 
     349    if ( ! empty($file) ) 
     350        @ unlink($file); 
     351 
     352    do_action('delete_attachment', $postid); 
    346353 
    347354    return $post; 
     
    745752 
    746753    if ( is_object($post) ) { 
    747         if ( ('object' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) ) 
     754        if ( ('attachment' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) ) 
    748755            return get_post_status($post->post_parent); 
    749756        else 
  • trunk/wp-includes/functions.php

    r3071 r3092  
    13981398} 
    13991399 
    1400 function is_subpost () { 
    1401     global $wp_query; 
    1402  
    1403     return $wp_query->is_subpost; 
     1400function is_attachment () { 
     1401    global $wp_query; 
     1402 
     1403    return $wp_query->is_attachment; 
    14041404} 
    14051405 
     
    18951895} 
    18961896 
    1897 function get_subpost_template() { 
     1897function get_attachment_template() { 
    18981898    global $posts; 
    1899     $type = explode('/', $posts[0]->post_type); 
     1899    $type = explode('/', $posts[0]->post_mime_type); 
    19001900    if ( $template = get_query_template($type[0]) ) 
    19011901        return $template; 
     
    19051905        return $template; 
    19061906    else 
    1907         return get_query_template('subpost'); 
     1907        return get_query_template('attachment'); 
    19081908} 
    19091909 
  • trunk/wp-includes/template-functions-links.php

    r2958 r3092  
    4545    if ( $post->post_status == 'static' ) 
    4646        return get_page_link($post->ID); 
    47     elseif ($post->post_status == 'object') 
    48         return get_subpost_link($post->ID); 
     47    elseif ($post->post_status == 'attachment') 
     48        return get_attachment_link($post->ID); 
    4949 
    5050    $permalink = get_settings('permalink_structure'); 
     
    103103} 
    104104 
    105 function get_subpost_link($id = false) { 
     105function get_attachment_link($id = false) { 
    106106    global $post, $wp_rewrite; 
    107107 
     
    121121 
    122122    if (! $link ) { 
    123         $link = get_bloginfo('home') . "/?subpost_id=$id"; 
    124     } 
    125  
    126     return apply_filters('object_link', $link, $id); 
     123        $link = get_bloginfo('home') . "/?attachment_id=$id"; 
     124    } 
     125 
     126    return apply_filters('attachment_link', $link, $id); 
    127127} 
    128128 
     
    210210    get_currentuserinfo(); 
    211211 
    212     if ( !user_can_edit_post($user_ID, $post->ID) || is_subpost() ) { 
     212    if ( !user_can_edit_post($user_ID, $post->ID) || is_attachment() ) { 
    213213        return; 
    214214    } 
     
    235235    global $post, $wpdb; 
    236236 
    237     if( !is_single() || is_subpost() ) 
     237    if( !is_single() || is_attachment() ) 
    238238        return null; 
    239239 
     
    266266    global $post, $wpdb; 
    267267 
    268     if( !is_single() || is_subpost() ) 
     268    if( !is_single() || is_attachment() ) 
    269269        return null; 
    270270 
     
    298298 
    299299function previous_post_link($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { 
    300     if ( is_subpost() ) { 
     300    if ( is_attachment() ) { 
    301301        $post = & get_post($GLOBALS['post']->post_parent); 
    302302        $pre = __('Belongs to '); 
  • trunk/wp-includes/template-functions-post.php

    r2991 r3092  
    438438} 
    439439 
    440 function prepend_object($content) { 
     440function prepend_attachment($content) { 
    441441    global $post; 
    442442 
    443     $p = '<p class="subpostobject">'; 
     443    $p = '<p class="attachment">'; 
    444444 
    445445    if ( '' != $post->guid ) { 
    446         if ( substr($post->post_type, 0, 6) == 'image/' ) 
    447             $p .= '<a href="' . $post->guid . '" title="Click for full-size image" ><img class="subpostimage" src="' . $post->guid . '" alt="' . $post->post_title . '" /></a>'; 
     446        if ( substr($post->post_mime_type, 0, 6) == 'image/' ) 
     447            $p .= '<a href="' . $post->guid . '" title="Click for full-size image" ><img class="attachmentimage" src="' . $post->guid . '" alt="' . $post->post_title . '" /></a>'; 
    448448        else 
    449             $p .= __('Attachment') . ' (' . $post->post_type . ')'; 
     449            $p .= __('Attachment') . ' (' . $post->post_mime_type . ')'; 
    450450    } else { 
    451451        $p .= __('Missing attachment'); 
  • trunk/wp-includes/template-loader.php

    r2958 r3092  
    1717        include(get_home_template()); 
    1818        exit; 
    19     } else if ( is_subpost() && get_subpost_template() ) { 
    20         include(get_subpost_template()); 
     19    } else if ( is_attachment() && get_attachment_template() ) { 
     20        include(get_attachment_template()); 
    2121        exit; 
    2222    } else if ( is_single() && get_single_template() ) { 
    23         if ( is_subpost() ) 
    24             add_filter('the_content', 'prepend_object'); 
     23        if ( is_attachment() ) 
     24            add_filter('the_content', 'prepend_attachment'); 
    2525        include(get_single_template()); 
    2626        exit; 
    2727    } else if ( is_page() && get_page_template() ) { 
    28         if ( is_subpost() ) 
    29             add_filter('the_content', 'prepend_object'); 
     28        if ( is_attachment() ) 
     29            add_filter('the_content', 'prepend_attachment'); 
    3030        include(get_page_template()); 
    3131        exit; 
  • trunk/wp-includes/version.php

    r3091 r3092  
    44 
    55$wp_version = '1.6-ALPHA-2-still-dont-use'; 
    6 $wp_db_version = 3091; 
     6$wp_db_version = 3092; 
    77 
    88?> 
Note: See TracChangeset for help on using the changeset viewer.