2008-08-16 09:27:34 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Edit attachments table for inclusion in administration panels.
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Administration
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( ! defined('ABSPATH') ) die();
|
|
|
|
?>
|
2008-02-19 07:13:20 +01:00
|
|
|
<table class="widefat">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
|
|
|
|
<?php $posts_columns = wp_manage_media_columns(); ?>
|
2008-03-15 07:14:03 +01:00
|
|
|
<?php foreach($posts_columns as $post_column_key => $column_display_name) {
|
|
|
|
if ( 'cb' === $post_column_key )
|
|
|
|
$class = ' class="check-column"';
|
|
|
|
elseif ( 'comments' === $post_column_key )
|
|
|
|
$class = ' class="num"';
|
|
|
|
else
|
|
|
|
$class = '';
|
|
|
|
?>
|
|
|
|
<th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
|
2008-02-19 07:13:20 +01:00
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody id="the-list" class="list:post">
|
|
|
|
<?php
|
|
|
|
if ( have_posts() ) {
|
|
|
|
$bgcolor = '';
|
|
|
|
add_filter('the_title','wp_specialchars');
|
2008-03-18 00:02:12 +01:00
|
|
|
while (have_posts()) : the_post();
|
|
|
|
$class = 'alternate' == $class ? '' : 'alternate';
|
2008-02-19 07:13:20 +01:00
|
|
|
global $current_user;
|
|
|
|
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
|
2008-04-25 17:28:08 +02:00
|
|
|
$att_title = get_the_title();
|
|
|
|
if ( empty($att_title) )
|
|
|
|
$att_title = __('(no title)');
|
|
|
|
|
2008-02-19 07:13:20 +01:00
|
|
|
?>
|
|
|
|
<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
foreach($posts_columns as $column_name=>$column_display_name) {
|
|
|
|
|
|
|
|
switch($column_name) {
|
|
|
|
|
|
|
|
case 'cb':
|
|
|
|
?>
|
2008-08-20 06:06:36 +02:00
|
|
|
<th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
|
2008-02-19 07:13:20 +01:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'icon':
|
|
|
|
?>
|
2008-08-20 06:06:36 +02:00
|
|
|
<td class="media-icon"><?php
|
|
|
|
if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
|
|
|
|
?>
|
|
|
|
|
|
|
|
<a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>">
|
|
|
|
<?php echo $thumb; ?>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<?php }
|
|
|
|
?></td>
|
2008-02-19 07:13:20 +01:00
|
|
|
<?php
|
|
|
|
// TODO
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'media':
|
|
|
|
?>
|
2008-07-29 07:22:58 +02:00
|
|
|
<td><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
|
2008-02-26 09:54:11 +01:00
|
|
|
<?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
|
2008-08-20 06:06:36 +02:00
|
|
|
<p>
|
|
|
|
<a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
|
|
|
|
<a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a> |
|
|
|
|
<a href="#" class="delete"><?php _e('Delete'); ?></a>
|
|
|
|
</p>
|
2008-02-22 06:53:47 +01:00
|
|
|
<?php do_action('manage_media_media_column', $post->ID); ?>
|
|
|
|
</td>
|
2008-02-19 07:13:20 +01:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
2008-08-20 06:06:36 +02:00
|
|
|
case 'tags':
|
|
|
|
?>
|
|
|
|
<td><?php
|
|
|
|
$tags = get_the_tags();
|
|
|
|
if ( !empty( $tags ) ) {
|
|
|
|
$out = array();
|
|
|
|
foreach ( $tags as $c )
|
|
|
|
$out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
|
|
|
|
echo join( ', ', $out );
|
|
|
|
} else {
|
|
|
|
_e('No Tags');
|
|
|
|
}
|
|
|
|
?></td>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
2008-02-19 07:13:20 +01:00
|
|
|
case 'desc':
|
|
|
|
?>
|
2008-02-22 06:53:47 +01:00
|
|
|
<td><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
|
2008-02-19 07:13:20 +01:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'date':
|
|
|
|
if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
|
|
|
|
$t_time = $h_time = __('Unpublished');
|
|
|
|
} else {
|
|
|
|
$t_time = get_the_time(__('Y/m/d g:i:s A'));
|
|
|
|
$m_time = $post->post_date;
|
2008-02-23 23:11:47 +01:00
|
|
|
$time = get_post_time( 'G', true );
|
2008-02-22 23:38:52 +01:00
|
|
|
if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
|
|
|
|
if ( $t_diff < 0 )
|
2008-02-19 07:13:20 +01:00
|
|
|
$h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
|
|
|
|
else
|
|
|
|
$h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
|
|
|
|
} else {
|
|
|
|
$h_time = mysql2date(__('Y/m/d'), $m_time);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<td><?php echo $h_time ?></td>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'parent':
|
2008-03-27 03:50:01 +01:00
|
|
|
$title = __('(no title)'); // override below
|
|
|
|
if ( $post->post_parent > 0 ) {
|
|
|
|
if ( get_post($post->post_parent) ) {
|
|
|
|
$parent_title = get_the_title($post->post_parent);
|
|
|
|
if ( !empty($parent_title) )
|
|
|
|
$title = $parent_title;
|
|
|
|
}
|
|
|
|
?>
|
2008-08-20 06:06:36 +02:00
|
|
|
<td><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td>
|
2008-03-27 03:50:01 +01:00
|
|
|
<?php
|
2008-02-22 23:38:52 +01:00
|
|
|
} else {
|
2008-03-27 03:50:01 +01:00
|
|
|
?>
|
|
|
|
<td> </td>
|
|
|
|
<?php
|
2008-02-22 23:38:52 +01:00
|
|
|
}
|
2008-03-27 03:50:01 +01:00
|
|
|
|
2008-02-19 07:13:20 +01:00
|
|
|
break;
|
|
|
|
|
2008-03-11 22:09:07 +01:00
|
|
|
case 'comments':
|
|
|
|
?>
|
2008-03-20 22:40:17 +01:00
|
|
|
<td class="num"><div class="post-com-count-wrapper">
|
2008-03-11 22:09:07 +01:00
|
|
|
<?php
|
|
|
|
$left = get_pending_comments_num( $post->ID );
|
|
|
|
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
|
|
|
|
if ( $left )
|
|
|
|
echo '<strong>';
|
|
|
|
comments_number("<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
|
|
|
|
if ( $left )
|
|
|
|
echo '</strong>';
|
|
|
|
?>
|
2008-03-20 22:40:17 +01:00
|
|
|
</div></td>
|
2008-03-11 22:09:07 +01:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
2008-08-20 06:06:36 +02:00
|
|
|
case 'actions':
|
2008-02-19 07:13:20 +01:00
|
|
|
?>
|
2008-08-20 06:06:36 +02:00
|
|
|
<td>
|
|
|
|
<a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php _e('Edit'); ?></a> |
|
|
|
|
<a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
|
|
|
|
</td>
|
2008-02-19 07:13:20 +01:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
?>
|
2008-02-22 06:53:47 +01:00
|
|
|
<td><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
|
2008-02-19 07:13:20 +01:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
endwhile;
|
|
|
|
} else {
|
|
|
|
?>
|
|
|
|
<tr style='background-color: <?php echo $bgcolor; ?>'>
|
|
|
|
<td colspan="8"><?php _e('No posts found.') ?></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
} // end if ( have_posts() )
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|