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

git-svn-id: http://svn.automattic.com/wordpress/trunk@3092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-11-15 22:55:24 +00:00
parent e120711bdd
commit f83326f125
11 changed files with 125 additions and 89 deletions

View File

@ -59,7 +59,7 @@ function write_post() {
$post_ID = wp_insert_post($_POST);
add_meta($post_ID);
// Reunite any orphaned subposts with their parent
// Reunite any orphaned attachments with their parent
if ( $_POST['temp_ID'] )
relocate_children($_POST['temp_ID'], $post_ID);

View File

@ -5,7 +5,7 @@ require_once('admin.php');
if (!current_user_can('edit_posts'))
die(__('You do not have permission to edit posts.'));
$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object', 'flickrtag');
$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment', 'flickrtag');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
@ -37,7 +37,7 @@ function get_udims($width, $height) {
switch($action) {
case 'delete':
wp_delete_object($object);
wp_delete_attachment($attachment);
header("Location: ".basename(__FILE__)."?post=$post&all=$all&action=view&start=$start");
die;
@ -55,20 +55,20 @@ $url = $file['url'];
$file = $file['file'];
$filename = basename($file);
// Construct the object array
$object = array(
// Construct the attachment array
$attachment = array(
'post_title' => $imgtitle ? $imgtitle : $filename,
'post_content' => $descr,
'post_status' => 'object',
'post_status' => 'attachment',
'post_parent' => $post,
'post_type' => $_FILES['image']['type'],
'post_mime_type' => $_FILES['image']['type'],
'guid' => $url
);
// Save the data
$id = wp_attach_object($object, $post);
$id = wp_insert_attachment($attachment, $file, $post);
// Generate the object's postmeta.
// Generate the attachment's postmeta.
$imagesize = getimagesize($file);
$imagedata['width'] = $imagesize['0'];
$imagedata['height'] = $imagesize['1'];
@ -81,7 +81,7 @@ add_post_meta($id, 'imagedata', $imagedata);
if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
$error = wp_create_thumbnail($file['file'], 128);
$error = wp_create_thumbnail($file, 128);
elseif ( $imagedata['height'] > 96 )
$error = wp_create_thumbnail($file, 96);
}
@ -109,7 +109,7 @@ if ( $post && empty($all) ) {
}
if ( $last )
$start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'object' AND left(post_type, 5) = 'image' $and_post") - $num;
$start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_status = 'attachment' AND left(post_mime_type, 5) = 'image' $and_post") - $num;
else
$start = (int) $start;
@ -119,7 +119,7 @@ if ( $start < 0 )
if ( '' == $sort )
$sort = "ID";
$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);
$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);
if ( count($images) > $num ) {
$next = $start + count($images) - $num;
@ -143,20 +143,19 @@ $images_script = '';
if ( count($images) > 0 ) {
$images = array_slice( $images, 0, $num );
$__delete = __('DELETE');
$__subpost_on = __('SUBPOST <strong>ON</strong>');
$__subpost_off = __('SUBPOST <strong>OFF</strong>');
$__attachment_on = __('ATTACHMENT <strong>ON</strong>');
$__thumbnail_on = __('THUMBNAIL <strong>ON</strong>');
$__thumbnail_off = __('THUMBNAIL <strong>OFF</strong>');
$__no_thumbnail = __('<del>THUMBNAIL</del>');
$__close = __('CLOSE');
$__confirmdelete = __('Delete this photo from the server?');
$__nothumb = __('There is no thumbnail associated with this photo.');
$images_script .= "subposton = '$__subpost_on';\nsubpostoff = '$__subpost_off';\n";
$images_script .= "attachmenton = '$__attachment_on';\nattachmentoff = '$__attachment_off';\n";
$images_script .= "thumbnailon = '$__thumbnail_on';\nthumbnailoff = '$__thumbnail_off';\n";
foreach ( $images as $key => $image ) {
$meta = get_post_meta($image['ID'], 'imagedata', true);
if (!is_array($meta)) {
wp_delete_object($image['ID']);
wp_delete_attachment($image['ID']);
continue;
}
$image = array_merge($image, $meta);
@ -175,16 +174,16 @@ if ( count($images) > 0 ) {
$uwidth_sum += 128;
$xpadding = (128 - $image['uwidth']) / 2;
$ypadding = (96 - $image['uheight']) / 2;
$object = $image['ID'];
$attachment = $image['ID'];
$images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n";
$href = get_subpost_link($object);
$href = get_attachment_link($attachment);
$images_script .= "href".$i."a = '$href';\nhref".$i."b = '{$image['guid']}';\n";
$images_html .= "
<div id='target$i' class='imagewrap left'>
<div id='popup$i' class='popup'>
<a id=\"L$i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__subpost_on</a>
<a id=\"L$i\" onclick=\"toggleLink($i);return false;\" href=\"javascript:void();\">$__attachment_on</a>
<a id=\"I$i\" onclick=\"if($thumb)toggleImage($i);else alert('$__nothumb');return false;\" href=\"javascript:void();\">$thumbtext</a>
<a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;object=$object&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a>
<a onclick=\"return confirm('$__confirmdelete')\" href=\"".basename(__FILE__)."?action=delete&amp;attachment=$attachment&amp;all=$all&amp;start=$start&amp;post=$post\">$__delete</a>
<a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
</div>
<a id=\"link$i\" class=\"imagelink\" href=\"$href\" onclick=\"imagePopup($i);return false;\" title=\"{$image['post_title']}\">
@ -244,12 +243,12 @@ popup = false;
function toggleLink(n) {
o=document.getElementById('link'+n);
oi=document.getElementById('L'+n);
if ( oi.innerHTML == subposton ) {
if ( oi.innerHTML == attachmenton ) {
o.href = eval('href'+n+'b');
oi.innerHTML = subpostoff;
oi.innerHTML = attachmentoff;
} else {
o.href = eval('href'+n+'a');
oi.innerHTML = subposton;
oi.innerHTML = attachmenton;
}
}
function toggleImage(n) {

View File

@ -30,7 +30,7 @@ function upgrade_all() {
upgrade_130();
}
if ( $wp_current_db_version < 3091 )
if ( $wp_current_db_version < 3092 )
upgrade_160();
save_mod_rewrite_rules();
@ -240,8 +240,8 @@ function upgrade_130() {
}
function upgrade_160() {
global $wpdb, $table_prefix;
global $wpdb, $table_prefix, $wp_current_db_version;
populate_roles_160();
$users = $wpdb->get_results("SELECT * FROM $wpdb->users");
@ -300,6 +300,23 @@ function upgrade_160() {
$wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'");
}
}
// Some alpha versions used a post status of object instead of attachment and put
// the mime type in post_type instead of post_mime_type.
if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
foreach ($objects as $object) {
$wpdb->query("UPDATE $wpdb->posts SET post_status = 'attachment',
post_mime_type = '$object->post_type',
post_type = '',
guid = '$guid'
WHERE ID = $object->ID");
$meta = get_post_meta($postid, 'imagedata', true);
if ( ! empty($meta['file']) )
add_post_meta($object->ID, '_wp_attached_file', $meta['file']);
}
}
}
// The functions we use to actually do stuff

View File

@ -106,7 +106,7 @@ CREATE TABLE $wpdb->posts (
post_title text NOT NULL,
post_category int(4) NOT NULL default '0',
post_excerpt text NOT NULL,
post_status enum('publish','draft','private','static','object') NOT NULL default 'publish',
post_status enum('publish','draft','private','static','object','attachment') NOT NULL default 'publish',
comment_status enum('open','closed','registered_only') NOT NULL default 'open',
ping_status enum('open','closed') NOT NULL default 'open',
post_password varchar(20) NOT NULL default '',
@ -120,6 +120,7 @@ CREATE TABLE $wpdb->posts (
guid varchar(255) NOT NULL default '',
menu_order int(11) NOT NULL default '0',
post_type varchar(100) NOT NULL,
post_mime_type varchar(100) NOT NULL,
PRIMARY KEY (ID),
KEY post_name (post_name)
);

View File

@ -30,7 +30,7 @@ class WP_Query {
var $is_404 = false;
var $is_comments_popup = false;
var $is_admin = false;
var $is_subpost = false;
var $is_attachment = false;
function init_query_flags() {
$this->is_single = false;
@ -50,7 +50,7 @@ class WP_Query {
$this->is_404 = false;
$this->is_paged = false;
$this->is_admin = false;
$this->is_subpost = false;
$this->is_attachment = false;
}
function init () {
@ -91,9 +91,15 @@ class WP_Query {
$qv['m'] = (int) $qv['m'];
$qv['p'] = (int) $qv['p'];
if ( ('' != $qv['subpost']) || $qv['subpost_id'] ) {
// Compat. Map subpost to attachment.
if ( '' != $qv['subpost'] )
$qv['attachment'] = $qv['subpost'];
if ( '' != $qv['subpost_id'] )
$qv['attachment_id'] = $qv['subpost_id'];
if ( ('' != $qv['attachment']) || $qv['attachment_id'] ) {
$this->is_single = true;
$this->is_subpost = true;
$this->is_attachment = true;
}
if ('' != $qv['name']) {
@ -214,7 +220,7 @@ class WP_Query {
$this->is_admin = true;
}
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)) {
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)) {
$this->is_home = true;
}
@ -334,6 +340,12 @@ class WP_Query {
$where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'";
}
// Compat. Map subpost to attachment.
if ( '' != $q['subpost'] )
$q['attachment'] = $q['subpost'];
if ( '' != $q['subpost_id'] )
$q['attachment_id'] = $q['subpost_id'];
if ('' != $q['name']) {
$q['name'] = sanitize_title($q['name']);
$where .= " AND post_name = '" . $q['name'] . "'";
@ -341,10 +353,10 @@ class WP_Query {
$q['pagename'] = sanitize_title(basename(str_replace('%2F', '/', urlencode($q['pagename']))));
$q['name'] = $q['pagename'];
$where .= " AND post_name = '" . $q['pagename'] . "'";
} elseif ('' != $q['subpost']) {
$q['subpost'] = sanitize_title($q['subpost']);
$q['name'] = $q['subpost'];
$where .= " AND post_name = '" . $q['subpost'] . "'";
} elseif ('' != $q['attachment']) {
$q['attachment'] = sanitize_title($q['attachment']);
$q['name'] = $q['attachment'];
$where .= " AND post_name = '" . $q['attachment'] . "'";
}
if ( (int) $q['w'] ) {
@ -355,9 +367,9 @@ class WP_Query {
if ( intval($q['comments_popup']) )
$q['p'] = intval($q['comments_popup']);
// If a subpost is requested by number, let it supercede any post number.
if ( ($q['subpost_id'] != '') && (intval($q['subpost_id']) != 0) )
$q['p'] = (int) $q['subpost_id'];
// If a attachment is requested by number, let it supercede any post number.
if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) )
$q['p'] = (int) $q['attachment_id'];
// If a post number is specified, load that post
if (($q['p'] != '') && intval($q['p']) != 0) {
@ -538,8 +550,8 @@ class WP_Query {
$distinct = 'DISTINCT';
}
if ( $this->is_subpost ) {
$where .= ' AND (post_status = "object")';
if ( $this->is_attachment ) {
$where .= ' AND (post_status = "attachment")';
} elseif ($this->is_page) {
$where .= ' AND (post_status = "static")';
} elseif ($this->is_single) {
@ -553,8 +565,8 @@ class WP_Query {
$where .= ')';
}
if (! $this->is_subpost )
$where .= ' AND post_status != "object"';
if (! $this->is_attachment )
$where .= ' AND post_status != "attachment"';
// Apply filters on where and join prior to paging so that any
// manipulations to them are reflected in the paging by day queries.
@ -1199,12 +1211,12 @@ class WP_Rewrite {
$sub1feed = $sub1 . $feedregex;
$sub1feed2 = $sub1 . $feedregex2;
$sub1 .= '?$';
$sub2 = $submatchbase . '/subpost/([^/]+)/';
$sub2 = $submatchbase . '/attachment/([^/]+)/';
$sub2tb = $sub2 . $trackbackregex;
$sub2feed = $sub2 . $feedregex;
$sub2feed2 = $sub2 . $feedregex2;
$sub2 .= '?$';
$subquery = $index . '?subpost=' . $this->preg_index(1);
$subquery = $index . '?attachment=' . $this->preg_index(1);
$subtbquery = $subquery . '&tb=1';
$subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
$match = $match . '(/[0-9]+)?/?$';
@ -1381,7 +1393,7 @@ class WP_Rewrite {
}
class WP {
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');
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');
var $private_query_vars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging');

View File

@ -131,9 +131,9 @@ function wp_insert_post($postarr = array()) {
} else {
$wpdb->query(
"INSERT INTO $wpdb->posts
(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)
(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)
VALUES
('$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')");
('$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')");
$post_ID = $wpdb->insert_id;
}
@ -203,7 +203,7 @@ function wp_insert_post($postarr = array()) {
return $post_ID;
}
function wp_attach_object($object, $post_parent = 0) {
function wp_insert_attachment($object, $file, $post_parent = 0) {
global $wpdb, $user_ID;
// Export array as variables
@ -217,7 +217,7 @@ function wp_attach_object($object, $post_parent = 0) {
$post_name = apply_filters('name_save_pre', $post_name);
$comment_status = apply_filters('comment_status_pre', $comment_status);
$ping_status = apply_filters('ping_status_pre', $ping_status);
$post_type = apply_filters('post_type_pre', $post_type);
$post_mime_type = apply_filters('post_mime_type_pre', $post_mime_type);
// Make sure we set a valid category
if (0 == count($post_category) || !is_array($post_category)) {
@ -228,7 +228,7 @@ function wp_attach_object($object, $post_parent = 0) {
if ( empty($post_author) )
$post_author = $user_ID;
$post_status = 'object';
$post_status = 'attachment';
// Get the post ID.
if ( $update )
@ -290,15 +290,15 @@ function wp_attach_object($object, $post_parent = 0) {
post_modified_gmt = '$post_date_gmt',
post_parent = '$post_parent',
menu_order = '$menu_order',
post_type = '$post_type',
post_mime_type = '$post_mime_type',
guid = '$guid'
WHERE ID = $post_ID");
} else {
$wpdb->query(
"INSERT INTO $wpdb->posts
(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)
(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)
VALUES
('$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')");
('$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')");
$post_ID = $wpdb->insert_id;
}
@ -309,28 +309,31 @@ function wp_attach_object($object, $post_parent = 0) {
wp_set_post_cats('', $post_ID, $post_category);
add_post_meta($post_ID, '_wp_attached_file', $file);
clean_post_cache($post_ID);
if ( $update) {
do_action('edit_object', $post_ID);
do_action('edit_attachment', $post_ID);
} else {
do_action('attach_object', $post_ID);
do_action('add_attachment', $post_ID);
}
return $post_ID;
}
function wp_delete_object($postid) {
function wp_delete_attachment($postid) {
global $wpdb;
$postid = (int) $postid;
if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") )
return $post;
if ( 'object' != $post->post_status )
if ( 'attachment' != $post->post_status )
return false;
$obj_meta = get_post_meta($postid, 'imagedata', true);
$meta = get_post_meta($postid, 'imagedata', true);
$file = get_post_meta($postid, '_wp_attached_file', true);
$wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid");
@ -340,9 +343,13 @@ function wp_delete_object($postid) {
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid");
@ unlink($obj_meta['file']);
if ( ! empty($meta['file']) )
@ unlink($meta['file']);
do_action('delete_object', $postid);
if ( ! empty($file) )
@ unlink($file);
do_action('delete_attachment', $postid);
return $post;
}
@ -744,7 +751,7 @@ function get_post_status($post = false) {
$post = get_post($post, OBJECT);
if ( is_object($post) ) {
if ( ('object' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) )
if ( ('attachment' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) )
return get_post_status($post->post_parent);
else
return $post->post_status;

View File

@ -1397,10 +1397,10 @@ function is_page ($page = '') {
return false;
}
function is_subpost () {
function is_attachment () {
global $wp_query;
return $wp_query->is_subpost;
return $wp_query->is_attachment;
}
function is_preview() {
@ -1894,9 +1894,9 @@ function get_single_template() {
return get_query_template('single');
}
function get_subpost_template() {
function get_attachment_template() {
global $posts;
$type = explode('/', $posts[0]->post_type);
$type = explode('/', $posts[0]->post_mime_type);
if ( $template = get_query_template($type[0]) )
return $template;
elseif ( $template = get_query_template($type[1]) )
@ -1904,7 +1904,7 @@ function get_subpost_template() {
elseif ( $template = get_query_template("$type[0]_$type[1]") )
return $template;
else
return get_query_template('subpost');
return get_query_template('attachment');
}
function get_comments_popup_template() {

View File

@ -44,8 +44,8 @@ function get_permalink($id = 0) {
$post = &get_post($id);
if ( $post->post_status == 'static' )
return get_page_link($post->ID);
elseif ($post->post_status == 'object')
return get_subpost_link($post->ID);
elseif ($post->post_status == 'attachment')
return get_attachment_link($post->ID);
$permalink = get_settings('permalink_structure');
@ -102,7 +102,7 @@ function get_page_link($id = false) {
return apply_filters('page_link', $link, $id);
}
function get_subpost_link($id = false) {
function get_attachment_link($id = false) {
global $post, $wp_rewrite;
$link = false;
@ -120,10 +120,10 @@ function get_subpost_link($id = false) {
}
if (! $link ) {
$link = get_bloginfo('home') . "/?subpost_id=$id";
$link = get_bloginfo('home') . "/?attachment_id=$id";
}
return apply_filters('object_link', $link, $id);
return apply_filters('attachment_link', $link, $id);
}
function get_year_link($year) {
@ -209,7 +209,7 @@ function edit_post_link($link = 'Edit This', $before = '', $after = '') {
get_currentuserinfo();
if ( !user_can_edit_post($user_ID, $post->ID) || is_subpost() ) {
if ( !user_can_edit_post($user_ID, $post->ID) || is_attachment() ) {
return;
}
@ -234,7 +234,7 @@ function edit_comment_link($link = 'Edit This', $before = '', $after = '') {
function get_previous_post($in_same_cat = false, $excluded_categories = '') {
global $post, $wpdb;
if( !is_single() || is_subpost() )
if( !is_single() || is_attachment() )
return null;
$current_post_date = $post->post_date;
@ -265,7 +265,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
function get_next_post($in_same_cat = false, $excluded_categories = '') {
global $post, $wpdb;
if( !is_single() || is_subpost() )
if( !is_single() || is_attachment() )
return null;
$current_post_date = $post->post_date;
@ -297,7 +297,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
function previous_post_link($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
if ( is_subpost() ) {
if ( is_attachment() ) {
$post = & get_post($GLOBALS['post']->post_parent);
$pre = __('Belongs to ');
} else {

View File

@ -437,16 +437,16 @@ function _page_level_out($parent, $page_tree, $args, $depth = 0, $echo = true) {
return $output;
}
function prepend_object($content) {
function prepend_attachment($content) {
global $post;
$p = '<p class="subpostobject">';
$p = '<p class="attachment">';
if ( '' != $post->guid ) {
if ( substr($post->post_type, 0, 6) == 'image/' )
$p .= '<a href="' . $post->guid . '" title="Click for full-size image" ><img class="subpostimage" src="' . $post->guid . '" alt="' . $post->post_title . '" /></a>';
if ( substr($post->post_mime_type, 0, 6) == 'image/' )
$p .= '<a href="' . $post->guid . '" title="Click for full-size image" ><img class="attachmentimage" src="' . $post->guid . '" alt="' . $post->post_title . '" /></a>';
else
$p .= __('Attachment') . ' (' . $post->post_type . ')';
$p .= __('Attachment') . ' (' . $post->post_mime_type . ')';
} else {
$p .= __('Missing attachment');
}

View File

@ -16,17 +16,17 @@ if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
} else if ( is_home() && get_home_template() ) {
include(get_home_template());
exit;
} else if ( is_subpost() && get_subpost_template() ) {
include(get_subpost_template());
} else if ( is_attachment() && get_attachment_template() ) {
include(get_attachment_template());
exit;
} else if ( is_single() && get_single_template() ) {
if ( is_subpost() )
add_filter('the_content', 'prepend_object');
if ( is_attachment() )
add_filter('the_content', 'prepend_attachment');
include(get_single_template());
exit;
} else if ( is_page() && get_page_template() ) {
if ( is_subpost() )
add_filter('the_content', 'prepend_object');
if ( is_attachment() )
add_filter('the_content', 'prepend_attachment');
include(get_page_template());
exit;
} else if ( is_category() && get_category_template()) {

View File

@ -3,6 +3,6 @@
// This just holds the version number, in a separate file so we can bump it without cluttering the SVN
$wp_version = '1.6-ALPHA-2-still-dont-use';
$wp_db_version = 3091;
$wp_db_version = 3092;
?>
?>