mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-16 07:35:39 +01:00
1e2c4818e8
git-svn-id: http://svn.automattic.com/wordpress/trunk@6997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
193 lines
5.2 KiB
PHP
193 lines
5.2 KiB
PHP
<?php if ( ! defined('ABSPATH') ) die(); ?>
|
|
<table class="widefat">
|
|
<thead>
|
|
<tr>
|
|
|
|
<?php $posts_columns = wp_manage_posts_columns(); ?>
|
|
<?php foreach($posts_columns as $column_display_name) { ?>
|
|
<th scope="col"><?php echo $column_display_name; ?></th>
|
|
<?php } ?>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody id="the-list" class="list:post">
|
|
<?php
|
|
$i_post = 0;
|
|
if ( have_posts() ) {
|
|
$bgcolor = '';
|
|
add_filter('the_title','wp_specialchars');
|
|
while (have_posts()) : the_post(); $i_post++;
|
|
if ( 16 == $i_post )
|
|
echo "\t</tbody>\n\t<tbody id='the-extra-list' class='list:post' style='display: none'>\n"; // Hack!
|
|
$class = ( $i_post > 15 || 'alternate' == $class) ? '' : 'alternate';
|
|
global $current_user;
|
|
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
|
|
?>
|
|
<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':
|
|
?>
|
|
<th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th>
|
|
<?php
|
|
break;
|
|
case 'modified':
|
|
case 'date':
|
|
if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
|
|
$t_time = $h_time = __('Unpublished');
|
|
} else {
|
|
if ( 'modified' == $column_name ) {
|
|
$t_time = get_the_modified_time(__('Y/m/d g:i:s A'));
|
|
$m_time = $post->post_modified;
|
|
$time = get_post_modified_time('G', true);
|
|
} else {
|
|
$t_time = get_the_time(__('Y/m/d g:i:s A'));
|
|
$m_time = $post->post_date;
|
|
$time = get_post_time('G', true);
|
|
}
|
|
if ( ( abs(time() - $time) ) < 86400 ) {
|
|
if ( ( 'future' == $post->post_status) )
|
|
$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><a href="<?php the_permalink(); ?>" rel="permalink" title="<?php echo $t_time ?>"><?php echo $h_time ?></a></td>
|
|
<?php
|
|
break;
|
|
case 'title':
|
|
$title = get_the_title();
|
|
if ( empty($title) )
|
|
$title = __('(no title)');
|
|
?>
|
|
<td><strong><a class="row-title" href="post.php?action=edit&post=<?php the_ID(); ?>"><?php echo $title ?></a></strong>
|
|
<?php if ('private' == $post->post_status) _e(' — <strong>Private</strong>'); ?></td>
|
|
<?php
|
|
break;
|
|
|
|
case 'categories':
|
|
?>
|
|
<td><?php
|
|
$categories = get_the_category();
|
|
if ( !empty( $categories ) ) {
|
|
$out = array();
|
|
foreach ( $categories as $c )
|
|
$out[] = "<a href='edit.php?category_name=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
|
|
echo join( ', ', $out );
|
|
} else {
|
|
_e('Uncategorized');
|
|
}
|
|
?></td>
|
|
<?php
|
|
break;
|
|
|
|
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;
|
|
|
|
case 'comments':
|
|
?>
|
|
<td style="text-align: center">
|
|
<?php
|
|
$left = get_pending_comments_num( $post->ID );
|
|
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
|
|
if ( $left )
|
|
echo '<strong>';
|
|
comments_number("<a href='edit.php?p=$id&c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('0') . '</span></a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('1') . '</span></a>', "<a href='edit.php?p=$id&c=1' title='$pending_phrase' class='post-com-count comment-count'><span>" . __('%') . '</span></a>');
|
|
if ( $left )
|
|
echo '</strong>';
|
|
?>
|
|
</td>
|
|
<?php
|
|
break;
|
|
|
|
case 'author':
|
|
?>
|
|
<td><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
|
|
<?php
|
|
break;
|
|
|
|
case 'status':
|
|
?>
|
|
<td>
|
|
<?php
|
|
switch ( $post->post_status ) {
|
|
case 'publish' :
|
|
case 'private' :
|
|
_e('Published');
|
|
break;
|
|
case 'future' :
|
|
_e('Scheduled');
|
|
break;
|
|
case 'pending' :
|
|
_e('Pending Review');
|
|
break;
|
|
case 'draft' :
|
|
_e('Unpublished');
|
|
break;
|
|
}
|
|
?>
|
|
</td>
|
|
<?php
|
|
break;
|
|
|
|
case 'control_view':
|
|
?>
|
|
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
|
|
<?php
|
|
break;
|
|
|
|
case 'control_edit':
|
|
?>
|
|
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
|
|
<?php
|
|
break;
|
|
|
|
case 'control_delete':
|
|
?>
|
|
<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete:the-list:post-$post->ID delete'>" . __('Delete') . "</a>"; } ?></td>
|
|
<?php
|
|
break;
|
|
|
|
default:
|
|
?>
|
|
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
|
|
<?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>
|