-
+ 388B69C816AD5366DC8A395562CCAEA40281812EE57CF4FD66C01E747242AE4E19207C98F8F5141DBEA902847D2A812CE219EB015F35A3F13717CBBB06AFEFCB
mp-wp/wp-admin/edit-attachment-rows.php
(0 . 0)(1 . 210)
9588 <?php
9589 /**
9590 * Edit attachments table for inclusion in administration panels.
9591 *
9592 * @package WordPress
9593 * @subpackage Administration
9594 */
9595
9596 if ( ! defined('ABSPATH') ) die();
9597
9598 if ( have_posts() ) { ?>
9599 <table class="widefat fixed" cellspacing="0">
9600 <thead>
9601 <tr>
9602 <?php print_column_headers('upload'); ?>
9603 </tr>
9604 </thead>
9605
9606 <tfoot>
9607 <tr>
9608 <?php print_column_headers('upload', false); ?>
9609 </tr>
9610 </tfoot>
9611
9612 <tbody id="the-list" class="list:post">
9613 <?php
9614 add_filter('the_title','wp_specialchars');
9615 $alt = '';
9616 $posts_columns = get_column_headers('upload');
9617 $hidden = get_hidden_columns('upload');
9618 while (have_posts()) : the_post();
9619 $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
9620 global $current_user;
9621 $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
9622 $att_title = _draft_or_post_title();
9623
9624 ?>
9625 <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
9626
9627 <?php
9628 foreach ($posts_columns as $column_name => $column_display_name ) {
9629 $class = "class=\"$column_name column-$column_name\"";
9630
9631 $style = '';
9632 if ( in_array($column_name, $hidden) )
9633 $style = ' style="display:none;"';
9634
9635 $attributes = "$class$style";
9636
9637 switch($column_name) {
9638
9639 case 'cb':
9640 ?>
9641 <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
9642 <?php
9643 break;
9644
9645 case 'icon':
9646 $attributes = 'class="column-icon media-icon"' . $style;
9647 ?>
9648 <td <?php echo $attributes ?>><?php
9649 if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
9650 ?>
9651
9652 <a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>">
9653 <?php echo $thumb; ?>
9654 </a>
9655
9656 <?php }
9657 ?></td>
9658 <?php
9659 // TODO
9660 break;
9661
9662 case 'media':
9663 ?>
9664 <td <?php echo $attributes ?>><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 />
9665 <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
9666 <p>
9667 <?php
9668 $actions = array();
9669 if ( current_user_can('edit_post', $post->ID) )
9670 $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
9671 if ( current_user_can('delete_post', $post->ID) )
9672 $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 attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
9673 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
9674 $action_count = count($actions);
9675 $i = 0;
9676 echo '<div class="row-actions">';
9677 foreach ( $actions as $action => $link ) {
9678 ++$i;
9679 ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
9680 echo "<span class='$action'>$link$sep</span>";
9681 }
9682 echo '</div>';
9683 ?></p></td>
9684 <?php
9685 break;
9686
9687 case 'author':
9688 ?>
9689 <td <?php echo $attributes ?>><?php the_author() ?></td>
9690 <?php
9691 break;
9692
9693 case 'tags':
9694 ?>
9695 <td <?php echo $attributes ?>><?php
9696 $tags = get_the_tags();
9697 if ( !empty( $tags ) ) {
9698 $out = array();
9699 foreach ( $tags as $c )
9700 $out[] = "<a href='edit.php?tag=$c->slug'> " . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
9701 echo join( ', ', $out );
9702 } else {
9703 _e('No Tags');
9704 }
9705 ?></td>
9706 <?php
9707 break;
9708
9709 case 'desc':
9710 ?>
9711 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
9712 <?php
9713 break;
9714
9715 case 'date':
9716 if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
9717 $t_time = $h_time = __('Unpublished');
9718 } else {
9719 $t_time = get_the_time(__('Y/m/d g:i:s A'));
9720 $m_time = $post->post_date;
9721 $time = get_post_time( 'G', true, $post );
9722 if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
9723 if ( $t_diff < 0 )
9724 $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
9725 else
9726 $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
9727 } else {
9728 $h_time = mysql2date(__('Y/m/d'), $m_time);
9729 }
9730 }
9731 ?>
9732 <td <?php echo $attributes ?>><?php echo $h_time ?></td>
9733 <?php
9734 break;
9735
9736 case 'parent':
9737 if ( $post->post_parent > 0 ) {
9738 if ( get_post($post->post_parent) ) {
9739 $title =_draft_or_post_title($post->post_parent);
9740 }
9741 ?>
9742 <td <?php echo $attributes ?>><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>
9743 <?php
9744 } else {
9745 ?>
9746 <td <?php echo $attributes ?>> </td>
9747 <?php
9748 }
9749
9750 break;
9751
9752 case 'comments':
9753 $attributes = 'class="comments column-comments num"' . $style;
9754 ?>
9755 <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
9756 <?php
9757 $left = get_pending_comments_num( $post->ID );
9758 $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
9759 if ( $left )
9760 echo '<strong>';
9761 comments_number("<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-comments.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
9762 if ( $left )
9763 echo '</strong>';
9764 ?>
9765 </div></td>
9766 <?php
9767 break;
9768
9769 case 'actions':
9770 ?>
9771 <td <?php echo $attributes ?>>
9772 <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> |
9773 <a href="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
9774 </td>
9775 <?php
9776 break;
9777
9778 default:
9779 ?>
9780 <td <?php echo $attributes ?>><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
9781 <?php
9782 break;
9783 }
9784 }
9785 ?>
9786 </tr>
9787 <?php endwhile; ?>
9788 </tbody>
9789 </table>
9790 <?php } else { ?>
9791
9792 <p><?php _e('No posts found.') ?></p>
9793
9794 <?php
9795 } // end if ( have_posts() )
9796 ?>
9797