89 <?php |
90 <?php |
90 if ( 'top' == $which && !is_singular() && !$this->detached && !$this->is_trash ) { |
91 if ( 'top' == $which && !is_singular() && !$this->detached && !$this->is_trash ) { |
91 $this->months_dropdown( 'attachment' ); |
92 $this->months_dropdown( 'attachment' ); |
92 |
93 |
93 do_action( 'restrict_manage_posts' ); |
94 do_action( 'restrict_manage_posts' ); |
94 submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); |
95 submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) ); |
95 } |
96 } |
96 |
97 |
97 if ( $this->detached ) { |
98 if ( $this->detached ) { |
98 submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false ); |
99 submit_button( __( 'Scan for lost attachments' ), 'secondary', 'find_detached', false ); |
99 } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { |
100 } elseif ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { |
100 submit_button( __( 'Empty Trash' ), 'button-secondary apply', 'delete_all', false ); |
101 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); |
101 } ?> |
102 } ?> |
102 </div> |
103 </div> |
103 <?php |
104 <?php |
104 } |
105 } |
105 |
106 |
129 $posts_columns['cb'] = '<input type="checkbox" />'; |
130 $posts_columns['cb'] = '<input type="checkbox" />'; |
130 $posts_columns['icon'] = ''; |
131 $posts_columns['icon'] = ''; |
131 /* translators: column name */ |
132 /* translators: column name */ |
132 $posts_columns['title'] = _x( 'File', 'column name' ); |
133 $posts_columns['title'] = _x( 'File', 'column name' ); |
133 $posts_columns['author'] = __( 'Author' ); |
134 $posts_columns['author'] = __( 'Author' ); |
134 //$posts_columns['tags'] = _x( 'Tags', 'column name' ); |
135 |
|
136 $taxonomies = array(); |
|
137 |
|
138 $taxonomies = get_taxonomies_for_attachments( 'objects' ); |
|
139 $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); |
|
140 |
|
141 $taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' ); |
|
142 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); |
|
143 |
|
144 foreach ( $taxonomies as $taxonomy ) { |
|
145 if ( 'category' == $taxonomy ) |
|
146 $column_key = 'categories'; |
|
147 elseif ( 'post_tag' == $taxonomy ) |
|
148 $column_key = 'tags'; |
|
149 else |
|
150 $column_key = 'taxonomy-' . $taxonomy; |
|
151 |
|
152 $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; |
|
153 } |
|
154 |
135 /* translators: column name */ |
155 /* translators: column name */ |
136 if ( !$this->detached ) { |
156 if ( !$this->detached ) { |
137 $posts_columns['parent'] = _x( 'Attached to', 'column name' ); |
157 $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); |
138 if ( post_type_supports( 'attachment', 'comments' ) ) |
158 if ( post_type_supports( 'attachment', 'comments' ) ) |
139 $posts_columns['comments'] = '<span class="vers"><img alt="' . esc_attr__( 'Comments' ) . '" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></span>'; |
159 $posts_columns['comments'] = '<span class="vers"><div title="' . esc_attr__( 'Comments' ) . '" class="comment-grey-bubble"></div></span>'; |
140 } |
160 } |
141 /* translators: column name */ |
161 /* translators: column name */ |
142 $posts_columns['date'] = _x( 'Date', 'column name' ); |
162 $posts_columns['date'] = _x( 'Date', 'column name' ); |
143 $posts_columns = apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); |
163 $posts_columns = apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); |
144 |
164 |
247 ?> |
268 ?> |
248 <td <?php echo $attributes ?>><?php the_author() ?></td> |
269 <td <?php echo $attributes ?>><?php the_author() ?></td> |
249 <?php |
270 <?php |
250 break; |
271 break; |
251 |
272 |
252 case 'tags': |
273 case 'desc': |
253 ?> |
274 ?> |
254 <td <?php echo $attributes ?>><?php |
275 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td> |
255 $tags = get_the_tags(); |
276 <?php |
256 if ( !empty( $tags ) ) { |
277 break; |
257 $out = array(); |
278 |
258 foreach ( $tags as $c ) |
279 case 'date': |
259 $out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'post_tag', 'display' ) ) . "</a>"; |
280 if ( '0000-00-00 00:00:00' == $post->post_date ) { |
260 echo join( ', ', $out ); |
281 $h_time = __( 'Unpublished' ); |
261 } else { |
282 } else { |
262 _e( 'No Tags' ); |
|
263 } |
|
264 ?> |
|
265 </td> |
|
266 <?php |
|
267 break; |
|
268 |
|
269 case 'desc': |
|
270 ?> |
|
271 <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td> |
|
272 <?php |
|
273 break; |
|
274 |
|
275 case 'date': |
|
276 if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) { |
|
277 $t_time = $h_time = __( 'Unpublished' ); |
|
278 } else { |
|
279 $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) ); |
|
280 $m_time = $post->post_date; |
283 $m_time = $post->post_date; |
281 $time = get_post_time( 'G', true, $post, false ); |
284 $time = get_post_time( 'G', true, $post, false ); |
282 if ( ( abs( $t_diff = time() - $time ) ) < 86400 ) { |
285 if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) { |
283 if ( $t_diff < 0 ) |
286 if ( $t_diff < 0 ) |
284 $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) ); |
287 $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) ); |
285 else |
288 else |
286 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); |
289 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); |
287 } else { |
290 } else { |
336 </td> |
339 </td> |
337 <?php |
340 <?php |
338 break; |
341 break; |
339 |
342 |
340 default: |
343 default: |
|
344 if ( 'categories' == $column_name ) |
|
345 $taxonomy = 'category'; |
|
346 elseif ( 'tags' == $column_name ) |
|
347 $taxonomy = 'post_tag'; |
|
348 elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) |
|
349 $taxonomy = substr( $column_name, 9 ); |
|
350 else |
|
351 $taxonomy = false; |
|
352 |
|
353 if ( $taxonomy ) { |
|
354 $taxonomy_object = get_taxonomy( $taxonomy ); |
|
355 echo '<td ' . $attributes . '>'; |
|
356 if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) { |
|
357 $out = array(); |
|
358 foreach ( $terms as $t ) { |
|
359 $posts_in_term_qv = array(); |
|
360 $posts_in_term_qv['taxonomy'] = $taxonomy; |
|
361 $posts_in_term_qv['term'] = $t->slug; |
|
362 |
|
363 $out[] = sprintf( '<a href="%s">%s</a>', |
|
364 esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), |
|
365 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) |
|
366 ); |
|
367 } |
|
368 /* translators: used between list items, there is a space after the comma */ |
|
369 echo join( __( ', ' ), $out ); |
|
370 } else { |
|
371 echo '—'; |
|
372 } |
|
373 echo '</td>'; |
|
374 break; |
|
375 } |
341 ?> |
376 ?> |
342 <td <?php echo $attributes ?>> |
377 <td <?php echo $attributes ?>> |
343 <?php do_action( 'manage_media_custom_column', $column_name, $id ); ?> |
378 <?php do_action( 'manage_media_custom_column', $column_name, $id ); ?> |
344 </td> |
379 </td> |
345 <?php |
380 <?php |
357 if ( $this->detached ) { |
392 if ( $this->detached ) { |
358 if ( current_user_can( 'edit_post', $post->ID ) ) |
393 if ( current_user_can( 'edit_post', $post->ID ) ) |
359 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; |
394 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; |
360 if ( current_user_can( 'delete_post', $post->ID ) ) |
395 if ( current_user_can( 'delete_post', $post->ID ) ) |
361 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
396 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
362 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
397 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
363 } else { |
398 } else { |
364 $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
399 $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
365 $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>"; |
400 $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>"; |
366 } |
401 } |
367 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; |
402 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; |
368 if ( current_user_can( 'edit_post', $post->ID ) ) |
403 if ( current_user_can( 'edit_post', $post->ID ) ) |
369 $actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>'; |
404 $actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>'; |
370 } |
405 } |
371 else { |
406 else { |
372 if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) |
407 if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) |
373 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; |
408 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; |
374 if ( current_user_can( 'delete_post', $post->ID ) ) { |
409 if ( current_user_can( 'delete_post', $post->ID ) ) { |
375 if ( $this->is_trash ) |
410 if ( $this->is_trash ) |
376 $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-attachment_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; |
411 $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; |
377 elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) |
412 elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) |
378 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
413 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
379 if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { |
414 if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { |
380 $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; |
415 $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; |
381 $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>"; |
416 $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>"; |
382 } |
417 } |
383 } |
418 } |
384 if ( !$this->is_trash ) { |
419 if ( !$this->is_trash ) { |
385 $title =_draft_or_post_title( $post->post_parent ); |
420 $title =_draft_or_post_title( $post->post_parent ); |
386 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; |
421 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; |