-<?php wp_nonce_field('bulk-media'); ?>
-<?php if ( have_posts() || isset( $orphans ) ) { ?>
-<div class="tablenav">
-<?php
-if ( ! isset($page_links_total) )
- $page_links_total = $wp_query->max_num_pages;
-
-$page_links = paginate_links( array(
- 'base' => add_query_arg( 'paged', '%#%' ),
- 'format' => '',
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- 'total' => $page_links_total,
- 'current' => $_GET['paged']
-));
-
-if ( $page_links ) : ?>
-<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
- number_format_i18n( ( $_GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page'] + 1 ),
- number_format_i18n( min( $_GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ),
- number_format_i18n( $wp_query->found_posts ),
- $page_links
-); echo $page_links_text; ?></div>
-<?php endif; ?>
-
-<div class="alignleft actions">
-<?php if ( ! isset( $orphans ) || ! empty( $orphans ) ) { ?>
-<select name="action" class="select-action">
-<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
-<?php if ( $is_trash ) { ?>
-<option value="untrash"><?php _e('Restore'); ?></option>
-<?php } if ( $is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { ?>
-<option value="delete"><?php _e('Delete Permanently'); ?></option>
-<?php } else { ?>
-<option value="trash"><?php _e('Move to Trash'); ?></option>
-<?php } if ( isset($orphans) ) { ?>
-<option value="attach"><?php _e('Attach to a post'); ?></option>
-<?php } ?>
-</select>
-<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
-
-<?php
-if ( !is_singular() && !isset($_GET['detached']) && !$is_trash ) {
- $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
-
- $arc_result = $wpdb->get_results( $arc_query );
-
- $month_count = count($arc_result);
-
- if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?>
-<select name='m'>
-<option value='0'><?php _e('Show all dates'); ?></option>
-<?php
-foreach ($arc_result as $arc_row) {
- if ( $arc_row->yyear == 0 )
- continue;
- $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
-
- if ( isset($_GET['m']) && ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) )
- $default = ' selected="selected"';
- else
- $default = '';
-
- echo "<option$default value='" . esc_attr("$arc_row->yyear$arc_row->mmonth") . "'>";
- echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
- echo "</option>\n";
-}
-?>
-</select>
-<?php endif; // month_count ?>
-
-<?php do_action('restrict_manage_posts'); ?>
-
-<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
-
-<?php } // ! is_singular ?>
-
-<?php
-
-} // ! empty( $orphans )
-
-if ( isset($_GET['detached']) ) { ?>
- <input type="submit" id="find_detached" name="find_detached" value="<?php esc_attr_e('Scan for lost attachments'); ?>" class="button-secondary" />
-<?php } elseif ( isset($_GET['status']) && $_GET['status'] == 'trash' && current_user_can('edit_others_posts') ) { ?>
- <input type="submit" id="delete_all" name="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
-<?php } ?>
-
-</div>
-
-<br class="clear" />
-</div>
-
-<?php } // have_posts() || !empty( $orphans ) ?>
-
-<div class="clear"></div>
-
-<?php if ( ! empty( $orphans ) ) { ?>
-<table class="widefat" cellspacing="0">
-<thead>
-<tr>
- <th scope="col" class="check-column"><input type="checkbox" /></th>
- <th scope="col"></th>
- <th scope="col"><?php /* translators: column name in media */ _ex('Media', 'media column name'); ?></th>
- <th scope="col"><?php /* translators: column name in media */ _ex('Author', 'media column name'); ?></th>
- <th scope="col"><?php /* translators: column name in media */ _ex('Date Added', 'media column name'); ?></th>
-</tr>
-</thead>
-
-<tfoot>
-<tr>
- <th scope="col" class="check-column"><input type="checkbox" /></th>
- <th scope="col"></th>
- <th scope="col"><?php /* translators: column name in media */ _ex('Media', 'media column name'); ?></th>
- <th scope="col"><?php /* translators: column name in media */ _ex('Author', 'media column name'); ?></th>
- <th scope="col"><?php /* translators: column name in media */ _ex('Date Added', 'media column name'); ?></th>
-</tr>
-</tfoot>
-
-<tbody id="the-list" class="list:post">
-<?php
- foreach ( $orphans as $post ) {
- $class = 'alternate' == $class ? '' : 'alternate';
- $att_title = esc_html( _draft_or_post_title($post->ID) );
-?>
- <tr id='post-<?php echo $post->ID; ?>' class='<?php echo $class; ?>' valign="top">
- <th scope="row" class="check-column"><?php if ( current_user_can('edit_post', $post->ID) ) { ?><input type="checkbox" name="media[]" value="<?php echo esc_attr($post->ID); ?>" /><?php } ?></th>
-
- <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 echo $post->ID; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $att_title)); ?>"><?php echo $thumb; ?></a>
-<?php } ?></td>
-
- <td class="media column-media"><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
- <?php
- if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) )
- echo esc_html( strtoupper( $matches[1] ) );
- else
- echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) );
- ?>
-
- <div class="row-actions">
- <?php
- $actions = array();
- if ( current_user_can('edit_post', $post->ID) )
- $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
- if ( current_user_can('delete_post', $post->ID) )
- if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
- $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID) . "'>" . __('Trash') . "</a>";
- } else {
- $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
- $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-attachment_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
- }
- $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
- if ( current_user_can('edit_post', $post->ID) )
- $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;" class="hide-if-no-js">'.__('Attach').'</a>';
- $actions = apply_filters( 'media_row_actions', $actions, $post );
- $action_count = count($actions);
- $i = 0;
- foreach ( $actions as $action => $link ) {
- ++$i;
- ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
- echo "<span class='$action'>$link$sep</span>";
- } ?>
- </div></td>
- <td class="author column-author"><?php $author = get_userdata($post->post_author); echo $author->display_name; ?></td>
-<?php 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;
- $time = get_post_time( 'G', true );
- if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
- if ( $t_diff < 0 )
- $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 class="date column-date"><?php echo $h_time ?></td>
- </tr>
-<?php } ?>
-</tbody>
-</table>