summaryrefslogtreecommitdiffstats
path: root/wp-admin/edit-post-rows.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-04 16:44:15 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-04 16:44:15 +0000
commit7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc (patch)
treec6fd23b598f3994eddb18cb1c0f2e8d95ff054fa /wp-admin/edit-post-rows.php
parentf650f48c048bfbbb2ae702b6425d87e39358d748 (diff)
downloadwordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.tar.gz
wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.tar.xz
wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.zip
Merged with WordPress 2.5, unstable, only for testing
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1218 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/edit-post-rows.php')
-rw-r--r--wp-admin/edit-post-rows.php120
1 files changed, 100 insertions, 20 deletions
diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php
index c5e3a58..582db31 100644
--- a/wp-admin/edit-post-rows.php
+++ b/wp-admin/edit-post-rows.php
@@ -3,23 +3,34 @@
<thead>
<tr>
-<?php foreach($posts_columns as $column_display_name) { ?>
- <th scope="col"><?php echo $column_display_name; ?></th>
+<?php $posts_columns = wp_manage_posts_columns(); ?>
+<?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>
<?php } ?>
</tr>
</thead>
- <tbody id="the-list">
+ <tbody>
<?php
if ( have_posts() ) {
$bgcolor = '';
add_filter('the_title','wp_specialchars');
while (have_posts()) : the_post();
-$class = ('alternate' == $class) ? '' : 'alternate';
+$class = 'alternate' == $class ? '' : 'alternate';
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
+$title = get_the_title();
+if ( empty($title) )
+ $title = __('(no title)');
?>
- <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>'>
+ <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
<?php
@@ -27,53 +38,122 @@ foreach($posts_columns as $column_name=>$column_display_name) {
switch($column_name) {
- case 'id':
+ case 'cb':
?>
- <th scope="row" style="text-align: center"><?php echo $id ?></th>
+ <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /><?php } ?></th>
<?php
break;
case 'modified':
- ?>
- <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Never'); else the_modified_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
- <?php
- break;
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><?php if ( '0000-00-00 00:00:00' ==$post->post_date) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
+ <td><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td>
<?php
break;
case 'title':
?>
- <td><?php the_title() ?>
- <?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
+ <td><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="post.php?action=edit&amp;post=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong>
+ <?php if ( !empty($post->post_password) ) { _e(' &#8212; <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' &#8212; <strong>Private</strong>'); } ?></td>
<?php
break;
case 'categories':
?>
- <td><?php the_category(','); ?></td>
+ <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">
+ <td class="num"><div class="post-com-count-wrapper">
<?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&amp;c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('%') . '</a>');
+ comments_number("<a href='edit.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
if ( $left )
echo '</strong>';
?>
- </td>
+ </div></td>
<?php
break;
case 'author':
?>
- <td><?php the_author() ?></td>
+ <td><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
+ <?php
+ break;
+
+ case 'status':
+ ?>
+ <td>
+ <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink">
+ <?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;
+ }
+ ?>
+ </a>
+ </td>
<?php
break;
@@ -91,7 +171,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
case 'control_delete':
?>
- <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
+ <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>
<?php
break;