| 32 | | $bgcolor = ''; |
|---|
| 33 | | add_filter('the_title','wp_specialchars'); |
|---|
| 34 | | |
|---|
| 35 | | // Create array of post IDs. |
|---|
| 36 | | $post_ids = array(); |
|---|
| 37 | | foreach ( $wp_query->posts as $a_post ) |
|---|
| 38 | | $post_ids[] = $a_post->ID; |
|---|
| 39 | | |
|---|
| 40 | | $comment_pending_count = get_pending_comments_num($post_ids); |
|---|
| 41 | | |
|---|
| 42 | | while (have_posts()) : the_post(); |
|---|
| 43 | | $class = 'alternate' == $class ? '' : 'alternate'; |
|---|
| 44 | | global $current_user; |
|---|
| 45 | | $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' ); |
|---|
| 46 | | $edit_link = get_edit_post_link( $post->ID ); |
|---|
| 47 | | $title = get_the_title(); |
|---|
| 48 | | if ( empty($title) ) |
|---|
| 49 | | $title = __('(no title)'); |
|---|
| 50 | | ?> |
|---|
| 51 | | <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top"> |
|---|
| 52 | | |
|---|
| 53 | | <?php |
|---|
| 54 | | |
|---|
| 55 | | foreach($posts_columns as $column_name=>$column_display_name) { |
|---|
| 56 | | |
|---|
| 57 | | switch($column_name) { |
|---|
| 58 | | |
|---|
| 59 | | case 'cb': |
|---|
| 60 | | ?> |
|---|
| 61 | | <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th> |
|---|
| 62 | | <?php |
|---|
| 63 | | break; |
|---|
| 64 | | case 'modified': |
|---|
| 65 | | case 'date': |
|---|
| 66 | | if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) { |
|---|
| 67 | | $t_time = $h_time = __('Unpublished'); |
|---|
| 68 | | } else { |
|---|
| 69 | | if ( 'modified' == $column_name ) { |
|---|
| 70 | | $t_time = get_the_modified_time(__('Y/m/d g:i:s A')); |
|---|
| 71 | | $m_time = $post->post_modified; |
|---|
| 72 | | $time = get_post_modified_time('G', true); |
|---|
| 73 | | } else { |
|---|
| 74 | | $t_time = get_the_time(__('Y/m/d g:i:s A')); |
|---|
| 75 | | $m_time = $post->post_date; |
|---|
| 76 | | $time = get_post_time('G', true); |
|---|
| 77 | | } |
|---|
| 78 | | if ( ( abs(time() - $time) ) < 86400 ) { |
|---|
| 79 | | if ( ( 'future' == $post->post_status) ) |
|---|
| 80 | | $h_time = sprintf( __('%s from now'), human_time_diff( $time ) ); |
|---|
| 81 | | else |
|---|
| 82 | | $h_time = sprintf( __('%s ago'), human_time_diff( $time ) ); |
|---|
| 83 | | } else { |
|---|
| 84 | | $h_time = mysql2date(__('Y/m/d'), $m_time); |
|---|
| 85 | | } |
|---|
| 86 | | } |
|---|
| 87 | | |
|---|
| 88 | | if ( 'excerpt' == $mode ) : ?> |
|---|
| 89 | | <td><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td> |
|---|
| 90 | | <?php else : ?> |
|---|
| 91 | | <td><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td> |
|---|
| 92 | | <?php endif; |
|---|
| 93 | | break; |
|---|
| 94 | | case 'title': |
|---|
| 95 | | ?> |
|---|
| 96 | | <td class="post-title"><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong> |
|---|
| 97 | | <?php |
|---|
| 98 | | if ( !empty($post->post_password) ) { _e(' — <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' — <strong>Private</strong>'); } |
|---|
| 99 | | |
|---|
| 100 | | if ( 'excerpt' == $mode ) |
|---|
| 101 | | the_excerpt(); |
|---|
| 102 | | |
|---|
| 103 | | $actions = array(); |
|---|
| 104 | | $actions['edit'] = '<a href="post.php?action=edit&post=' . $post->ID . '">' . __('Edit') . '</a>'; |
|---|
| 105 | | $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post_ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; |
|---|
| 106 | | $action_count = count($actions); |
|---|
| 107 | | $i = 0; |
|---|
| 108 | | foreach ( $actions as $action => $link ) { |
|---|
| 109 | | ++$i; |
|---|
| 110 | | ( $i == $action_count ) ? $sep = '' : $sep = ' | '; |
|---|
| 111 | | echo "<span class='$action'>$link$sep</span>"; |
|---|
| 112 | | } |
|---|
| 113 | | ?> |
|---|
| 114 | | </td> |
|---|
| 115 | | <?php |
|---|
| 116 | | break; |
|---|
| 117 | | |
|---|
| 118 | | case 'categories': |
|---|
| 119 | | ?> |
|---|
| 120 | | <td><?php |
|---|
| 121 | | $categories = get_the_category(); |
|---|
| 122 | | if ( !empty( $categories ) ) { |
|---|
| 123 | | $out = array(); |
|---|
| 124 | | foreach ( $categories as $c ) |
|---|
| 125 | | $out[] = "<a href='edit.php?category_name=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>"; |
|---|
| 126 | | echo join( ', ', $out ); |
|---|
| 127 | | } else { |
|---|
| 128 | | _e('Uncategorized'); |
|---|
| 129 | | } |
|---|
| 130 | | ?></td> |
|---|
| 131 | | <?php |
|---|
| 132 | | break; |
|---|
| 133 | | |
|---|
| 134 | | case 'tags': |
|---|
| 135 | | ?> |
|---|
| 136 | | <td><?php |
|---|
| 137 | | $tags = get_the_tags(); |
|---|
| 138 | | if ( !empty( $tags ) ) { |
|---|
| 139 | | $out = array(); |
|---|
| 140 | | foreach ( $tags as $c ) |
|---|
| 141 | | $out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>"; |
|---|
| 142 | | echo join( ', ', $out ); |
|---|
| 143 | | } else { |
|---|
| 144 | | _e('No Tags'); |
|---|
| 145 | | } |
|---|
| 146 | | ?></td> |
|---|
| 147 | | <?php |
|---|
| 148 | | break; |
|---|
| 149 | | |
|---|
| 150 | | case 'comments': |
|---|
| 151 | | ?> |
|---|
| 152 | | <td class="num"><div class="post-com-count-wrapper"> |
|---|
| 153 | | <?php |
|---|
| 154 | | $left = isset($comment_pending_count) ? $comment_pending_count[$post->ID] : 0; |
|---|
| 155 | | $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); |
|---|
| 156 | | if ( $left ) |
|---|
| 157 | | echo '<strong>'; |
|---|
| 158 | | 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>'); |
|---|
| 159 | | if ( $left ) |
|---|
| 160 | | echo '</strong>'; |
|---|
| 161 | | ?> |
|---|
| 162 | | </div></td> |
|---|
| 163 | | <?php |
|---|
| 164 | | break; |
|---|
| 165 | | |
|---|
| 166 | | case 'author': |
|---|
| 167 | | ?> |
|---|
| 168 | | <td><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> |
|---|
| 169 | | <?php |
|---|
| 170 | | break; |
|---|
| 171 | | |
|---|
| 172 | | case 'status': |
|---|
| 173 | | ?> |
|---|
| 174 | | <td> |
|---|
| 175 | | <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> |
|---|
| 176 | | <?php |
|---|
| 177 | | switch ( $post->post_status ) { |
|---|
| 178 | | case 'publish' : |
|---|
| 179 | | case 'private' : |
|---|
| 180 | | _e('Published'); |
|---|
| 181 | | break; |
|---|
| 182 | | case 'future' : |
|---|
| 183 | | _e('Scheduled'); |
|---|
| 184 | | break; |
|---|
| 185 | | case 'pending' : |
|---|
| 186 | | _e('Pending Review'); |
|---|
| 187 | | break; |
|---|
| 188 | | case 'draft' : |
|---|
| 189 | | _e('Unpublished'); |
|---|
| 190 | | break; |
|---|
| 191 | | } |
|---|
| 192 | | ?> |
|---|
| 193 | | </a> |
|---|
| 194 | | </td> |
|---|
| 195 | | <?php |
|---|
| 196 | | break; |
|---|
| 197 | | |
|---|
| 198 | | case 'control_view': |
|---|
| 199 | | ?> |
|---|
| 200 | | <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td> |
|---|
| 201 | | <?php |
|---|
| 202 | | break; |
|---|
| 203 | | |
|---|
| 204 | | case 'control_edit': |
|---|
| 205 | | ?> |
|---|
| 206 | | <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td> |
|---|
| 207 | | <?php |
|---|
| 208 | | break; |
|---|
| 209 | | |
|---|
| 210 | | case 'control_delete': |
|---|
| 211 | | ?> |
|---|
| 212 | | <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'>" . __('Delete') . "</a>"; } ?></td> |
|---|
| 213 | | <?php |
|---|
| 214 | | break; |
|---|
| 215 | | |
|---|
| 216 | | default: |
|---|
| 217 | | ?> |
|---|
| 218 | | <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td> |
|---|
| 219 | | <?php |
|---|
| 220 | | break; |
|---|
| 221 | | } |
|---|
| 222 | | } |
|---|
| 223 | | ?> |
|---|
| 224 | | </tr> |
|---|
| 225 | | <?php |
|---|
| 226 | | endwhile; |
|---|
| | 32 | post_rows(); |
|---|