home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Blogs / wordpress2.6.exe / wordpress2.6 / wp-admin / edit-attachment-rows.php < prev    next >
Encoding:
PHP Script  |  2008-04-25  |  4.1 KB  |  153 lines

  1. <?php if ( ! defined('ABSPATH') ) die(); ?>
  2. <table class="widefat">
  3.     <thead>
  4.     <tr>
  5.  
  6. <?php $posts_columns = wp_manage_media_columns(); ?>
  7. <?php foreach($posts_columns as $post_column_key => $column_display_name) {
  8.     if ( 'cb' === $post_column_key )
  9.         $class = ' class="check-column"';
  10.     elseif ( 'comments' === $post_column_key )
  11.         $class = ' class="num"';
  12.     else
  13.         $class = '';
  14. ?>
  15.     <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
  16. <?php } ?>
  17.  
  18.     </tr>
  19.     </thead>
  20.     <tbody id="the-list" class="list:post">
  21. <?php
  22. if ( have_posts() ) {
  23. $bgcolor = '';
  24. add_filter('the_title','wp_specialchars');
  25. while (have_posts()) : the_post();
  26. $class = 'alternate' == $class ? '' : 'alternate';
  27. global $current_user;
  28. $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
  29. $att_title = get_the_title();
  30. if ( empty($att_title) )
  31.     $att_title = __('(no title)');
  32.  
  33. ?>
  34.     <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
  35.  
  36. <?php
  37.  
  38. foreach($posts_columns as $column_name=>$column_display_name) {
  39.  
  40.     switch($column_name) {
  41.  
  42.     case 'cb':
  43.         ?>
  44.         <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th>
  45.         <?php
  46.         break;
  47.  
  48.     case 'icon':
  49.         ?>
  50.         <td class="media-icon"><?php echo wp_get_attachment_link($post->ID, array(80, 60), false, true); ?></td>
  51.         <?php
  52.         // TODO
  53.         break;
  54.  
  55.     case 'media':
  56.         ?>
  57.         <td><strong><a href="media.php?action=edit&attachment_id=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
  58.         <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
  59.         <?php do_action('manage_media_media_column', $post->ID); ?>
  60.         </td>
  61.         <?php
  62.         break;
  63.  
  64.     case 'desc':
  65.         ?>
  66.         <td><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
  67.         <?php
  68.         break;
  69.  
  70.     case 'date':
  71.         if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
  72.             $t_time = $h_time = __('Unpublished');
  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.             if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
  78.                 if ( $t_diff < 0 )
  79.                     $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
  80.                 else
  81.                     $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
  82.             } else {
  83.                 $h_time = mysql2date(__('Y/m/d'), $m_time);
  84.             }
  85.         }
  86.         ?>
  87.         <td><?php echo $h_time ?></td>
  88.         <?php
  89.         break;
  90.  
  91.     case 'parent':
  92.         $title = __('(no title)'); // override below
  93.         if ( $post->post_parent > 0 ) {
  94.             if ( get_post($post->post_parent) ) {
  95.                 $parent_title = get_the_title($post->post_parent);
  96.                 if ( !empty($parent_title) )
  97.                     $title = $parent_title;
  98.             }
  99.             ?>
  100.             <td><strong><a href="post.php?action=edit&post=<?php echo $post->post_parent; ?>"><?php echo $title ?></a></strong></td>
  101.             <?php
  102.         } else {
  103.             ?>
  104.             <td> </td>
  105.             <?php
  106.         }
  107.  
  108.         break;
  109.  
  110.     case 'comments':
  111.         ?>
  112.         <td class="num"><div class="post-com-count-wrapper">
  113.         <?php
  114.         $left = get_pending_comments_num( $post->ID );
  115.         $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
  116.         if ( $left )
  117.             echo '<strong>';
  118.         comments_number("<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
  119.         if ( $left )
  120.             echo '</strong>';
  121.         ?>
  122.         </div></td>
  123.         <?php
  124.         break;
  125.  
  126.     case 'location':
  127.         ?>
  128.         <td><a href="<?php the_permalink(); ?>"><?php _e('Permalink'); ?></a></td>
  129.         <?php
  130.         break;
  131.  
  132.     default:
  133.         ?>
  134.         <td><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
  135.         <?php
  136.         break;
  137.     }
  138. }
  139. ?>
  140.     </tr>
  141. <?php
  142. endwhile;
  143. } else {
  144. ?>
  145.   <tr style='background-color: <?php echo $bgcolor; ?>'>
  146.     <td colspan="8"><?php _e('No posts found.') ?></td>
  147.   </tr>
  148. <?php
  149. } // end if ( have_posts() )
  150. ?>
  151.     </tbody>
  152. </table>
  153.